Changed config setting to match description in original manuals: Performance Select Channel. Also now accepts 1-16 or Omni as values.

pull/500/head
Kevin 2 years ago
parent 46867f9650
commit 51ddff2dcb
  1. 6
      src/config.cpp
  2. 4
      src/config.h
  3. 25
      src/mididevice.cpp
  4. 90
      src/minidexed.cpp
  5. 10
      src/minidexed.h
  6. 20
      src/minidexed.ini
  7. 40
      src/uimenu.cpp
  8. 1
      src/uimenu.h

@ -149,7 +149,7 @@ void CConfig::Load (void)
m_bMIDIDumpEnabled = m_Properties.GetNumber ("MIDIDumpEnabled", 0) != 0; m_bMIDIDumpEnabled = m_Properties.GetNumber ("MIDIDumpEnabled", 0) != 0;
m_bProfileEnabled = m_Properties.GetNumber ("ProfileEnabled", 0) != 0; m_bProfileEnabled = m_Properties.GetNumber ("ProfileEnabled", 0) != 0;
m_bPerformanceSelectToLoad = m_Properties.GetNumber ("PerformanceSelectToLoad", 1) != 0; m_bPerformanceSelectToLoad = m_Properties.GetNumber ("PerformanceSelectToLoad", 1) != 0;
m_bPerformanceProgramChange = m_Properties.GetNumber ("PerformanceProgramChange", 0) != 0; m_bPerformanceSelectChannel = m_Properties.GetNumber ("PerformanceSelectChannel", 0);
} }
const char *CConfig::GetSoundDevice (void) const const char *CConfig::GetSoundDevice (void) const
@ -492,7 +492,7 @@ bool CConfig::GetPerformanceSelectToLoad (void) const
return m_bPerformanceSelectToLoad; return m_bPerformanceSelectToLoad;
} }
bool CConfig::GetPerformanceProgramChange (void) const unsigned CConfig::GetPerformanceSelectChannel (void) const
{ {
return m_bPerformanceProgramChange; return m_bPerformanceSelectChannel;
} }

@ -163,7 +163,7 @@ public:
// Load performance mode. 0 for load just rotating encoder, 1 load just when Select is pushed // Load performance mode. 0 for load just rotating encoder, 1 load just when Select is pushed
bool GetPerformanceSelectToLoad (void) const; bool GetPerformanceSelectToLoad (void) const;
bool GetPerformanceProgramChange (void) const; unsigned GetPerformanceSelectChannel (void) const;
private: private:
CPropertiesFatFsFile m_Properties; CPropertiesFatFsFile m_Properties;
@ -246,7 +246,7 @@ private:
bool m_bMIDIDumpEnabled; bool m_bMIDIDumpEnabled;
bool m_bProfileEnabled; bool m_bProfileEnabled;
bool m_bPerformanceSelectToLoad; bool m_bPerformanceSelectToLoad;
bool m_bPerformanceProgramChange; unsigned m_bPerformanceSelectChannel;
}; };
#endif #endif

