swift
src
sound
sampleprovider
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
11
#include "
sound/sampleprovider/sampleprovider.h
"
12
#include "
sound/swiftsoundexport.h
"
13
14
namespace
swift::sound::sample_provider
15
{
17
class
SWIFT_SOUND_EXPORT
CSinusGenerator
:
public
ISampleProvider
18
{
19
Q_OBJECT
20
21
public
:
23
CSinusGenerator
(
double
frequencyHz,
QObject
*parent =
nullptr
);
24
26
virtual
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
swift::sound::sample_provider::CSinusGenerator
Saw tooth generator.
Definition:
sinusgenerator.h:18
swift::sound::sample_provider::CSinusGenerator::setGain
void setGain(double gain)
Set the gain.
Definition:
sinusgenerator.h:29
swift::sound::sample_provider::ISampleProvider
Sample provider interface.
Definition:
sampleprovider.h:19
QObject
QVector< float >
sampleprovider.h
swiftsoundexport.h
SWIFT_SOUND_EXPORT
#define SWIFT_SOUND_EXPORT
Export a class or function from the library.
Definition:
swiftsoundexport.h:20
Generated on Wed Sep 3 2025 21:41:22 for swift by
1.9.1