swift
src
sound
sampleprovider
pinknoisegenerator.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 PINKNOISEGENERATOR_H
7
#define PINKNOISEGENERATOR_H
8
9
#include <array>
10
11
#include <QRandomGenerator>
12
#include <QVector>
13
14
#include "
sound/sampleprovider/sampleprovider.h
"
15
#include "
sound/swiftsoundexport.h
"
16
17
namespace
swift::sound::sample_provider
18
{
20
class
SWIFT_SOUND_EXPORT
CPinkNoiseGenerator
:
public
ISampleProvider
21
{
22
Q_OBJECT
23
24
public
:
26
CPinkNoiseGenerator
(
QObject
*parent =
nullptr
) :
ISampleProvider
(parent) {}
27
29
virtual
int
readSamples(
QVector<float>
&samples, qint64 count)
override
;
30
32
void
setGain
(
double
gain) { m_gain = gain; }
33
34
private
:
35
QRandomGenerator
m_random;
36
std::array<double, 7> m_pinkNoiseBuffer = { { 0 } };
37
double
m_gain = 0.0;
38
};
39
}
// namespace swift::sound::sample_provider
40
41
#endif
// PINKNOISEGENERATOR_H
swift::sound::sample_provider::CPinkNoiseGenerator
Pink noise generator.
Definition:
pinknoisegenerator.h:21
swift::sound::sample_provider::CPinkNoiseGenerator::CPinkNoiseGenerator
CPinkNoiseGenerator(QObject *parent=nullptr)
Noise generator.
Definition:
pinknoisegenerator.h:26
swift::sound::sample_provider::CPinkNoiseGenerator::setGain
void setGain(double gain)
Gain.
Definition:
pinknoisegenerator.h:32
swift::sound::sample_provider::ISampleProvider
Sample provider interface.
Definition:
sampleprovider.h:19
QObject
QRandomGenerator
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 Sun Oct 12 2025 20:05:14 for swift by
1.9.1