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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_ClickNode.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
14//==============================================================================
15namespace Click
16{
17 int getMidiClickNote (Engine&, bool big);
18 juce::String getClickWaveFile (Engine&, bool big);
19 void setMidiClickNote (Engine&, bool big, int noteNum);
20 void setClickWaveFile (Engine&, bool big, const juce::String& filename);
21}
22
23//==============================================================================
28{
29public:
30 //==============================================================================
32 ClickGenerator (Edit&, bool isMidi);
33
37 void prepareToPlay (double sampleRate, TimePosition startTime);
38
40 void processBlock (choc::buffer::ChannelArrayView<float>*, MidiMessageArray*, TimeRange);
41
42private:
43 const Edit& edit;
45 bool midi = false;
46 const tempo::Sequence& sequence { edit.tempoSequence.getInternalSequence() };
47 tempo::Sequence::Position tempoPosition { sequence };
48
49 double sampleRate = 44100.0;
50 juce::AudioBuffer<float> bigClick, littleClick;
51 int bigClickMidiNote = 37, littleClickMidiNote = 76;
52
53 //==============================================================================
54 bool isPlaying();
55 void trigger (juce::AudioBuffer<float>*);
56 void render (choc::buffer::ChannelArrayView<float>&);
57 void reset();
58 int samplesRemaining();
59
60 juce::AudioBuffer<float>* currentSample = nullptr;
61 int samplePos = -1;
62
63 //==============================================================================
64 bool isMutedAtTime (TimePosition) const;
65};
66
67
68//==============================================================================
73{
74public:
75 ClickNode (Edit&, int numAudioChannels, bool generateMidi, tracktion::graph::PlayHead&);
76
80 bool isReadyToProcess() override;
81 void process (ProcessContext&) override;
82
83private:
84 //==============================================================================
85 Edit& edit;
87 ClickGenerator clickGenerator;
88 const int numChannels;
89 const bool generateMidi;
90 double sampleRate = 44100.0;
91};
92
93}} // namespace tracktion { inline namespace engine
Generates click audio and MIDI and adds them to the provided buffer.
void processBlock(choc::buffer::ChannelArrayView< float > *, MidiMessageArray *, TimeRange)
Adds clicks to a block of audio and MIDI for a given time range.
void prepareToPlay(double sampleRate, TimePosition startTime)
Prepares a ClickGenerator to be played.
Adds audio and MIDI clicks to the input buffers.
std::vector< Node * > getDirectInputNodes() override
Should return all the inputs directly feeding in to this node.
tracktion::graph::NodeProperties getNodeProperties() override
Should return the properties of the node.
bool isReadyToProcess() override
Should return true when this node is ready to be processed.
void process(ProcessContext &) override
Called when the node is to be processed.
void prepareToPlay(const tracktion::graph::PlaybackInitialisationInfo &) override
Called once before playback begins for each node.
The Tracktion Edit class!
TransportControl & getTransport() const noexcept
Returns the TransportControl which is used to stop/stop/position playback and recording.
TempoSequence tempoSequence
The global TempoSequence of this Edit.
const tempo::Sequence & getInternalSequence() const
N.B.
EditPlaybackContext * getCurrentPlaybackContext() const
Returns the active EditPlaybackContext if this Edit is attached to the DeviceManager for playback.
Main graph Node processor class.
Struct to describe a single iteration of a process call.
Converts a monotonically increasing reference range in to a timeline range.
Represents a position in real-life time.
A Sequence::Position is an iterator through a Sequence.
Holds some really basic properties of a node.
Passed into Nodes when they are being initialised, to give them useful contextual information that th...