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

@ -8,6 +8,12 @@ WavetableVoice::WavetableVoice (WavetableAudioProcessor& p)
, sub (proc.analogTables)
{
filter.setNumChannels (2);
mtsClient = MTS_RegisterClient();
}
WavetableVoice::~WavetableVoice()
{
MTS_DeregisterClient (mtsClient);
}
void WavetableVoice::noteStarted()
@ -240,6 +246,10 @@ void WavetableVoice::updateParams (int blockSize)
auto note = getCurrentlyPlayingNote();
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++)
{
@ -247,6 +257,7 @@ void WavetableVoice::updateParams (int blockSize)
currentMidiNotes[i] = noteSmoother.getCurrentValue() * 127.0f;
if (glideInfo.glissando) currentMidiNotes[i] = (float) juce::roundToInt (currentMidiNotes[i]);
currentMidiNotes[i] += float (retune_semitones);
currentMidiNotes[i] += float (note.totalPitchbendInSemitones);
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;
if (glideInfo.glissando) subNote = (float) juce::roundToInt (subNote);
subNote += retune_semitones;
subNote += float (note.totalPitchbendInSemitones);
subNote += getValue (proc.subParams.tune);

View file

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