A few tweaks for MTS support

This commit is contained in:
Roland Rabien 2024-10-11 21:02:25 -07:00
commit 796228e041
5 changed files with 20 additions and 11 deletions

View file

@ -132,7 +132,10 @@ file (GLOB_RECURSE source_files CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/plugin/*.cc ${CMAKE_CURRENT_SOURCE_DIR}/plugin/*.cc
${CMAKE_CURRENT_SOURCE_DIR}/plugin/*.h) ${CMAKE_CURRENT_SOURCE_DIR}/plugin/*.h)
target_sources (${PLUGIN_NAME} PRIVATE ${source_files} ${CMAKE_CURRENT_SOURCE_DIR}/modules/MTS-ESP/Client/libMTSClient.cpp) target_sources (${PLUGIN_NAME} PRIVATE
${source_files}
${CMAKE_CURRENT_SOURCE_DIR}/modules/MTS-ESP/Client/libMTSClient.h
${CMAKE_CURRENT_SOURCE_DIR}/modules/MTS-ESP/Client/libMTSClient.cpp)
source_group (TREE ${CMAKE_CURRENT_SOURCE_DIR}/plugin PREFIX Source FILES ${source_files}) source_group (TREE ${CMAKE_CURRENT_SOURCE_DIR}/plugin PREFIX Source FILES ${source_files})
file (GLOB_RECURSE asset_files CONFIGURE_DEPENDS file (GLOB_RECURSE asset_files CONFIGURE_DEPENDS

View file

@ -522,6 +522,7 @@ WavetableAudioProcessor::WavetableAudioProcessor()
extractProgram (BinaryData::originalFilenames[i], data, sz); extractProgram (BinaryData::originalFilenames[i], data, sz);
} }
mtsClient = MTS_RegisterClient();
enableLegacyMode(); enableLegacyMode();
setVoiceStealingEnabled (true); setVoiceStealingEnabled (true);
@ -577,6 +578,8 @@ WavetableAudioProcessor::WavetableAudioProcessor()
WavetableAudioProcessor::~WavetableAudioProcessor() WavetableAudioProcessor::~WavetableAudioProcessor()
{ {
MTS_DeregisterClient (mtsClient);
mtsClient = nullptr;
} }
void WavetableAudioProcessor::reloadWavetables() void WavetableAudioProcessor::reloadWavetables()
@ -844,6 +847,11 @@ void WavetableAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, ju
if (buffer.getNumChannels() != 2) if (buffer.getNumChannels() != 2)
return; return;
if (mtsClient)
for (auto itr : midi)
if (auto m = itr.getMessage(); m.isSysEx())
MTS_ParseMIDIDataU (mtsClient, itr.data, itr.numBytes);
if (blockMissed || presetLoaded || lastMono != globalParams.mono->isOn()) if (blockMissed || presetLoaded || lastMono != globalParams.mono->isOn())
{ {
blockMissed = presetLoaded = false; blockMissed = presetLoaded = false;

View file

@ -348,6 +348,8 @@ public:
juce::CriticalSection dspLock; juce::CriticalSection dspLock;
juce::Random rng; juce::Random rng;
MTSClient* mtsClient = nullptr;
private: private:
bool isParamLocked (gin::Parameter* p) override; bool isParamLocked (gin::Parameter* p) override;
float getSmoothingTime (gin::Parameter*); float getSmoothingTime (gin::Parameter*);

View file

@ -8,12 +8,10 @@ WavetableVoice::WavetableVoice (WavetableAudioProcessor& p)
, sub (proc.analogTables) , sub (proc.analogTables)
{ {
filter.setNumChannels (2); filter.setNumChannels (2);
mtsClient = MTS_RegisterClient();
} }
WavetableVoice::~WavetableVoice() WavetableVoice::~WavetableVoice()
{ {
MTS_DeregisterClient (mtsClient);
} }
void WavetableVoice::noteStarted() void WavetableVoice::noteStarted()
@ -247,9 +245,9 @@ void WavetableVoice::updateParams (int blockSize)
proc.modMatrix.setPolyValue (*this, proc.modSrcNote, note.initialNote / 127.0f); proc.modMatrix.setPolyValue (*this, proc.modSrcNote, note.initialNote / 127.0f);
double retune_semitones = 0.0; double retuneSemitones = 0.0;
if (mtsClient) if (proc.mtsClient)
retune_semitones = MTS_RetuningInSemitones (mtsClient, note.initialNote, -1); retuneSemitones = MTS_RetuningInSemitones (proc.mtsClient, note.initialNote, -1);
for (int i = 0; i < Cfg::numOSCs; i++) for (int i = 0; i < Cfg::numOSCs; i++)
{ {
@ -257,7 +255,7 @@ void WavetableVoice::updateParams (int blockSize)
currentMidiNotes[i] = noteSmoother.getCurrentValue() * 127.0f; currentMidiNotes[i] = noteSmoother.getCurrentValue() * 127.0f;
if (glideInfo.glissando) currentMidiNotes[i] = (float) juce::roundToInt (currentMidiNotes[i]); if (glideInfo.glissando) currentMidiNotes[i] = (float) juce::roundToInt (currentMidiNotes[i]);
currentMidiNotes[i] += float (retune_semitones); currentMidiNotes[i] += float (retuneSemitones);
currentMidiNotes[i] += float (note.totalPitchbendInSemitones); currentMidiNotes[i] += float (note.totalPitchbendInSemitones);
currentMidiNotes[i] += getValue (proc.oscParams[i].tune) + getValue (proc.oscParams[i].finetune) / 100.0f; currentMidiNotes[i] += getValue (proc.oscParams[i].tune) + getValue (proc.oscParams[i].finetune) / 100.0f;
@ -275,7 +273,7 @@ void WavetableVoice::updateParams (int blockSize)
{ {
subNote = noteSmoother.getCurrentValue() * 127.0f; subNote = noteSmoother.getCurrentValue() * 127.0f;
if (glideInfo.glissando) subNote = (float) juce::roundToInt (subNote); if (glideInfo.glissando) subNote = (float) juce::roundToInt (subNote);
subNote += retune_semitones; subNote += float (retuneSemitones);
subNote += float (note.totalPitchbendInSemitones); subNote += float (note.totalPitchbendInSemitones);
subNote += getValue (proc.subParams.tune); subNote += getValue (proc.subParams.tune);

View file

@ -61,7 +61,5 @@ public:
gin::EasedValueSmoother<float> noteSmoother; gin::EasedValueSmoother<float> noteSmoother;
float ampKeyTrack = 1.0f; float ampKeyTrack = 1.0f;
MTSClient* mtsClient = nullptr;
}; };