11namespace tracktion {
inline namespace engine
14MidiPatchBayPlugin::MidiPatchBayPlugin (PluginCreationInfo info) : Plugin (info)
16 if (! state.hasProperty (IDs::mappings))
19 sanityCheckMappings();
20 currentMappings = getMappings();
23MidiPatchBayPlugin::~MidiPatchBayPlugin()
25 notifyListenersOfDeletion();
30 return createValueTree (IDs::PLUGIN,
31 IDs::type, xmlTypeName);
34const char* MidiPatchBayPlugin::xmlTypeName =
"midipatchbay";
37void MidiPatchBayPlugin::deinitialise() {}
49 for (
int i = mma->size(); --i >= 0;)
53 auto newChan =
juce::jlimit (0, 16, (
int) currentMappings.map[m.getChannel()]);
55 if (newChan == blockChannel)
58 m.setChannel (newChan);
65void MidiPatchBayPlugin::makeConnection (
int srcChannel,
int dstChannel)
67 Mappings mappings (getMappings());
74 mappings.map[srcChannel] = (
char) dstChannel;
76 setMappings (mappings);
79void MidiPatchBayPlugin::valueTreeChanged()
81 Plugin::valueTreeChanged();
83 Mappings newMappings (getMappings());
87 currentMappings = newMappings;
93MidiPatchBayPlugin::Mappings MidiPatchBayPlugin::getMappings()
const
98 for (
int i = 0; i < saved.size(); ++i)
99 m.map[i + 1] = (
char) saved[i].getIntValue();
104void MidiPatchBayPlugin::setMappings (
const Mappings& newMappings)
107 m.preallocateBytes (64);
110 m << (
int) newMappings.map[i] <<
' ';
112 state.setProperty (IDs::mappings, m.trimEnd(), getUndoManager());
115void MidiPatchBayPlugin::resetMappings()
125void MidiPatchBayPlugin::blockAllMappings()
130 m.map[i] = (
char) blockChannel;
135void MidiPatchBayPlugin::sanityCheckMappings()
137 Mappings m (getMappings());
147 m.map[i] = (
char) dst;
157 for (
auto m : getMappings().map)
159 if (m > 0 && m <= 16)
static StringArray fromTokens(StringRef stringToTokenise, bool preserveQuotedStrings)
Type jlimit(Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept
bool isPositiveAndNotGreaterThan(Type1 valueToTest, Type2 upperLimit) noexcept
constexpr int numElementsInArray(Type(&)[N]) noexcept
Passed into Plugins when they are being initialised, to give them useful contextual information that ...
The context passed to plugin render methods to provide it with buffers to fill.
MidiMessageArray * bufferForMidiMessages
A buffer of MIDI events to process.