tracktion-engine
3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications
« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_engine
plugins
effects
tracktion_ToneGenerator.h
Go to the documentation of this file.
1
/*
2
,--. ,--. ,--. ,--.
3
,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4
'-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5
| | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6
`---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8
Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9
*/
10
11
namespace
tracktion
{
inline
namespace
engine
12
{
13
14
class
ToneGeneratorPlugin
:
public
Plugin
15
{
16
public
:
17
ToneGeneratorPlugin
(
PluginCreationInfo
);
18
~ToneGeneratorPlugin
()
override
;
19
20
//==============================================================================
21
static
const
char
* getPluginName() {
return
NEEDS_TRANS
(
"Tone Generator"
); }
22
static
const
char
* xmlTypeName;
23
24
juce::String
getName
()
const override
{
return
TRANS
(getPluginName()); }
25
juce::String
getPluginType()
override
{
return
xmlTypeName; }
26
juce::String
getShortName (
int
)
override
{
return
getName
(); }
27
bool
producesAudioWhenNoAudioInput()
override
{
return
true
; }
28
bool
isSynth()
override
{
return
true
; }
29
30
int
getNumOutputChannelsGivenInputs
(
int
numInputChannels)
override
{
return
juce::jmax
(1, numInputChannels); }
31
void
initialise (
const
PluginInitialisationInfo
&)
override
;
32
void
deinitialise
()
override
;
33
void
applyToBuffer
(
const
PluginRenderContext
&)
override
;
34
juce::String
getSelectableDescription
()
override
{
return
getName
(); }
35
bool
needsConstantBufferSize()
override
{
return
false
; }
36
37
void
restorePluginStateFromValueTree (
const
juce::ValueTree
&)
override
;
38
39
enum class
OscType
40
{
41
sin
,
42
triangle,
43
sawUp,
44
sawDown,
45
square,
46
noise
47
};
48
49
static
juce::StringArray
getOscTypeNames();
50
51
juce::CachedValue<float>
oscType, bandLimit, frequency, level;
52
AutomatableParameter::Ptr oscTypeParam, bandLimitParam, frequencyParam, levelParam;
53
54
private
:
55
//==============================================================================
56
juce::AudioBuffer<float>
scratch;
57
std::atomic<bool>
bandLimitOsc {
false
};
58
59
juce::dsp::Oscillator<float>
sine;
60
juce::dsp::Oscillator<float>
triangle;
61
juce::dsp::Oscillator<float>
sawUp;
62
juce::dsp::Oscillator<float>
sawDown;
63
juce::dsp::Oscillator<float>
square;
64
juce::dsp::Oscillator<float>
noise;
65
66
void
initialiseOscilators();
67
68
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
(ToneGeneratorPlugin)
69
};
70
71
}}
// namespace tracktion { inline namespace engine
std::atomic
juce::AudioBuffer
juce::CachedValue
juce::StringArray
juce::String
juce::dsp::Oscillator
tracktion::engine::Plugin
Definition
tracktion_Plugin.h:114
tracktion::engine::ToneGeneratorPlugin
Definition
tracktion_ToneGenerator.h:15
tracktion::engine::ToneGeneratorPlugin::getNumOutputChannelsGivenInputs
int getNumOutputChannelsGivenInputs(int numInputChannels) override
This must return the number of output channels that the plugin will produce, given a number of input ...
Definition
tracktion_ToneGenerator.h:30
tracktion::engine::ToneGeneratorPlugin::applyToBuffer
void applyToBuffer(const PluginRenderContext &) override
Process the next block of data.
Definition
tracktion_ToneGenerator.cpp:68
tracktion::engine::ToneGeneratorPlugin::getName
juce::String getName() const override
The name of the type, e.g.
Definition
tracktion_ToneGenerator.h:24
tracktion::engine::ToneGeneratorPlugin::deinitialise
void deinitialise() override
Called after play stops to release resources.
Definition
tracktion_ToneGenerator.cpp:64
tracktion::engine::ToneGeneratorPlugin::getSelectableDescription
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.
Definition
tracktion_ToneGenerator.h:34
TRANS
#define TRANS(stringLiteral)
NEEDS_TRANS
#define NEEDS_TRANS(stringLiteral)
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
juce::jmax
constexpr Type jmax(Type a, Type b)
tracktion::engine::PluginInitialisationInfo
Passed into Plugins when they are being initialised, to give them useful contextual information that ...
Definition
tracktion_Plugin.h:36
tracktion
Definition
tracktion_AudioReader.h:23
sin
sin
juce::ValueTree
tracktion::engine::PluginCreationInfo
Definition
tracktion_Plugin.h:15
tracktion::engine::PluginRenderContext
The context passed to plugin render methods to provide it with buffers to fill.
Definition
tracktion_Plugin.h:48
« « « Anklang Documentation