@ -191,10 +191,25 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
case MIDI_NOTE_ON: case MIDI_NOTE_ON:
if (nLength < 3) if (nLength < 3)
{ {
break; break;
} }
m_pUI->UIMIDICmdHandler (ucChannel, ucStatus & 0xF0, pMessage[1], pMessage[2]); m_pUI->UIMIDICmdHandler (ucChannel, ucStatus & 0xF0, pMessage[1], pMessage[2]);
break; break;
case MIDI_PROGRAM_CHANGE:
// Check for performance PC messages
if( m_pConfig->GetMIDIRXProgramChange() )
{
unsigned nPerfCh = m_pSynthesizer->GetPerformanceSelectChannel();
if( nPerfCh != Disabled)
{
if ((ucChannel == nPerfCh) || (nPerfCh == OmniMode))
{
//printf("Performance Select Channel %d\n", nPerfCh);
m_pSynthesizer->ProgramChangePerformance (pMessage[1]);
}
}
}
break;
} }
// Process MIDI for each Tone Generator // Process MIDI for each Tone Generator
@ -336,9 +351,11 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
break; break;
case MIDI_PROGRAM_CHANGE: case MIDI_PROGRAM_CHANGE:
// do program change only if enabled in config // do program change only if enabled in config and not in "Performance Select Channel" mode
if( m_pConfig->GetMIDIRXProgramChange() ) if( m_pConfig->GetMIDIRXProgramChange() && ( m_pSynthesizer->GetPerformanceSelectChannel() == Disabled) ) {
m_pSynthesizer->ProgramChangePerformance (pMessage[1], nTG); //printf("Program Change to %d (%d)\n", ucChannel, m_pSynthesizer->GetPerformanceSelectChannel());
m_pSynthesizer->ProgramChange (pMessage[1], nTG);
}
break; break;
case MIDI_PITCH_BEND: { case MIDI_PITCH_BEND: {

@ -57,8 +57,8 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
m_bLoadPerformanceBusy(false) m_bLoadPerformanceBusy(false)
{ {
assert (m_pConfig); assert (m_pConfig);
m_bPerformanceProgramChange = m_pConfig->GetPerformanceProgramChange(); SetPerformanceSelectChannel(m_pConfig->GetPerformanceSelectChannel());
for (unsigned i = 0; i < CConfig::ToneGenerators; i++) for (unsigned i = 0; i < CConfig::ToneGenerators; i++)
{ {
@ -181,6 +181,20 @@ bool CMiniDexed::Initialize (void)
m_bUseSerial = true; m_bUseSerial = true;
} }
if (m_pConfig->GetMIDIRXProgramChange())
{
int nPerfCh = GetParameter(ParameterPerformanceSelectChannel);
if (nPerfCh == CMIDIDevice::Disabled) {
LOGNOTE("Program Change: Enabled for Voices");
} else if (nPerfCh == CMIDIDevice::OmniMode) {
LOGNOTE("Program Change: Enabled for Performances (Omni)");
} else {
LOGNOTE("Program Change: Enabled for Performances (CH %d)", nPerfCh+1);
}
} else {
LOGNOTE("Program Change: Disabled");
}
for (unsigned i = 0; i < CConfig::ToneGenerators; i++) for (unsigned i = 0; i < CConfig::ToneGenerators; i++)
{ {
@ -461,38 +475,20 @@ void CMiniDexed::ProgramChange (unsigned nProgram, unsigned nTG)
m_UI.ParameterChanged (); m_UI.ParameterChanged ();
} }
void CMiniDexed::ProgramChangePerformance (unsigned nProgram, unsigned nTG) void CMiniDexed::ProgramChangePerformance (unsigned nProgram)
{ {
assert (m_pConfig); if (m_nParameter[ParameterPerformanceSelectChannel] != CMIDIDevice::Disabled)
if (m_bPerformanceProgramChange)
{ {
// Program Change messages change Performances. // Program Change messages change Performances.
// unsigned nLastPerformance = m_PerformanceConfig.GetLastPerformance();
// Only pay attention to PCs received on the MIDI channel
// associated with TG1.
//
// Note: as performances store the MIDI channnel, if
// the MIDI channel for TG1 changes, then further
// PCs will only be actioned on the new channel number...
if (nTG == 0)
{
unsigned nLastPerformance = m_PerformanceConfig.GetLastPerformance();
// GetLastPerformance actually returns 1-indexed, number of performances // GetLastPerformance actually returns 1-indexed, number of performances
if (nProgram < nLastPerformance - 1) if (nProgram < nLastPerformance - 1)
{ {
SetNewPerformance(nProgram); SetNewPerformance(nProgram);
}
} }
m_UI.ParameterChanged ();
} }
else
{
// Program Change messages change voice on specified TG
ProgramChange(nProgram, nTG);
}
m_UI.ParameterChanged ();
} }
void CMiniDexed::SetVolume (unsigned nVolume, unsigned nTG) void CMiniDexed::SetVolume (unsigned nVolume, unsigned nTG)
@ -791,6 +787,10 @@ void CMiniDexed::SetParameter (TParameter Parameter, int nValue)
m_ReverbSpinLock.Release (); m_ReverbSpinLock.Release ();
break; break;
case ParameterPerformanceSelectChannel:
// Nothing more to do
break;
default: default:
assert (0); assert (0);
break; break;
@ -1146,6 +1146,30 @@ void CMiniDexed::ProcessSound (void)
#endif #endif
unsigned CMiniDexed::GetPerformanceSelectChannel (void)
{
// Stores and returns Select Channel using MIDI Device Channel definitions
return (unsigned) GetParameter (ParameterPerformanceSelectChannel);
}
void CMiniDexed::SetPerformanceSelectChannel (unsigned uCh)
{
// Turns a configuration setting to MIDI Device Channel definitions
// Mirrors the logic in Performance Config for handling MIDI channel configuration
if (uCh == 0)
{
SetParameter (ParameterPerformanceSelectChannel, CMIDIDevice::Disabled);
}
else if (uCh < CMIDIDevice::Channels)
{
SetParameter (ParameterPerformanceSelectChannel, uCh - 1);
}
else
{
SetParameter (ParameterPerformanceSelectChannel, CMIDIDevice::OmniMode);
}
}
bool CMiniDexed::SavePerformance (bool bSaveAsDeault) bool CMiniDexed::SavePerformance (bool bSaveAsDeault)
{ {
m_bSavePerformance = true; m_bSavePerformance = true;
@ -1468,16 +1492,6 @@ unsigned CMiniDexed::GetLastPerformance()
return m_PerformanceConfig.GetLastPerformance(); return m_PerformanceConfig.GetLastPerformance();
} }
bool CMiniDexed::GetPerformanceProgramChange (void)
{
return m_bPerformanceProgramChange;
}
void CMiniDexed::SetPerformanceProgramChange (bool bPerfPC)
{
m_bPerformanceProgramChange = bPerfPC;
}
unsigned CMiniDexed::GetActualPerformanceID() unsigned CMiniDexed::GetActualPerformanceID()
{ {
return m_PerformanceConfig.GetActualPerformanceID(); return m_PerformanceConfig.GetActualPerformanceID();

@ -67,7 +67,7 @@ public:
void BankSelectMSB (unsigned nBankMSB, unsigned nTG); void BankSelectMSB (unsigned nBankMSB, unsigned nTG);
void BankSelectLSB (unsigned nBankLSB, unsigned nTG); void BankSelectLSB (unsigned nBankLSB, unsigned nTG);
void ProgramChange (unsigned nProgram, unsigned nTG); void ProgramChange (unsigned nProgram, unsigned nTG);
void ProgramChangePerformance (unsigned nProgram, unsigned nTG); void ProgramChangePerformance (unsigned nProgram);
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
@ -126,9 +126,9 @@ public:
bool DoSetNewPerformance (void); bool DoSetNewPerformance (void);
bool GetPerformanceSelectToLoad(void); bool GetPerformanceSelectToLoad(void);
bool SavePerformance (bool bSaveAsDeault); bool SavePerformance (bool bSaveAsDeault);
bool GetPerformanceProgramChange (void); unsigned GetPerformanceSelectChannel (void);
void SetPerformanceProgramChange (bool bPerfPC); void SetPerformanceSelectChannel (unsigned uCh);
// Must match the order in CUIMenu::TParameter // Must match the order in CUIMenu::TParameter
enum TParameter enum TParameter
{ {
@ -140,6 +140,7 @@ public:
ParameterReverbLowPass, ParameterReverbLowPass,
ParameterReverbDiffusion, ParameterReverbDiffusion,
ParameterReverbLevel, ParameterReverbLevel,
ParameterPerformanceSelectChannel,
ParameterUnknown ParameterUnknown
}; };
@ -308,7 +309,6 @@ private:
unsigned m_nDeletePerformanceID; unsigned m_nDeletePerformanceID;
bool m_bLoadPerformanceBusy; bool m_bLoadPerformanceBusy;
bool m_bSaveAsDeault; bool m_bSaveAsDeault;
bool m_bPerformanceProgramChange;
}; };
#endif #endif

@ -16,24 +16,24 @@ EngineType=1
# MIDI # MIDI
MIDIBaudRate=31250 MIDIBaudRate=31250
#MIDIThru=umidi1,ttyS1 #MIDIThru=umidi1,ttyS1
MIDIRXProgramChange=1
IgnoreAllNotesOff=0 IgnoreAllNotesOff=0
MIDIAutoVoiceDumpOnPC=1 MIDIAutoVoiceDumpOnPC=1
HeaderlessSysExVoices=0 HeaderlessSysExVoices=0
# Program Change enable
# 0 = Ignore all Program Change messages.
# 1 = Respond to Program Change messages.
MIDIRXProgramChange=1
# Program Change mode # Program Change mode
# 0 = Only recognise Program Change 0-31. # 0 = Only recognise Program Change 0-31.
# 1 = Support 0-127 across four consecutive banks. # 1 = Support 0-127 across four consecutive banks.
# NB: Ignored if PerformanceProgramChange=1 # NB: Only relevant if PerformanceSelectChannel=0
ExpandPCAcrossBanks=1 ExpandPCAcrossBanks=1
# Program Change action: # Program Change action:
# 0 = Select voices # 0 = Program Change messages select voices on the channel associated with each TG.
# 1 = Select performances # 1-16 = Program Change messages on this channel select performances.
# # >16 = Program Change messages on ANY channel select performances.
# NB: If Perfromances, then only reacts to Program Change # NB: In performance mode, all Program Change messages on other channels are ignored.
# messages received on the MIDI channel for TG1. PerformanceSelectChannel=0
# Warning: Make sure all perfromances use the same MIDI
# channel for TG1 and that MIDI is enabled.
PerformanceProgramChange=0
# HD44780 LCD # HD44780 LCD
LCDEnabled=1 LCDEnabled=1

@ -213,7 +213,8 @@ const CUIMenu::TParameter CUIMenu::s_GlobalParameter[CMiniDexed::ParameterUnknow
{0, 99, 1}, // ParameterReverbLowDamp {0, 99, 1}, // ParameterReverbLowDamp
{0, 99, 1}, // ParameterReverbLowPass {0, 99, 1}, // ParameterReverbLowPass
{0, 99, 1}, // ParameterReverbDiffusion {0, 99, 1}, // ParameterReverbDiffusion
{0, 99, 1} // ParameterReverbLevel {0, 99, 1}, // ParameterReverbLevel
{0, CMIDIDevice::ChannelUnknown-1, 1, ToMIDIChannel} // ParameterPerformanceSelectChannel
}; };
// must match CMiniDexed::TTGParameter // must match CMiniDexed::TTGParameter
@ -325,7 +326,7 @@ const CUIMenu::TMenuItem CUIMenu::s_PerformanceMenu[] =
{"Load", PerformanceMenu, 0, 0}, {"Load", PerformanceMenu, 0, 0},
{"Save", MenuHandler, s_SaveMenu}, {"Save", MenuHandler, s_SaveMenu},
{"Delete", PerformanceMenu, 0, 1}, {"Delete", PerformanceMenu, 0, 1},
{"Program Change", EditPerformanceProgramChange, 0, 0}, {"MIDI PC", EditGlobalParameter, 0, CMiniDexed::ParameterPerformanceSelectChannel},
{0} {0}
}; };
@ -1204,7 +1205,7 @@ void CUIMenu::OPShortcutHandler (TMenuEvent Event)
void CUIMenu::PgmUpDownHandler (TMenuEvent Event) void CUIMenu::PgmUpDownHandler (TMenuEvent Event)
{ {
if (m_pMiniDexed->GetPerformanceProgramChange()) if (m_pMiniDexed->GetParameter (CMiniDexed::ParameterPerformanceSelectChannel) > 0)
{ {
// Program Up/Down acts on performances // Program Up/Down acts on performances
unsigned nLastPerformance = m_pMiniDexed->GetLastPerformance(); unsigned nLastPerformance = m_pMiniDexed->GetLastPerformance();
@ -1490,39 +1491,6 @@ void CUIMenu::PerformanceMenu (CUIMenu *pUIMenu, TMenuEvent Event)
} }
} }
void CUIMenu::EditPerformanceProgramChange (CUIMenu *pUIMenu, TMenuEvent Event)
{
bool bPerfPC = pUIMenu->m_pMiniDexed->GetPerformanceProgramChange();
switch (Event)
{
case MenuEventUpdate:
break;
case MenuEventStepDown:
case MenuEventStepUp:
bPerfPC = !bPerfPC;
pUIMenu->m_pMiniDexed->SetPerformanceProgramChange(bPerfPC);
break;
default:
return;
}
string PPC (" =");
string Value;
if (bPerfPC) {
Value = "Performance";
} else {
Value = "Voices";
}
pUIMenu->m_pUI->DisplayWrite (PPC.c_str (),
pUIMenu->m_pParentMenu[pUIMenu->m_nCurrentMenuItem].Name,
Value.c_str (),
true, true);
}
void CUIMenu::InputTxt (CUIMenu *pUIMenu, TMenuEvent Event) void CUIMenu::InputTxt (CUIMenu *pUIMenu, TMenuEvent Event)
{ {
unsigned nTG=0; unsigned nTG=0;

@ -91,7 +91,6 @@ private:
static void EditTGParameterModulation (CUIMenu *pUIMenu, TMenuEvent Event); static void EditTGParameterModulation (CUIMenu *pUIMenu, TMenuEvent Event);
static void PerformanceMenu (CUIMenu *pUIMenu, TMenuEvent Event); static void PerformanceMenu (CUIMenu *pUIMenu, TMenuEvent Event);
static void SavePerformanceNewFile (CUIMenu *pUIMenu, TMenuEvent Event); static void SavePerformanceNewFile (CUIMenu *pUIMenu, TMenuEvent Event);
static void EditPerformanceProgramChange (CUIMenu *pUIMenu, TMenuEvent Event);
static std::string GetGlobalValueString (unsigned nParameter, int nValue); static std::string GetGlobalValueString (unsigned nParameter, int nValue);
static std::string GetTGValueString (unsigned nTGParameter, int nValue); static std::string GetTGValueString (unsigned nTGParameter, int nValue);

Loading…
Cancel
Save