tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
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
11namespace tracktion { inline namespace engine
12{
13
15{
16public:
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;
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
54private:
55 //==============================================================================
57 std::atomic<bool> bandLimitOsc { false };
58
65
66 void initialiseOscilators();
67
69};
70
71}} // namespace tracktion { inline namespace engine
int getNumOutputChannelsGivenInputs(int numInputChannels) override
This must return the number of output channels that the plugin will produce, given a number of input ...
void applyToBuffer(const PluginRenderContext &) override
Process the next block of data.
juce::String getName() const override
The name of the type, e.g.
void deinitialise() override
Called after play stops to release resources.
juce::String getSelectableDescription() override
Subclasses must return a description of what they are.
#define TRANS(stringLiteral)
#define NEEDS_TRANS(stringLiteral)
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
constexpr Type jmax(Type a, Type b)
Passed into Plugins when they are being initialised, to give them useful contextual information that ...
sin
The context passed to plugin render methods to provide it with buffers to fill.