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

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_StepClipChannel.cpp
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
14StepClip::Channel::Channel (StepClip& c, const juce::ValueTree& v)
15 : clip (c), state (v)
16{
17 auto* um = &clip.edit.getUndoManager();
18
19 channel.referTo (state, IDs::channel, um, MidiChannel (defaultMidiChannel));
20 noteNumber.referTo (state, IDs::note, um, defaultNoteNumber);
21 noteValue.referTo (state, IDs::velocity, um, defaultNoteValue);
22 grooveTemplate.referTo (state, IDs::groove, um);
23 grooveStrength.referTo (state, IDs::grooveStrength, um, 0.1f);
24 name.referTo (state, IDs::name, um);
25}
26
27StepClip::Channel::~Channel() noexcept
28{
29 notifyListenersOfDeletion();
30}
31
32bool StepClip::Channel::operator== (const Channel& other) const noexcept
33{
34 return channel == other.channel
35 && noteNumber == other.noteNumber
36 && noteValue == other.noteValue
37 && grooveTemplate == other.grooveTemplate
38 && name == other.name
39 && grooveStrength == other.grooveStrength;
40}
41
42bool StepClip::Channel::usesGrooveStrength() const
43{
44 auto gt = clip.edit.engine.getGrooveTemplateManager().getTemplateByName (grooveTemplate.get());
45
46 if (gt != nullptr && gt->isEmpty())
47 gt = nullptr;
48
49 if (gt != nullptr)
50 return gt->isParameterized();
51
52 return false;
53}
54
55int StepClip::Channel::getIndex() const
56{
57 return state.getParent().indexOf (state);
58}
59
60juce::String StepClip::Channel::getDisplayName() const
61{
62 return name.get().isEmpty() ? juce::String (getIndex() + 1) : name;
63}
64
65//==============================================================================
66juce::String StepClip::Channel::getSelectableDescription()
67{
69 return {};
70}
71
72}} // namespace tracktion { inline namespace engine
#define jassertfalse