starting o microtonal support

This commit is contained in:
Roland Rabien 2024-10-11 17:55:15 -07:00
commit c90a502035
3 changed files with 18 additions and 1 deletions

View file

@ -132,7 +132,7 @@ 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}) target_sources (${PLUGIN_NAME} PRIVATE ${source_files} ${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

@ -8,6 +8,12 @@ WavetableVoice::WavetableVoice (WavetableAudioProcessor& p)
, sub (proc.analogTables) , sub (proc.analogTables)
{ {
filter.setNumChannels (2); filter.setNumChannels (2);
mtsClient = MTS_RegisterClient();
}
WavetableVoice::~WavetableVoice()
{
MTS_DeregisterClient (mtsClient);
} }
void WavetableVoice::noteStarted() void WavetableVoice::noteStarted()
@ -240,6 +246,10 @@ void WavetableVoice::updateParams (int blockSize)
auto note = getCurrentlyPlayingNote(); auto note = getCurrentlyPlayingNote();
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;
if (mtsClient)
retune_semitones = MTS_RetuningInSemitones (mtsClient, note.initialNote, -1);
for (int i = 0; i < Cfg::numOSCs; i++) for (int i = 0; i < Cfg::numOSCs; i++)
{ {
@ -247,6 +257,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 (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;
@ -264,6 +275,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 (note.totalPitchbendInSemitones); subNote += float (note.totalPitchbendInSemitones);
subNote += getValue (proc.subParams.tune); subNote += getValue (proc.subParams.tune);

View file

@ -2,6 +2,7 @@
#include <JuceHeader.h> #include <JuceHeader.h>
#include "Cfg.h" #include "Cfg.h"
#include "MTS-ESP/Client/libMTSClient.h"
class WavetableAudioProcessor; class WavetableAudioProcessor;
@ -12,6 +13,8 @@ class WavetableVoice : public gin::SynthesiserVoice,
public: public:
WavetableVoice (WavetableAudioProcessor& p); WavetableVoice (WavetableAudioProcessor& p);
~WavetableVoice() override;
void noteStarted() override; void noteStarted() override;
void noteRetriggered() override; void noteRetriggered() override;
void noteStopped (bool allowTailOff) override; void noteStopped (bool allowTailOff) override;
@ -59,4 +62,6 @@ public:
gin::EasedValueSmoother<float> noteSmoother; gin::EasedValueSmoother<float> noteSmoother;
float ampKeyTrack = 1.0f; float ampKeyTrack = 1.0f;
MTSClient* mtsClient = nullptr;
}; };