|
|
|
@ -37,6 +37,9 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, |
|
|
|
|
CMultiCoreSupport (CMemorySystem::Get ()), |
|
|
|
|
#endif |
|
|
|
|
m_pConfig (pConfig), |
|
|
|
|
m_bSavePerformanceNewFile (false), |
|
|
|
|
m_bSetNewPerformance (false), |
|
|
|
|
m_bDeletePerformance (false), |
|
|
|
|
m_UI (this, pGPIOManager, pI2CMaster, pConfig), |
|
|
|
|
m_PerformanceConfig (pFileSystem), |
|
|
|
|
m_PCKeyboard (this, pConfig, &m_UI), |
|
|
|
@ -51,10 +54,8 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, |
|
|
|
|
1000000U * pConfig->GetChunkSize ()/2 / pConfig->GetSampleRate ()), |
|
|
|
|
m_bProfileEnabled (m_pConfig->GetProfileEnabled ()), |
|
|
|
|
m_bSavePerformance (false), |
|
|
|
|
m_bSavePerformanceNewFile (false), |
|
|
|
|
m_bSetNewPerformance (false), |
|
|
|
|
m_bDeletePerformance (false), |
|
|
|
|
m_bLoadPerformanceBusy(false) |
|
|
|
|
m_bLoadPerformanceBusy(false), |
|
|
|
|
m_bSaveAsDefault(false) |
|
|
|
|
{ |
|
|
|
|
assert (m_pConfig); |
|
|
|
|
|
|
|
|
@ -157,6 +158,12 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt, |
|
|
|
|
// END setup reverb
|
|
|
|
|
|
|
|
|
|
SetParameter (ParameterCompressorEnable, 1); |
|
|
|
|
|
|
|
|
|
// BEGIN Unison
|
|
|
|
|
SetParameter (ParameterUnisonEnable, 0); |
|
|
|
|
SetParameter (ParameterUnisonPanSpread, 60); |
|
|
|
|
SetParameter (ParameterUnisonDetuneSpread, 12); |
|
|
|
|
// END Unison
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
bool CMiniDexed::Initialize (void) |
|
|
|
@ -412,8 +419,9 @@ void CMiniDexed::SetPan (unsigned nPan, unsigned nTG) |
|
|
|
|
assert (nTG < CConfig::ToneGenerators); |
|
|
|
|
m_nPan[nTG] = nPan; |
|
|
|
|
|
|
|
|
|
tg_mixer->pan(nTG,mapfloat(nPan,0,127,0.0f,1.0f)); |
|
|
|
|
reverb_send_mixer->pan(nTG,mapfloat(nPan,0,127,0.0f,1.0f)); |
|
|
|
|
float normPan = mapfloat(nPan,0,127,0.0f,1.0f); |
|
|
|
|
tg_mixer->pan(nTG,normPan); |
|
|
|
|
reverb_send_mixer->pan(nTG,normPan); |
|
|
|
|
|
|
|
|
|
m_UI.ParameterChanged (); |
|
|
|
|
} |
|
|
|
@ -686,6 +694,57 @@ void CMiniDexed::SetParameter (TParameter Parameter, int nValue) |
|
|
|
|
m_ReverbSpinLock.Release (); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
#ifdef ARM_ALLOW_MULTI_CORE |
|
|
|
|
/* Unison START */ |
|
|
|
|
case ParameterUnisonEnable: |
|
|
|
|
assert (CConfig::ToneGenerators > 1); |
|
|
|
|
nValue=constrain((int)nValue,0,1); |
|
|
|
|
if (!!nValue) { |
|
|
|
|
for (unsigned nTG = 0; nTG < CConfig::ToneGenerators; nTG++) |
|
|
|
|
{ |
|
|
|
|
SetTGParameter(TGParameterMIDIChannel, GetTGParameter(TGParameterMIDIChannel, 0), nTG); |
|
|
|
|
SetTGParameter(TGParameterVoiceBank, GetTGParameter(TGParameterVoiceBank, 0), nTG); |
|
|
|
|
SetTGParameter(TGParameterProgram, GetTGParameter(TGParameterProgram, 0), nTG); |
|
|
|
|
SetTGParameter(TGParameterVolume, GetTGParameter(TGParameterVolume, 0), nTG); |
|
|
|
|
} |
|
|
|
|
// setting unison panning and detuning
|
|
|
|
|
SetParameter (ParameterUnisonPanSpread, m_nParameter[ParameterUnisonPanSpread]); |
|
|
|
|
SetParameter (ParameterUnisonDetuneSpread, m_nParameter[ParameterUnisonDetuneSpread]); |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case ParameterUnisonPanSpread: |
|
|
|
|
assert (CConfig::ToneGenerators > 1); |
|
|
|
|
nValue=constrain((int)nValue,0,63); |
|
|
|
|
if (!!GetParameter(ParameterUnisonEnable)) |
|
|
|
|
{ |
|
|
|
|
int step = 2 * nValue / (CConfig::ToneGenerators - 1); |
|
|
|
|
int pan = 64 - nValue; |
|
|
|
|
for (unsigned nTG = 0; nTG < CConfig::ToneGenerators; nTG++) |
|
|
|
|
{ |
|
|
|
|
SetTGParameter(TGParameterPan, constrain((int)pan,0,127), nTG); |
|
|
|
|
pan += step; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case ParameterUnisonDetuneSpread: |
|
|
|
|
assert (CConfig::ToneGenerators > 1); |
|
|
|
|
nValue=constrain((int)nValue,0,99); |
|
|
|
|
if (!!GetParameter(ParameterUnisonEnable)) |
|
|
|
|
{ |
|
|
|
|
int step = 2 * nValue / (CConfig::ToneGenerators - 1); |
|
|
|
|
int detune = -nValue; |
|
|
|
|
for (unsigned nTG = 0; nTG < CConfig::ToneGenerators; nTG++) |
|
|
|
|
{ |
|
|
|
|
SetTGParameter(TGParameterMasterTune, constrain((int)detune,-99,99), nTG); |
|
|
|
|
detune += step; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
/* Unison END */ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
assert (0); |
|
|
|
|
break; |
|
|
|
@ -699,9 +758,10 @@ int CMiniDexed::GetParameter (TParameter Parameter) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CMiniDexed::SetTGParameter (TTGParameter Parameter, int nValue, unsigned nTG) |
|
|
|
|
{ |
|
|
|
|
if (nTG < CConfig::ToneGenerators) |
|
|
|
|
{ |
|
|
|
|
assert (nTG < CConfig::ToneGenerators); |
|
|
|
|
|
|
|
|
|
switch (Parameter) |
|
|
|
|
{ |
|
|
|
|
case TGParameterVoiceBank: BankSelectLSB (nValue, nTG); break; |
|
|
|
@ -749,9 +809,25 @@ void CMiniDexed::SetTGParameter (TTGParameter Parameter, int nValue, unsigned nT |
|
|
|
|
assert (0); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef ARM_ALLOW_MULTI_CORE |
|
|
|
|
/* ALL TG START */ |
|
|
|
|
|
|
|
|
|
} else if (nTG == ALL_TG_ID) { |
|
|
|
|
for (unsigned i = 0; i < CConfig::ToneGenerators; i++) |
|
|
|
|
{ |
|
|
|
|
SetTGParameter(Parameter, nValue, i); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* ALL TG END */ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int CMiniDexed::GetTGParameter (TTGParameter Parameter, unsigned nTG) |
|
|
|
|
{ |
|
|
|
|
if (nTG < CConfig::ToneGenerators) |
|
|
|
|
{ |
|
|
|
|
assert (nTG < CConfig::ToneGenerators); |
|
|
|
|
|
|
|
|
@ -798,9 +874,24 @@ int CMiniDexed::GetTGParameter (TTGParameter Parameter, unsigned nTG) |
|
|
|
|
assert (0); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifdef ARM_ALLOW_MULTI_CORE |
|
|
|
|
/* ALL TG START */ |
|
|
|
|
|
|
|
|
|
} else if (nTG == ALL_TG_ID) { |
|
|
|
|
return GetTGParameter(Parameter, 0); |
|
|
|
|
|
|
|
|
|
/* ALL TG END */ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CMiniDexed::SetVoiceParameter (uint8_t uchOffset, uint8_t uchValue, unsigned nOP, unsigned nTG) |
|
|
|
|
{ |
|
|
|
|
if (nTG < CConfig::ToneGenerators) |
|
|
|
|
{ |
|
|
|
|
assert (nTG < CConfig::ToneGenerators); |
|
|
|
|
assert (m_pTG[nTG]); |
|
|
|
@ -831,9 +922,25 @@ void CMiniDexed::SetVoiceParameter (uint8_t uchOffset, uint8_t uchValue, unsigne |
|
|
|
|
assert (uchOffset < 156); |
|
|
|
|
|
|
|
|
|
m_pTG[nTG]->setVoiceDataElement (uchOffset, uchValue); |
|
|
|
|
|
|
|
|
|
#ifdef ARM_ALLOW_MULTI_CORE |
|
|
|
|
/* ALL TG START */ |
|
|
|
|
|
|
|
|
|
} else if (nTG == ALL_TG_ID) { |
|
|
|
|
for (unsigned i = 0; i < CConfig::ToneGenerators; i++) |
|
|
|
|
{ |
|
|
|
|
SetVoiceParameter(uchOffset, uchValue, nOP, i); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* ALL TG END */ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
uint8_t CMiniDexed::GetVoiceParameter (uint8_t uchOffset, unsigned nOP, unsigned nTG) |
|
|
|
|
{ |
|
|
|
|
if (nTG < CConfig::ToneGenerators) |
|
|
|
|
{ |
|
|
|
|
assert (nTG < CConfig::ToneGenerators); |
|
|
|
|
assert (m_pTG[nTG]); |
|
|
|
@ -853,9 +960,23 @@ uint8_t CMiniDexed::GetVoiceParameter (uint8_t uchOffset, unsigned nOP, unsigned |
|
|
|
|
assert (uchOffset < 156); |
|
|
|
|
|
|
|
|
|
return m_pTG[nTG]->getVoiceDataElement (uchOffset); |
|
|
|
|
|
|
|
|
|
#ifdef ARM_ALLOW_MULTI_CORE |
|
|
|
|
/* ALL TG START */ |
|
|
|
|
|
|
|
|
|
} else if (nTG == ALL_TG_ID) { |
|
|
|
|
return GetVoiceParameter (uchOffset, nOP, 0); |
|
|
|
|
|
|
|
|
|
/* ALL TG END */ |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string CMiniDexed::GetVoiceName (unsigned nTG) |
|
|
|
|
{ |
|
|
|
|
if (nTG < CConfig::ToneGenerators) |
|
|
|
|
{ |
|
|
|
|
char VoiceName[11]; |
|
|
|
|
memset (VoiceName, 0, sizeof VoiceName); |
|
|
|
@ -867,6 +988,18 @@ std::string CMiniDexed::GetVoiceName (unsigned nTG) |
|
|
|
|
std::string Result (VoiceName); |
|
|
|
|
|
|
|
|
|
return Result; |
|
|
|
|
|
|
|
|
|
#ifdef ARM_ALLOW_MULTI_CORE |
|
|
|
|
/* ALL TG START */ |
|
|
|
|
|
|
|
|
|
} else if (nTG == ALL_TG_ID) { |
|
|
|
|
return GetVoiceName (0); |
|
|
|
|
|
|
|
|
|
/* ALL TG END */ |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return std::string("ERROR"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#ifndef ARM_ALLOW_MULTI_CORE |
|
|
|
@ -1036,10 +1169,10 @@ void CMiniDexed::ProcessSound (void) |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
bool CMiniDexed::SavePerformance (bool bSaveAsDeault) |
|
|
|
|
bool CMiniDexed::SavePerformance (bool bSaveAsDefault) |
|
|
|
|
{ |
|
|
|
|
m_bSavePerformance = true; |
|
|
|
|
m_bSaveAsDeault=bSaveAsDeault; |
|
|
|
|
m_bSaveAsDefault=bSaveAsDefault; |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -1090,7 +1223,15 @@ bool CMiniDexed::DoSavePerformance (void) |
|
|
|
|
m_PerformanceConfig.SetReverbDiffusion (m_nParameter[ParameterReverbDiffusion]); |
|
|
|
|
m_PerformanceConfig.SetReverbLevel (m_nParameter[ParameterReverbLevel]); |
|
|
|
|
|
|
|
|
|
if(m_bSaveAsDeault) |
|
|
|
|
#ifdef ARM_ALLOW_MULTI_CORE |
|
|
|
|
/* UNISON START */ |
|
|
|
|
m_PerformanceConfig.SetUnisonEnable (!!m_nParameter[ParameterUnisonEnable]); |
|
|
|
|
m_PerformanceConfig.SetUnisonPanSpread (m_nParameter[ParameterUnisonPanSpread]); |
|
|
|
|
m_PerformanceConfig.SetUnisonDetuneSpread (m_nParameter[ParameterUnisonDetuneSpread]); |
|
|
|
|
/* UNISON END */ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if(m_bSaveAsDefault) |
|
|
|
|
{ |
|
|
|
|
m_PerformanceConfig.SetNewPerformance(0); |
|
|
|
|
|
|
|
|
@ -1478,6 +1619,15 @@ void CMiniDexed::LoadPerformanceParameters(void) |
|
|
|
|
SetParameter (ParameterReverbLowPass, m_PerformanceConfig.GetReverbLowPass ()); |
|
|
|
|
SetParameter (ParameterReverbDiffusion, m_PerformanceConfig.GetReverbDiffusion ()); |
|
|
|
|
SetParameter (ParameterReverbLevel, m_PerformanceConfig.GetReverbLevel ()); |
|
|
|
|
|
|
|
|
|
#ifdef ARM_ALLOW_MULTI_CORE |
|
|
|
|
/* UNISON START */ |
|
|
|
|
SetParameter (ParameterUnisonPanSpread, m_PerformanceConfig.GetUnisonPanSpread ()); |
|
|
|
|
SetParameter (ParameterUnisonDetuneSpread, m_PerformanceConfig.GetUnisonDetuneSpread ()); |
|
|
|
|
SetParameter (ParameterUnisonEnable, m_PerformanceConfig.GetUnisonEnable () ? 1 : 0); |
|
|
|
|
/* UNISON END */ |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::string CMiniDexed::GetNewPerformanceDefaultName(void)
|
|
|
|
|