Enable filter cutoff, resonance, and real-time parameter control (#98)

Enable filter cutoff, resonance, and real-time parameter control

Co-authored-by: Rene Stange <rsta2@o2online.de>
pull/99/head^2
probonopd 3 years ago committed by GitHub
parent 5e211c8477
commit b1b318cdeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/Synth_Dexed.mk
  2. 36
      src/minidexed.cpp
  3. 6
      src/minidexed.h
  4. 18
      src/performance.ini
  5. 36
      src/performanceconfig.cpp
  6. 6
      src/performanceconfig.h
  7. 4
      src/uimenu.cpp

@ -35,6 +35,8 @@ INCLUDE += -I $(CMSIS_DSP_INCLUDE_DIR)
INCLUDE += -I $(CMSIS_DSP_PRIVATE_INCLUDE_DIR) INCLUDE += -I $(CMSIS_DSP_PRIVATE_INCLUDE_DIR)
INCLUDE += -I $(CMSIS_DSP_COMPUTELIB_INCLUDE_DIR) INCLUDE += -I $(CMSIS_DSP_COMPUTELIB_INCLUDE_DIR)
DEFINE += -DUSE_FX
ifeq ($(strip $(AARCH)),64) ifeq ($(strip $(AARCH)),64)
DEFINE += -DARM_MATH_NEON DEFINE += -DARM_MATH_NEON
DEFINE += -DHAVE_NEON DEFINE += -DHAVE_NEON

@ -59,6 +59,8 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
m_nVolume[i] = 100; m_nVolume[i] = 100;
m_nPan[i] = 64; m_nPan[i] = 64;
m_nMasterTune[i] = 0; m_nMasterTune[i] = 0;
m_nCutoff[i] = 99;
m_nResonance[i] = 0;
m_nMIDIChannel[i] = CMIDIDevice::Disabled; m_nMIDIChannel[i] = CMIDIDevice::Disabled;
m_nNoteLimitLow[i] = 0; m_nNoteLimitLow[i] = 0;
@ -181,6 +183,8 @@ bool CMiniDexed::Initialize (void)
SetVolume (m_PerformanceConfig.GetVolume (nTG), nTG); SetVolume (m_PerformanceConfig.GetVolume (nTG), nTG);
SetPan (m_PerformanceConfig.GetPan (nTG), nTG); SetPan (m_PerformanceConfig.GetPan (nTG), nTG);
SetMasterTune (m_PerformanceConfig.GetDetune (nTG), nTG); SetMasterTune (m_PerformanceConfig.GetDetune (nTG), nTG);
SetCutoff (m_PerformanceConfig.GetCutoff (nTG), nTG);
SetResonance (m_PerformanceConfig.GetResonance (nTG), nTG);
m_nNoteLimitLow[nTG] = m_PerformanceConfig.GetNoteLimitLow (nTG); m_nNoteLimitLow[nTG] = m_PerformanceConfig.GetNoteLimitLow (nTG);
m_nNoteLimitHigh[nTG] = m_PerformanceConfig.GetNoteLimitHigh (nTG); m_nNoteLimitHigh[nTG] = m_PerformanceConfig.GetNoteLimitHigh (nTG);
@ -402,6 +406,32 @@ void CMiniDexed::SetMasterTune (int nMasterTune, unsigned nTG)
m_UI.ParameterChanged (); m_UI.ParameterChanged ();
} }
void CMiniDexed::SetCutoff (int nCutoff, unsigned nTG)
{
nCutoff = constrain (nCutoff, 0, 99);
assert (nTG < CConfig::ToneGenerators);
m_nCutoff[nTG] = nCutoff;
assert (m_pTG[nTG]);
m_pTG[nTG]->setFilterCutoff (mapfloat (nCutoff, 0, 99, 0.0f, 1.0f));
m_UI.ParameterChanged ();
}
void CMiniDexed::SetResonance (int nResonance, unsigned nTG)
{
nResonance = constrain (nResonance, 0, 99);
assert (nTG < CConfig::ToneGenerators);
m_nResonance[nTG] = nResonance;
assert (m_pTG[nTG]);
m_pTG[nTG]->setFilterResonance (mapfloat (nResonance, 0, 99, 0.0f, 1.0f));
m_UI.ParameterChanged ();
}
void CMiniDexed::SetMIDIChannel (uint8_t uchChannel, unsigned nTG) void CMiniDexed::SetMIDIChannel (uint8_t uchChannel, unsigned nTG)
{ {
assert (nTG < CConfig::ToneGenerators); assert (nTG < CConfig::ToneGenerators);
@ -600,6 +630,8 @@ void CMiniDexed::SetTGParameter (TTGParameter Parameter, int nValue, unsigned nT
case TGParameterVolume: SetVolume (nValue, nTG); break; case TGParameterVolume: SetVolume (nValue, nTG); break;
case TGParameterPan: SetPan (nValue, nTG); break; case TGParameterPan: SetPan (nValue, nTG); break;
case TGParameterMasterTune: SetMasterTune (nValue, nTG); break; case TGParameterMasterTune: SetMasterTune (nValue, nTG); break;
case TGParameterCutoff: SetCutoff (nValue, nTG); break;
case TGParameterResonance: SetResonance (nValue, nTG); break;
case TGParameterMIDIChannel: case TGParameterMIDIChannel:
assert (0 <= nValue && nValue <= 255); assert (0 <= nValue && nValue <= 255);
@ -625,6 +657,8 @@ int CMiniDexed::GetTGParameter (TTGParameter Parameter, unsigned nTG)
case TGParameterVolume: return m_nVolume[nTG]; case TGParameterVolume: return m_nVolume[nTG];
case TGParameterPan: return m_nPan[nTG]; case TGParameterPan: return m_nPan[nTG];
case TGParameterMasterTune: return m_nMasterTune[nTG]; case TGParameterMasterTune: return m_nMasterTune[nTG];
case TGParameterCutoff: return m_nCutoff[nTG];
case TGParameterResonance: return m_nResonance[nTG];
case TGParameterMIDIChannel: return m_nMIDIChannel[nTG]; case TGParameterMIDIChannel: return m_nMIDIChannel[nTG];
case TGParameterReverbSend: return m_nReverbSend[nTG]; case TGParameterReverbSend: return m_nReverbSend[nTG];
@ -845,6 +879,8 @@ bool CMiniDexed::SavePerformance (void)
m_PerformanceConfig.SetVolume (m_nVolume[nTG], nTG); m_PerformanceConfig.SetVolume (m_nVolume[nTG], nTG);
m_PerformanceConfig.SetPan (m_nPan[nTG], nTG); m_PerformanceConfig.SetPan (m_nPan[nTG], nTG);
m_PerformanceConfig.SetDetune (m_nMasterTune[nTG], nTG); m_PerformanceConfig.SetDetune (m_nMasterTune[nTG], nTG);
m_PerformanceConfig.SetCutoff (m_nCutoff[nTG], nTG);
m_PerformanceConfig.SetResonance (m_nResonance[nTG], nTG);
m_PerformanceConfig.SetNoteLimitLow (m_nNoteLimitLow[nTG], nTG); m_PerformanceConfig.SetNoteLimitLow (m_nNoteLimitLow[nTG], nTG);
m_PerformanceConfig.SetNoteLimitHigh (m_nNoteLimitHigh[nTG], nTG); m_PerformanceConfig.SetNoteLimitHigh (m_nNoteLimitHigh[nTG], nTG);

@ -68,6 +68,8 @@ public:
void SetVolume (unsigned nVolume, unsigned nTG); void SetVolume (unsigned nVolume, unsigned nTG);
void SetPan (unsigned nPan, unsigned nTG); // 0 .. 127 void SetPan (unsigned nPan, unsigned nTG); // 0 .. 127
void SetMasterTune (int nMasterTune, unsigned nTG); // -99 .. 99 void SetMasterTune (int nMasterTune, unsigned nTG); // -99 .. 99
void SetCutoff (int nCutoff, unsigned nTG); // 0 .. 99
void SetResonance (int nResonance, unsigned nTG); // 0 .. 99
void SetMIDIChannel (uint8_t uchChannel, unsigned nTG); void SetMIDIChannel (uint8_t uchChannel, unsigned nTG);
void keyup (int16_t pitch, unsigned nTG); void keyup (int16_t pitch, unsigned nTG);
@ -103,6 +105,8 @@ public:
TGParameterVolume, TGParameterVolume,
TGParameterPan, TGParameterPan,
TGParameterMasterTune, TGParameterMasterTune,
TGParameterCutoff,
TGParameterResonance,
TGParameterMIDIChannel, TGParameterMIDIChannel,
TGParameterReverbSend, TGParameterReverbSend,
TGParameterUnknown TGParameterUnknown
@ -148,6 +152,8 @@ private:
unsigned m_nVolume[CConfig::ToneGenerators]; unsigned m_nVolume[CConfig::ToneGenerators];
unsigned m_nPan[CConfig::ToneGenerators]; unsigned m_nPan[CConfig::ToneGenerators];
int m_nMasterTune[CConfig::ToneGenerators]; int m_nMasterTune[CConfig::ToneGenerators];
int m_nCutoff[CConfig::ToneGenerators];
int m_nResonance[CConfig::ToneGenerators];
unsigned m_nMIDIChannel[CConfig::ToneGenerators]; unsigned m_nMIDIChannel[CConfig::ToneGenerators];
unsigned m_nNoteLimitLow[CConfig::ToneGenerators]; unsigned m_nNoteLimitLow[CConfig::ToneGenerators];

@ -9,6 +9,8 @@
#Volume#=100 # 0 .. 127 #Volume#=100 # 0 .. 127
#Pan#=64 # 0 .. 127 #Pan#=64 # 0 .. 127
#Detune#=0 # -99 .. 99 #Detune#=0 # -99 .. 99
#Cutoff#=99 # 0 .. 99
#Resonance#=0 # 0 .. 99
#NoteLimitLow#=0 # 0 .. 127, C-2 .. G8 #NoteLimitLow#=0 # 0 .. 127, C-2 .. G8
#NoteLimitHigh#=127 # 0 .. 127, C-2 .. G8 #NoteLimitHigh#=127 # 0 .. 127, C-2 .. G8
#NoteShift#=0 # -24 .. 24 #NoteShift#=0 # -24 .. 24
@ -21,6 +23,8 @@ MIDIChannel1=255
Volume1=100 Volume1=100
Pan1=0 Pan1=0
Detune1=-11 Detune1=-11
Cutoff1=99
Resonance1=0
NoteLimitLow1=0 NoteLimitLow1=0
NoteLimitHigh1=127 NoteLimitHigh1=127
NoteShift1=0 NoteShift1=0
@ -33,6 +37,8 @@ MIDIChannel2=255
Volume2=100 Volume2=100
Pan2=127 Pan2=127
Detune2=11 Detune2=11
Cutoff2=99
Resonance2=0
NoteLimitLow2=0 NoteLimitLow2=0
NoteLimitHigh2=127 NoteLimitHigh2=127
NoteShift2=0 NoteShift2=0
@ -45,6 +51,8 @@ MIDIChannel3=255
Volume3=100 Volume3=100
Pan3=48 Pan3=48
Detune3=-7 Detune3=-7
Cutoff3=99
Resonance3=0
NoteLimitLow3=0 NoteLimitLow3=0
NoteLimitHigh3=127 NoteLimitHigh3=127
NoteShift3=0 NoteShift3=0
@ -57,6 +65,8 @@ MIDIChannel4=255
Volume4=100 Volume4=100
Pan4=80 Pan4=80
Detune4=7 Detune4=7
Cutoff4=99
Resonance4=0
NoteLimitLow4=0 NoteLimitLow4=0
NoteLimitHigh4=127 NoteLimitHigh4=127
NoteShift4=0 NoteShift4=0
@ -69,6 +79,8 @@ MIDIChannel5=0
Volume5=100 Volume5=100
Pan5=64 Pan5=64
Detune5=0 Detune5=0
Cutoff5=99
Resonance5=0
NoteLimitLow5=0 NoteLimitLow5=0
NoteLimitHigh5=127 NoteLimitHigh5=127
NoteShift5=0 NoteShift5=0
@ -81,6 +93,8 @@ MIDIChannel6=0
Volume6=100 Volume6=100
Pan6=64 Pan6=64
Detune6=0 Detune6=0
Cutoff6=99
Resonance6=0
NoteLimitLow6=0 NoteLimitLow6=0
NoteLimitHigh6=127 NoteLimitHigh6=127
NoteShift6=0 NoteShift6=0
@ -93,6 +107,8 @@ MIDIChannel7=0
Volume7=100 Volume7=100
Pan7=64 Pan7=64
Detune7=0 Detune7=0
Cutoff7=99
Resonance7=0
NoteLimitLow7=0 NoteLimitLow7=0
NoteLimitHigh7=127 NoteLimitHigh7=127
NoteShift7=0 NoteShift7=0
@ -105,6 +121,8 @@ MIDIChannel8=0
Volume8=100 Volume8=100
Pan8=64 Pan8=64
Detune8=0 Detune8=0
Cutoff8=99
Resonance8=0
NoteLimitLow8=0 NoteLimitLow8=0
NoteLimitHigh8=127 NoteLimitHigh8=127
NoteShift8=0 NoteShift8=0

@ -81,6 +81,12 @@ bool CPerformanceConfig::Load (void)
PropertyName.Format ("Detune%u", nTG+1); PropertyName.Format ("Detune%u", nTG+1);
m_nDetune[nTG] = m_Properties.GetSignedNumber (PropertyName, 0); m_nDetune[nTG] = m_Properties.GetSignedNumber (PropertyName, 0);
PropertyName.Format ("Cutoff%u", nTG+1);
m_nCutoff[nTG] = m_Properties.GetNumber (PropertyName, 99);
PropertyName.Format ("Resonance%u", nTG+1);
m_nResonance[nTG] = m_Properties.GetNumber (PropertyName, 0);
PropertyName.Format ("NoteLimitLow%u", nTG+1); PropertyName.Format ("NoteLimitLow%u", nTG+1);
m_nNoteLimitLow[nTG] = m_Properties.GetNumber (PropertyName, 0); m_nNoteLimitLow[nTG] = m_Properties.GetNumber (PropertyName, 0);
@ -146,6 +152,12 @@ bool CPerformanceConfig::Save (void)
PropertyName.Format ("Detune%u", nTG+1); PropertyName.Format ("Detune%u", nTG+1);
m_Properties.SetSignedNumber (PropertyName, m_nDetune[nTG]); m_Properties.SetSignedNumber (PropertyName, m_nDetune[nTG]);
PropertyName.Format ("Cutoff%u", nTG+1);
m_Properties.SetNumber (PropertyName, m_nCutoff[nTG]);
PropertyName.Format ("Resonance%u", nTG+1);
m_Properties.SetNumber (PropertyName, m_nResonance[nTG]);
PropertyName.Format ("NoteLimitLow%u", nTG+1); PropertyName.Format ("NoteLimitLow%u", nTG+1);
m_Properties.SetNumber (PropertyName, m_nNoteLimitLow[nTG]); m_Properties.SetNumber (PropertyName, m_nNoteLimitLow[nTG]);
@ -208,6 +220,18 @@ int CPerformanceConfig::GetDetune (unsigned nTG) const
return m_nDetune[nTG]; return m_nDetune[nTG];
} }
unsigned CPerformanceConfig::GetCutoff (unsigned nTG) const
{
assert (nTG < CConfig::ToneGenerators);
return m_nCutoff[nTG];
}
unsigned CPerformanceConfig::GetResonance (unsigned nTG) const
{
assert (nTG < CConfig::ToneGenerators);
return m_nResonance[nTG];
}
unsigned CPerformanceConfig::GetNoteLimitLow (unsigned nTG) const unsigned CPerformanceConfig::GetNoteLimitLow (unsigned nTG) const
{ {
assert (nTG < CConfig::ToneGenerators); assert (nTG < CConfig::ToneGenerators);
@ -268,6 +292,18 @@ void CPerformanceConfig::SetDetune (int nValue, unsigned nTG)
m_nDetune[nTG] = nValue; m_nDetune[nTG] = nValue;
} }
void CPerformanceConfig::SetCutoff (unsigned nValue, unsigned nTG)
{
assert (nTG < CConfig::ToneGenerators);
m_nCutoff[nTG] = nValue;
}
void CPerformanceConfig::SetResonance (unsigned nValue, unsigned nTG)
{
assert (nTG < CConfig::ToneGenerators);
m_nResonance[nTG] = nValue;
}
void CPerformanceConfig::SetNoteLimitLow (unsigned nValue, unsigned nTG) void CPerformanceConfig::SetNoteLimitLow (unsigned nValue, unsigned nTG)
{ {
assert (nTG < CConfig::ToneGenerators); assert (nTG < CConfig::ToneGenerators);

@ -44,6 +44,8 @@ public:
unsigned GetVolume (unsigned nTG) const; // 0 .. 127 unsigned GetVolume (unsigned nTG) const; // 0 .. 127
unsigned GetPan (unsigned nTG) const; // 0 .. 127 unsigned GetPan (unsigned nTG) const; // 0 .. 127
int GetDetune (unsigned nTG) const; // -99 .. 99 int GetDetune (unsigned nTG) const; // -99 .. 99
unsigned GetCutoff (unsigned nTG) const; // 0 .. 99
unsigned GetResonance (unsigned nTG) const; // 0 .. 99
unsigned GetNoteLimitLow (unsigned nTG) const; // 0 .. 127 unsigned GetNoteLimitLow (unsigned nTG) const; // 0 .. 127
unsigned GetNoteLimitHigh (unsigned nTG) const; // 0 .. 127 unsigned GetNoteLimitHigh (unsigned nTG) const; // 0 .. 127
int GetNoteShift (unsigned nTG) const; // -24 .. 24 int GetNoteShift (unsigned nTG) const; // -24 .. 24
@ -55,6 +57,8 @@ public:
void SetVolume (unsigned nValue, unsigned nTG); void SetVolume (unsigned nValue, unsigned nTG);
void SetPan (unsigned nValue, unsigned nTG); void SetPan (unsigned nValue, unsigned nTG);
void SetDetune (int nValue, unsigned nTG); void SetDetune (int nValue, unsigned nTG);
void SetCutoff (unsigned nValue, unsigned nTG);
void SetResonance (unsigned nValue, unsigned nTG);
void SetNoteLimitLow (unsigned nValue, unsigned nTG); void SetNoteLimitLow (unsigned nValue, unsigned nTG);
void SetNoteLimitHigh (unsigned nValue, unsigned nTG); void SetNoteLimitHigh (unsigned nValue, unsigned nTG);
void SetNoteShift (int nValue, unsigned nTG); void SetNoteShift (int nValue, unsigned nTG);
@ -88,6 +92,8 @@ private:
unsigned m_nVolume[CConfig::ToneGenerators]; unsigned m_nVolume[CConfig::ToneGenerators];
unsigned m_nPan[CConfig::ToneGenerators]; unsigned m_nPan[CConfig::ToneGenerators];
int m_nDetune[CConfig::ToneGenerators]; int m_nDetune[CConfig::ToneGenerators];
unsigned m_nCutoff[CConfig::ToneGenerators];
unsigned m_nResonance[CConfig::ToneGenerators];
unsigned m_nNoteLimitLow[CConfig::ToneGenerators]; unsigned m_nNoteLimitLow[CConfig::ToneGenerators];
unsigned m_nNoteLimitHigh[CConfig::ToneGenerators]; unsigned m_nNoteLimitHigh[CConfig::ToneGenerators];
int m_nNoteShift[CConfig::ToneGenerators]; int m_nNoteShift[CConfig::ToneGenerators];

@ -65,6 +65,8 @@ const CUIMenu::TMenuItem CUIMenu::s_TGMenu[] =
#endif #endif
{"Reverb-Send", EditTGParameter, 0, CMiniDexed::TGParameterReverbSend}, {"Reverb-Send", EditTGParameter, 0, CMiniDexed::TGParameterReverbSend},
{"Detune", EditTGParameter, 0, CMiniDexed::TGParameterMasterTune}, {"Detune", EditTGParameter, 0, CMiniDexed::TGParameterMasterTune},
{"Cutoff", EditTGParameter, 0, CMiniDexed::TGParameterCutoff},
{"Resonance", EditTGParameter, 0, CMiniDexed::TGParameterResonance},
{"Channel", EditTGParameter, 0, CMiniDexed::TGParameterMIDIChannel}, {"Channel", EditTGParameter, 0, CMiniDexed::TGParameterMIDIChannel},
{"Edit Voice", MenuHandler, s_EditVoiceMenu}, {"Edit Voice", MenuHandler, s_EditVoiceMenu},
{0} {0}
@ -179,6 +181,8 @@ const CUIMenu::TParameter CUIMenu::s_TGParameter[CMiniDexed::TGParameterUnknown]
{0, 127, 8, ToVolume}, // TGParameterVolume {0, 127, 8, ToVolume}, // TGParameterVolume
{0, 127, 8, ToPan}, // TGParameterPan {0, 127, 8, ToPan}, // TGParameterPan
{-99, 99, 1}, // TGParameterMasterTune {-99, 99, 1}, // TGParameterMasterTune
{0, 99, 1}, // TGParameterCutoff
{0, 99, 1}, // TGParameterResonance
{0, CMIDIDevice::ChannelUnknown-1, 1, ToMIDIChannel}, // TGParameterMIDIChannel {0, CMIDIDevice::ChannelUnknown-1, 1, ToMIDIChannel}, // TGParameterMIDIChannel
{0, 99, 1} // TGParameterReverbSend {0, 99, 1} // TGParameterReverbSend
}; };

Loading…
Cancel
Save