Hey, quick question.
I’d like to add a global recording quantization setting in my app.
Is iterating all MIDI input devices and applying the new quantization settings the right way to achieve this ?
Like so :
auto SequencerSettingsQuantizationComponent::ApplyGlobalQuantization() noexcept -> void
{
if (mGlobalQuantization->isEmpty())
{
jassert(!mGlobalQuantization->isEmpty());
return;
}
auto& edit { *::GetEdit() };
for (auto instance : edit.getAllInputDevices())
{
auto& input_dev { instance->getInputDevice() };
if (input_dev.isMidi() &&
input_dev.getDeviceType() != te::MidiInputDevice::trackMidiDevice)
{
auto midi_dev = static_cast<te::MidiInputDevice*>(&input_dev);
midi_dev->quantisation.setType(*mGlobalQuantization);
midi_dev->quantisation.setIsQuantisingNoteOffs(*mGlobalNoteOffQuantize);
}
}
}
Note that mGlobalQuantization and mGlobalNoteOffQuantize are juce::CachedValue’s, one is juce::String and the other bool, respectively. I store these in the Edit state.
Thanks in advance,
Cheers,
E.
