swift
Loading...
Searching...
No Matches
sinusgenerator.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
5
6#ifndef SWIFT_SOUND_SAMPLEPROVIDER_SINUSGENERATOR_H
7#define SWIFT_SOUND_SAMPLEPROVIDER_SINUSGENERATOR_H
8
9#include <QtMath>
10
13
14namespace swift::sound::sample_provider
15{
18 {
20
21 public:
23 CSinusGenerator(double frequencyHz, QObject *parent = nullptr);
24
26 int readSamples(QVector<float> &samples, qint64 count) override;
27
29 void setGain(double gain) { m_gain = gain; }
30
32 void setFrequency(double frequencyHz);
33
34 private:
35 double m_gain = 0.0;
36 double m_frequencyHz = 0.0;
37 double m_sampleRate = 48000;
38 int m_nSample = 0;
39 static constexpr double s_twoPi = 2 * M_PI;
40 };
41} // namespace swift::sound::sample_provider
42
43#endif // SWIFT_SOUND_SAMPLEPROVIDER_SINUSGENERATOR_H
int readSamples(QVector< float > &samples, qint64 count)
Read samples.
CSinusGenerator(double frequencyHz, QObject *parent=nullptr)
Ctor.
ISampleProvider(QObject *parent=nullptr)
Ctor.
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const
#define SWIFT_SOUND_EXPORT
Export a class or function from the library.