swift
Loading...
Searching...
No Matches
sawtoothgenerator.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_SAWTOOTHGENERATOR_H
7#define SWIFT_SOUND_SAMPLEPROVIDER_SAWTOOTHGENERATOR_H
8
9#include <array>
10
11#include <QRandomGenerator>
12#include <QVector>
13
16
17namespace swift::sound::sample_provider
18{
21 {
23
24 public:
26 CSawToothGenerator(double frequency, QObject *parent = nullptr);
27
29 int readSamples(QVector<float> &samples, qint64 count) override;
30
32 void setGain(double gain) { m_gain = gain; }
33
34 private:
35 double m_gain = 0.0;
36 double m_frequency = 0.0;
37 double m_sampleRate = 48000;
38 int m_nSample = 0;
39 };
40} // namespace swift::sound::sample_provider
41
42#endif // SWIFT_SOUND_SAMPLEPROVIDER_SAWTOOTHGENERATOR_H
CSawToothGenerator(double frequency, QObject *parent=nullptr)
Ctor.
int readSamples(QVector< float > &samples, qint64 count)
Read samples.
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.