From ac43ec5f739f5d33aaade540dcdec890bed75b98 Mon Sep 17 00:00:00 2001 From: Vincent GAUCHE Date: Fri, 19 May 2023 01:57:16 +0200 Subject: [PATCH] Merge with main + fixing compiling error for RPI2 --- performance/000064_RockOrgan.ini | 20 +- performance/000126_INIT.ini | 114 +++--- src/config.cpp | 6 + src/config.h | 2 + src/mididevice.cpp | 574 ++++++++++++++++--------------- src/minidexed.cpp | 74 +++- src/performanceconfig.cpp | 59 +++- src/performanceconfig.h | 4 +- src/uimenu.cpp | 55 ++- 9 files changed, 520 insertions(+), 388 deletions(-) diff --git a/performance/000064_RockOrgan.ini b/performance/000064_RockOrgan.ini index a2476d2..f993e9d 100644 --- a/performance/000064_RockOrgan.ini +++ b/performance/000064_RockOrgan.ini @@ -42,7 +42,7 @@ PitchBendStep2=0 PortamentoMode2=0 PortamentoGlissando2=0 PortamentoTime2=0 -VoiceData2=63 63 63 1B 63 63 63 00 27 05 00 00 00 00 00 00 56 00 02 00 01 41 63 63 24 63 63 63 00 27 00 00 00 00 03 00 02 56 01 00 00 07 63 63 63 00 63 63 63 00 27 00 00 00 00 00 00 00 54 00 00 00 0A 41 63 63 28 63 63 63 00 27 00 00 00 00 02 00 02 63 00 00 00 0C 63 63 63 00 63 63 63 00 27 00 00 00 00 00 00 00 54 00 01 00 02 41 63 63 28 63 63 63 00 27 00 00 00 00 02 00 02 63 00 01 00 03 63 63 63 63 32 32 32 32 05 05 01 29 00 03 00 01 00 04 18 52 6F 63 6B 6F 72 67 61 6E 20 D5 +VoiceData2=63 63 63 1B 63 63 63 00 27 05 00 00 00 00 00 00 56 00 02 00 01 41 63 63 24 63 63 63 00 27 00 00 00 00 03 00 02 56 01 00 00 07 63 63 63 00 63 63 63 00 27 00 00 00 00 00 00 00 54 00 00 00 0A 41 63 63 28 63 63 63 00 27 00 00 00 00 02 00 02 63 00 00 00 0C 63 63 63 00 63 63 63 00 27 00 00 00 00 00 00 00 54 00 01 00 02 41 63 63 28 63 63 63 00 27 00 00 00 00 02 00 02 63 00 01 00 03 63 63 63 63 32 32 32 32 05 05 01 29 00 03 00 01 00 04 18 52 6F 63 6B 6F 72 67 61 6E 20 55 MonoMode2=0 ModulationWheelRange2=99 ModulationWheelTarget2=1 @@ -69,7 +69,7 @@ PitchBendStep3=0 PortamentoMode3=0 PortamentoGlissando3=0 PortamentoTime3=0 -VoiceData3=63 63 63 1B 63 63 63 00 27 05 00 00 00 00 00 00 56 00 02 00 01 41 63 63 24 63 63 63 00 27 00 00 00 00 03 00 02 56 01 00 00 07 63 63 63 00 63 63 63 00 27 00 00 00 00 00 00 00 54 00 00 00 0A 41 63 63 28 63 63 63 00 27 00 00 00 00 02 00 02 63 00 00 00 0C 63 63 63 00 63 63 63 00 27 00 00 00 00 00 00 00 54 00 01 00 02 41 63 63 28 63 63 63 00 27 00 00 00 00 02 00 02 63 00 01 00 03 63 63 63 63 32 32 32 32 05 05 01 29 00 03 00 01 00 04 18 52 6F 63 6B 6F 72 67 61 6E 20 7D +VoiceData3=63 63 63 1B 63 63 63 00 27 05 00 00 00 00 00 00 56 00 02 00 01 41 63 63 24 63 63 63 00 27 00 00 00 00 03 00 02 56 01 00 00 07 63 63 63 00 63 63 63 00 27 00 00 00 00 00 00 00 54 00 00 00 0A 41 63 63 28 63 63 63 00 27 00 00 00 00 02 00 02 63 00 00 00 0C 63 63 63 00 63 63 63 00 27 00 00 00 00 00 00 00 54 00 01 00 02 41 63 63 28 63 63 63 00 27 00 00 00 00 02 00 02 63 00 01 00 03 63 63 63 63 32 32 32 32 05 05 01 29 00 03 00 01 00 04 18 52 6F 63 6B 6F 72 67 61 6E 20 5D MonoMode3=0 ModulationWheelRange3=99 ModulationWheelTarget3=1 @@ -150,7 +150,7 @@ PitchBendStep6=0 PortamentoMode6=0 PortamentoGlissando6=0 PortamentoTime6=0 -VoiceData6=54 24 0A 10 63 63 5F 00 34 00 00 03 00 00 03 00 38 00 03 00 00 54 24 0A 0C 63 63 5F 00 34 12 00 03 00 00 00 01 49 00 01 00 01 54 24 0A 00 63 63 63 00 26 06 00 00 00 00 00 01 50 01 00 27 04 26 07 07 29 5D 5C 5C 00 24 1F 00 00 00 00 00 01 63 00 01 00 0D 2C 24 0A 16 63 63 63 00 22 00 00 00 00 00 00 01 4C 00 01 00 07 2D 23 0A 30 63 63 63 00 24 1F 00 00 00 00 03 01 61 01 00 1A 07 54 5F 5F 3C 32 32 32 32 0E 07 00 1E 0F 12 00 00 04 01 18 57 61 72 6D 20 53 74 67 20 41 74 +VoiceData6=54 24 0A 10 63 63 5F 00 34 00 00 03 00 00 03 00 38 00 03 00 00 54 24 0A 0C 63 63 5F 00 34 12 00 03 00 00 00 01 49 00 01 00 01 54 24 0A 00 63 63 63 00 26 06 00 00 00 00 00 01 50 01 00 27 04 26 07 07 29 5D 5C 5C 00 24 1F 00 00 00 00 00 01 63 00 01 00 0D 2C 24 0A 16 63 63 63 00 22 00 00 00 00 00 00 01 4C 00 01 00 07 2D 23 0A 30 63 63 63 00 24 1F 00 00 00 00 03 01 61 01 00 1A 07 54 5F 5F 3C 32 32 32 32 0E 07 00 1E 0F 12 00 00 04 01 18 57 61 72 6D 20 53 74 67 20 41 55 MonoMode6=0 ModulationWheelRange6=99 ModulationWheelTarget6=1 @@ -177,7 +177,7 @@ PitchBendStep7=0 PortamentoMode7=0 PortamentoGlissando7=0 PortamentoTime7=0 -VoiceData7=54 24 0A 10 63 63 5F 00 34 00 00 03 00 00 03 00 38 00 03 00 00 54 24 0A 0C 63 63 5F 00 34 12 00 03 00 00 00 01 49 00 01 00 01 54 24 0A 00 63 63 63 00 26 06 00 00 00 00 00 01 50 01 00 27 04 26 07 07 29 5D 5C 5C 00 24 1F 00 00 00 00 00 01 63 00 01 00 0D 2C 24 0A 16 63 63 63 00 22 00 00 00 00 00 00 01 4C 00 01 00 07 2D 23 0A 30 63 63 63 00 24 1F 00 00 00 00 03 01 61 01 00 1A 07 54 5F 5F 3C 32 32 32 32 0E 07 00 1E 0F 12 00 00 04 01 18 57 61 72 6D 20 53 74 67 20 41 D5 +VoiceData7=54 24 0A 10 63 63 5F 00 34 00 00 03 00 00 03 00 38 00 03 00 00 54 24 0A 0C 63 63 5F 00 34 12 00 03 00 00 00 01 49 00 01 00 01 54 24 0A 00 63 63 63 00 26 06 00 00 00 00 00 01 50 01 00 27 04 26 07 07 29 5D 5C 5C 00 24 1F 00 00 00 00 00 01 63 00 01 00 0D 2C 24 0A 16 63 63 63 00 22 00 00 00 00 00 00 01 4C 00 01 00 07 2D 23 0A 30 63 63 63 00 24 1F 00 00 00 00 03 01 61 01 00 1A 07 54 5F 5F 3C 32 32 32 32 0E 07 00 1E 0F 12 00 00 04 01 18 57 61 72 6D 20 53 74 67 20 41 55 MonoMode7=0 ModulationWheelRange7=99 ModulationWheelTarget7=1 @@ -204,7 +204,7 @@ PitchBendStep8=0 PortamentoMode8=0 PortamentoGlissando8=0 PortamentoTime8=0 -VoiceData8=54 24 0A 10 63 63 5F 00 34 00 00 03 00 00 03 00 38 00 03 00 00 54 24 0A 0C 63 63 5F 00 34 12 00 03 00 00 00 01 49 00 01 00 01 54 24 0A 00 63 63 63 00 26 06 00 00 00 00 00 01 50 01 00 27 04 26 07 07 29 5D 5C 5C 00 24 1F 00 00 00 00 00 01 63 00 01 00 0D 2C 24 0A 16 63 63 63 00 22 00 00 00 00 00 00 01 4C 00 01 00 07 2D 23 0A 30 63 63 63 00 24 1F 00 00 00 00 03 01 61 01 00 1A 07 54 5F 5F 3C 32 32 32 32 0E 07 00 1E 0F 12 00 00 04 01 18 57 61 72 6D 20 53 74 67 20 41 D1 +VoiceData8=54 24 0A 10 63 63 5F 00 34 00 00 03 00 00 03 00 38 00 03 00 00 54 24 0A 0C 63 63 5F 00 34 12 00 03 00 00 00 01 49 00 01 00 01 54 24 0A 00 63 63 63 00 26 06 00 00 00 00 00 01 50 01 00 27 04 26 07 07 29 5D 5C 5C 00 24 1F 00 00 00 00 00 01 63 00 01 00 0D 2C 24 0A 16 63 63 63 00 22 00 00 00 00 00 00 01 4C 00 01 00 07 2D 23 0A 30 63 63 63 00 24 1F 00 00 00 00 03 01 61 01 00 1A 07 54 5F 5F 3C 32 32 32 32 0E 07 00 1E 0F 12 00 00 04 01 18 57 61 72 6D 20 53 74 67 20 41 55 MonoMode8=0 ModulationWheelRange8=99 ModulationWheelTarget8=1 @@ -217,8 +217,8 @@ AftertouchTarget8=0 CompressorEnable=0 ReverbEnable=1 ReverbSize=75 -ReverbHighDamp=45 -ReverbLowDamp=22 -ReverbLowPass=30 -ReverbDiffusion=99 -ReverbLevel=99 +ReverbHighDamp=35 +ReverbLowDamp=24 +ReverbLowPass=65 +ReverbDiffusion=74 +ReverbLevel=54 diff --git a/performance/000126_INIT.ini b/performance/000126_INIT.ini index fb9c931..4b4bdcb 100644 --- a/performance/000126_INIT.ini +++ b/performance/000126_INIT.ini @@ -1,7 +1,7 @@ -BankNumber1=18 -VoiceNumber1=32 +BankNumber1=71 +VoiceNumber1=1 MIDIChannel1=1 -Volume1=50 +Volume1=38 Pan1=64 Detune1=0 Cutoff1=99 @@ -9,13 +9,13 @@ Resonance1=0 NoteLimitLow1=0 NoteLimitHigh1=127 NoteShift1=0 -ReverbSend1=0 +ReverbSend1=99 PitchBendRange1=2 PitchBendStep1=0 PortamentoMode1=0 PortamentoGlissando1=0 PortamentoTime1=0 -VoiceData1=63 63 63 63 63 63 63 00 27 00 00 00 00 00 00 00 00 00 01 00 07 63 63 63 63 63 63 63 00 27 00 00 00 00 00 00 00 00 00 01 00 07 63 63 63 63 63 63 63 00 27 00 00 00 00 00 00 00 00 00 01 00 07 63 63 63 63 63 63 63 00 27 00 00 00 00 00 00 00 00 00 01 00 07 63 63 63 63 63 63 63 00 27 00 00 00 00 00 00 00 00 00 01 00 07 63 63 63 63 63 63 63 00 27 00 00 00 00 00 00 00 63 00 01 00 07 63 63 63 63 32 32 32 32 00 00 01 23 00 00 00 01 00 03 18 49 4E 49 54 20 56 4F 49 43 45 51 +VoiceData1=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 36 00 1B 00 00 03 00 06 55 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 37 00 34 00 00 03 00 07 3A 00 1A 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 04 06 00 0F 21 00 00 00 04 02 18 46 45 4E 44 45 52 48 4F 44 45 55 MonoMode1=0 ModulationWheelRange1=99 ModulationWheelTarget1=1 @@ -25,24 +25,24 @@ BreathControlRange1=99 BreathControlTarget1=0 AftertouchRange1=99 AftertouchTarget1=0 -BankNumber2=0 +BankNumber2=71 VoiceNumber2=1 -MIDIChannel2=0 -Volume2=100 -Pan2=63 -Detune2=0 +MIDIChannel2=2 +Volume2=38 +Pan2=0 +Detune2=-3 Cutoff2=99 Resonance2=0 NoteLimitLow2=0 NoteLimitHigh2=127 NoteShift2=0 -ReverbSend2=0 +ReverbSend2=99 PitchBendRange2=2 PitchBendStep2=0 PortamentoMode2=0 PortamentoGlissando2=0 PortamentoTime2=0 -VoiceData2=31 63 1C 44 62 62 5B 00 27 36 32 01 01 04 00 02 52 00 01 00 07 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 62 00 01 00 08 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 07 4D 4C 52 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 05 3E 33 1D 47 52 5F 60 00 1B 00 07 03 01 00 00 00 56 00 00 00 0E 48 4C 63 47 63 58 60 00 27 00 0E 03 03 00 00 00 62 00 00 00 0E 54 5F 5F 3C 32 32 32 32 15 07 01 25 00 05 00 00 04 03 18 42 52 41 53 53 20 20 20 31 20 5D +VoiceData2=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 36 00 1B 00 00 03 00 06 55 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 37 00 34 00 00 03 00 07 3A 00 1A 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 04 06 00 0F 21 00 00 00 04 02 18 46 45 4E 44 45 52 48 4F 44 45 75 MonoMode2=0 ModulationWheelRange2=99 ModulationWheelTarget2=1 @@ -52,24 +52,24 @@ BreathControlRange2=99 BreathControlTarget2=0 AftertouchRange2=99 AftertouchTarget2=0 -BankNumber3=0 +BankNumber3=71 VoiceNumber3=1 -MIDIChannel3=0 -Volume3=100 -Pan3=64 -Detune3=0 +MIDIChannel3=2 +Volume3=38 +Pan3=127 +Detune3=3 Cutoff3=99 Resonance3=0 NoteLimitLow3=0 NoteLimitHigh3=127 NoteShift3=0 -ReverbSend3=0 +ReverbSend3=99 PitchBendRange3=2 PitchBendStep3=0 PortamentoMode3=0 PortamentoGlissando3=0 PortamentoTime3=0 -VoiceData3=31 63 1C 44 62 62 5B 00 27 36 32 01 01 04 00 02 52 00 01 00 07 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 62 00 01 00 08 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 07 4D 4C 52 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 05 3E 33 1D 47 52 5F 60 00 1B 00 07 03 01 00 00 00 56 00 00 00 0E 48 4C 63 47 63 58 60 00 27 00 0E 03 03 00 00 00 62 00 00 00 0E 54 5F 5F 3C 32 32 32 32 15 07 01 25 00 05 00 00 04 03 18 42 52 41 53 53 20 20 20 31 20 57 +VoiceData3=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 36 00 1B 00 00 03 00 06 55 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 37 00 34 00 00 03 00 07 3A 00 1A 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 04 06 00 0F 21 00 00 00 04 02 18 46 45 4E 44 45 52 48 4F 44 45 DD MonoMode3=0 ModulationWheelRange3=99 ModulationWheelTarget3=1 @@ -79,24 +79,24 @@ BreathControlRange3=99 BreathControlTarget3=0 AftertouchRange3=99 AftertouchTarget3=0 -BankNumber4=0 +BankNumber4=71 VoiceNumber4=1 -MIDIChannel4=0 -Volume4=100 -Pan4=64 -Detune4=0 +MIDIChannel4=3 +Volume4=38 +Pan4=0 +Detune4=-3 Cutoff4=99 Resonance4=0 NoteLimitLow4=0 NoteLimitHigh4=127 NoteShift4=0 -ReverbSend4=0 +ReverbSend4=99 PitchBendRange4=2 PitchBendStep4=0 PortamentoMode4=0 PortamentoGlissando4=0 PortamentoTime4=0 -VoiceData4=31 63 1C 44 62 62 5B 00 27 36 32 01 01 04 00 02 52 00 01 00 07 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 62 00 01 00 08 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 07 4D 4C 52 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 05 3E 33 1D 47 52 5F 60 00 1B 00 07 03 01 00 00 00 56 00 00 00 0E 48 4C 63 47 63 58 60 00 27 00 0E 03 03 00 00 00 62 00 00 00 0E 54 5F 5F 3C 32 32 32 32 15 07 01 25 00 05 00 00 04 03 18 42 52 41 53 53 20 20 20 31 20 57 +VoiceData4=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 36 00 1B 00 00 03 00 06 55 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 37 00 34 00 00 03 00 07 3A 00 1A 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 04 06 00 0F 21 00 00 00 04 02 18 46 45 4E 44 45 52 48 4F 44 45 55 MonoMode4=0 ModulationWheelRange4=99 ModulationWheelTarget4=1 @@ -106,24 +106,24 @@ BreathControlRange4=99 BreathControlTarget4=0 AftertouchRange4=99 AftertouchTarget4=0 -BankNumber5=0 +BankNumber5=71 VoiceNumber5=1 -MIDIChannel5=0 -Volume5=100 -Pan5=64 -Detune5=0 +MIDIChannel5=3 +Volume5=38 +Pan5=127 +Detune5=3 Cutoff5=99 Resonance5=0 NoteLimitLow5=0 NoteLimitHigh5=127 NoteShift5=0 -ReverbSend5=0 +ReverbSend5=99 PitchBendRange5=2 PitchBendStep5=0 PortamentoMode5=0 PortamentoGlissando5=0 PortamentoTime5=0 -VoiceData5=31 63 1C 44 62 62 5B 00 27 36 32 01 01 04 00 02 52 00 01 00 07 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 62 00 01 00 08 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 07 4D 4C 52 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 05 3E 33 1D 47 52 5F 60 00 1B 00 07 03 01 00 00 00 56 00 00 00 0E 48 4C 63 47 63 58 60 00 27 00 0E 03 03 00 00 00 62 00 00 00 0E 54 5F 5F 3C 32 32 32 32 15 07 01 25 00 05 00 00 04 03 18 42 52 41 53 53 20 20 20 31 20 5D +VoiceData5=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 36 00 1B 00 00 03 00 06 55 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 37 00 34 00 00 03 00 07 3A 00 1A 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 04 06 00 0F 21 00 00 00 04 02 18 46 45 4E 44 45 52 48 4F 44 45 5D MonoMode5=0 ModulationWheelRange5=99 ModulationWheelTarget5=1 @@ -133,24 +133,24 @@ BreathControlRange5=99 BreathControlTarget5=0 AftertouchRange5=99 AftertouchTarget5=0 -BankNumber6=0 +BankNumber6=71 VoiceNumber6=1 -MIDIChannel6=0 -Volume6=100 -Pan6=64 -Detune6=0 +MIDIChannel6=3 +Volume6=38 +Pan6=0 +Detune6=1 Cutoff6=99 Resonance6=0 NoteLimitLow6=0 NoteLimitHigh6=127 NoteShift6=0 -ReverbSend6=0 +ReverbSend6=99 PitchBendRange6=2 PitchBendStep6=0 PortamentoMode6=0 PortamentoGlissando6=0 PortamentoTime6=0 -VoiceData6=31 63 1C 44 62 62 5B 00 27 36 32 01 01 04 00 02 52 00 01 00 07 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 62 00 01 00 08 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 07 4D 4C 52 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 05 3E 33 1D 47 52 5F 60 00 1B 00 07 03 01 00 00 00 56 00 00 00 0E 48 4C 63 47 63 58 60 00 27 00 0E 03 03 00 00 00 62 00 00 00 0E 54 5F 5F 3C 32 32 32 32 15 07 01 25 00 05 00 00 04 03 18 42 52 41 53 53 20 20 20 31 20 75 +VoiceData6=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 36 00 1B 00 00 03 00 06 55 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 37 00 34 00 00 03 00 07 3A 00 1A 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 04 06 00 0F 21 00 00 00 04 02 18 46 45 4E 44 45 52 48 4F 44 45 55 MonoMode6=0 ModulationWheelRange6=99 ModulationWheelTarget6=1 @@ -160,24 +160,24 @@ BreathControlRange6=99 BreathControlTarget6=0 AftertouchRange6=99 AftertouchTarget6=0 -BankNumber7=0 +BankNumber7=71 VoiceNumber7=1 -MIDIChannel7=0 -Volume7=100 -Pan7=64 -Detune7=0 +MIDIChannel7=3 +Volume7=38 +Pan7=120 +Detune7=-4 Cutoff7=99 Resonance7=0 NoteLimitLow7=0 NoteLimitHigh7=127 NoteShift7=0 -ReverbSend7=0 +ReverbSend7=99 PitchBendRange7=2 PitchBendStep7=0 PortamentoMode7=0 PortamentoGlissando7=0 PortamentoTime7=0 -VoiceData7=31 63 1C 44 62 62 5B 00 27 36 32 01 01 04 00 02 52 00 01 00 07 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 62 00 01 00 08 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 07 4D 4C 52 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 05 3E 33 1D 47 52 5F 60 00 1B 00 07 03 01 00 00 00 56 00 00 00 0E 48 4C 63 47 63 58 60 00 27 00 0E 03 03 00 00 00 62 00 00 00 0E 54 5F 5F 3C 32 32 32 32 15 07 01 25 00 05 00 00 04 03 18 42 52 41 53 53 20 20 20 31 20 75 +VoiceData7=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 36 00 1B 00 00 03 00 06 55 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 37 00 34 00 00 03 00 07 3A 00 1A 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 04 06 00 0F 21 00 00 00 04 02 18 46 45 4E 44 45 52 48 4F 44 45 55 MonoMode7=0 ModulationWheelRange7=99 ModulationWheelTarget7=1 @@ -187,10 +187,10 @@ BreathControlRange7=99 BreathControlTarget7=0 AftertouchRange7=99 AftertouchTarget7=0 -BankNumber8=0 +BankNumber8=71 VoiceNumber8=1 MIDIChannel8=0 -Volume8=100 +Volume8=64 Pan8=64 Detune8=0 Cutoff8=99 @@ -198,13 +198,13 @@ Resonance8=0 NoteLimitLow8=0 NoteLimitHigh8=127 NoteShift8=0 -ReverbSend8=0 +ReverbSend8=99 PitchBendRange8=2 PitchBendStep8=0 PortamentoMode8=0 PortamentoGlissando8=0 PortamentoTime8=0 -VoiceData8=31 63 1C 44 62 62 5B 00 27 36 32 01 01 04 00 02 52 00 01 00 07 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 62 00 01 00 08 4D 24 29 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 07 4D 4C 52 47 63 62 62 00 27 00 00 03 03 00 00 02 63 00 01 00 05 3E 33 1D 47 52 5F 60 00 1B 00 07 03 01 00 00 00 56 00 00 00 0E 48 4C 63 47 63 58 60 00 27 00 0E 03 03 00 00 00 62 00 00 00 0E 54 5F 5F 3C 32 32 32 32 15 07 01 25 00 05 00 00 04 03 18 42 52 41 53 53 20 20 20 31 20 55 +VoiceData8=5F 1D 14 32 63 5F 00 00 29 00 13 00 00 03 00 06 4F 00 01 00 0E 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 00 63 00 01 00 00 5F 1D 14 32 63 5F 00 00 36 00 1B 00 00 03 00 06 55 00 01 00 07 5F 14 14 32 63 5F 00 00 00 00 00 00 00 03 00 02 63 00 01 00 07 5F 32 23 4E 63 4B 00 00 37 00 34 00 00 03 00 07 3A 00 1A 00 07 60 19 19 43 63 4B 00 00 00 00 00 00 00 03 00 02 63 00 01 00 0A 5E 43 5F 3C 32 32 32 32 04 06 00 0F 21 00 00 00 04 02 18 46 45 4E 44 45 52 48 4F 44 45 01 MonoMode8=0 ModulationWheelRange8=99 ModulationWheelTarget8=1 @@ -216,12 +216,12 @@ AftertouchRange8=99 AftertouchTarget8=0 CompressorEnable=1 ReverbEnable=1 -ReverbSize=70 -ReverbHighDamp=50 -ReverbLowDamp=50 -ReverbLowPass=30 -ReverbDiffusion=65 -ReverbLevel=99 +ReverbSize=52 +ReverbHighDamp=28 +ReverbLowDamp=28 +ReverbLowPass=66 +ReverbDiffusion=66 +ReverbLevel=33 FXTubeEnable=1 FXTubeOverdrive=10 FXChorusEnable=1 diff --git a/src/config.cpp b/src/config.cpp index 44ac32f..c40d29a 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -72,6 +72,7 @@ void CConfig::Load (void) m_bIgnoreAllNotesOff = m_Properties.GetNumber ("IgnoreAllNotesOff", 0) != 0; m_bMIDIAutoVoiceDumpOnPC = m_Properties.GetNumber ("MIDIAutoVoiceDumpOnPC", 1) != 0; m_bHeaderlessSysExVoices = m_Properties.GetNumber ("HeaderlessSysExVoices", 0) != 0; + m_bExpandPCAcrossBanks = m_Properties.GetNumber ("ExpandPCAcrossBanks", 1) != 0; m_bLCDEnabled = m_Properties.GetNumber ("LCDEnabled", 0) != 0; m_nLCDPinEnable = m_Properties.GetNumber ("LCDPinEnable", 4); @@ -185,6 +186,11 @@ bool CConfig::GetHeaderlessSysExVoices (void) const return m_bHeaderlessSysExVoices; } +bool CConfig::GetExpandPCAcrossBanks (void) const +{ + return m_bExpandPCAcrossBanks; +} + bool CConfig::GetLCDEnabled (void) const { return m_bLCDEnabled; diff --git a/src/config.h b/src/config.h index bc5e7c6..a316be8 100644 --- a/src/config.h +++ b/src/config.h @@ -78,6 +78,7 @@ public: bool GetIgnoreAllNotesOff (void) const; bool GetMIDIAutoVoiceDumpOnPC (void) const; // true if not specified bool GetHeaderlessSysExVoices (void) const; // false if not specified + bool GetExpandPCAcrossBanks (void) const; // true if not specified // HD44780 LCD // GPIO pin numbers are chip numbers, not header positions @@ -159,6 +160,7 @@ private: bool m_bIgnoreAllNotesOff; bool m_bMIDIAutoVoiceDumpOnPC; bool m_bHeaderlessSysExVoices; + bool m_bExpandPCAcrossBanks; bool m_bLCDEnabled; unsigned m_nLCDPinEnable; diff --git a/src/mididevice.cpp b/src/mididevice.cpp index ad19b63..5b714f1 100644 --- a/src/mididevice.cpp +++ b/src/mididevice.cpp @@ -29,44 +29,44 @@ #include #include "userinterface.h" -LOGMODULE ("mididevice"); - -#define MIDI_NOTE_OFF 0b1000 -#define MIDI_NOTE_ON 0b1001 -#define MIDI_AFTERTOUCH 0b1010 // TODO -#define MIDI_CHANNEL_AFTERTOUCH 0b1101 // right now Synth_Dexed just manage Channel Aftertouch not Polyphonic AT -> 0b1010 -#define MIDI_CONTROL_CHANGE 0b1011 - #define MIDI_CC_BANK_SELECT_MSB 0 - #define MIDI_CC_MODULATION 1 - #define MIDI_CC_BREATH_CONTROLLER 2 - #define MIDI_CC_FOOT_PEDAL 4 - #define MIDI_CC_VOLUME 7 - #define MIDI_CC_PAN_POSITION 10 - #define MIDI_CC_BANK_SELECT_LSB 32 - #define MIDI_CC_BANK_SUSTAIN 64 - #define MIDI_CC_RESONANCE 71 - #define MIDI_CC_FREQUENCY_CUTOFF 74 - #define MIDI_CC_REVERB_LEVEL 91 - #define MIDI_CC_ORBITONE_LEVEL 92 // added with mixing console - #define MIDI_CC_CHORUS_LEVEL 93 // added with mixing console - #define MIDI_CC_DETUNE_LEVEL 94 - #define MIDI_CC_PHASER_LEVEL 95 // added with mixing console - #define MIDI_CC_ALL_SOUND_OFF 120 - #define MIDI_CC_ALL_NOTES_OFF 123 -#define MIDI_PROGRAM_CHANGE 0b1100 -#define MIDI_PITCH_BEND 0b1110 - -#define MIDI_SYSTEM_EXCLUSIVE_BEGIN 0xF0 -#define MIDI_SYSTEM_EXCLUSIVE_END 0xF7 -#define MIDI_TIMING_CLOCK 0xF8 -#define MIDI_ACTIVE_SENSING 0xFE +LOGMODULE("mididevice"); + +#define MIDI_NOTE_OFF 0b1000 +#define MIDI_NOTE_ON 0b1001 +#define MIDI_AFTERTOUCH 0b1010 // TODO +#define MIDI_CHANNEL_AFTERTOUCH 0b1101 // right now Synth_Dexed just manage Channel Aftertouch not Polyphonic AT -> 0b1010 +#define MIDI_CONTROL_CHANGE 0b1011 +#define MIDI_CC_BANK_SELECT_MSB 0 +#define MIDI_CC_MODULATION 1 +#define MIDI_CC_BREATH_CONTROLLER 2 +#define MIDI_CC_FOOT_PEDAL 4 +#define MIDI_CC_VOLUME 7 +#define MIDI_CC_PAN_POSITION 10 +#define MIDI_CC_BANK_SELECT_LSB 32 +#define MIDI_CC_BANK_SUSTAIN 64 +#define MIDI_CC_RESONANCE 71 +#define MIDI_CC_FREQUENCY_CUTOFF 74 +#define MIDI_CC_REVERB_LEVEL 91 +#define MIDI_CC_ORBITONE_LEVEL 92 // added with mixing console +#define MIDI_CC_CHORUS_LEVEL 93 // added with mixing console +#define MIDI_CC_DETUNE_LEVEL 94 +#define MIDI_CC_PHASER_LEVEL 95 // added with mixing console +#define MIDI_CC_ALL_SOUND_OFF 120 +#define MIDI_CC_ALL_NOTES_OFF 123 +#define MIDI_PROGRAM_CHANGE 0b1100 +#define MIDI_PITCH_BEND 0b1110 + +#define MIDI_SYSTEM_EXCLUSIVE_BEGIN 0xF0 +#define MIDI_SYSTEM_EXCLUSIVE_END 0xF7 +#define MIDI_TIMING_CLOCK 0xF8 +#define MIDI_ACTIVE_SENSING 0xFE CMIDIDevice::TDeviceMap CMIDIDevice::s_DeviceMap; -CMIDIDevice::CMIDIDevice (CMiniDexed *pSynthesizer, CConfig *pConfig, CUserInterface *pUI) -: m_pSynthesizer (pSynthesizer), - m_pConfig (pConfig), - m_pUI (pUI) +CMIDIDevice::CMIDIDevice(CMiniDexed *pSynthesizer, CConfig *pConfig, CUserInterface *pUI) + : m_pSynthesizer(pSynthesizer), + m_pConfig(pConfig), + m_pUI(pUI) { for (unsigned nTG = 0; nTG < CConfig::ToneGenerators; nTG++) { @@ -74,94 +74,93 @@ CMIDIDevice::CMIDIDevice (CMiniDexed *pSynthesizer, CConfig *pConfig, CUserInter } } -CMIDIDevice::~CMIDIDevice (void) +CMIDIDevice::~CMIDIDevice(void) { m_pSynthesizer = 0; } -void CMIDIDevice::SetChannel (u8 ucChannel, unsigned nTG) +void CMIDIDevice::SetChannel(u8 ucChannel, unsigned nTG) { - assert (nTG < CConfig::ToneGenerators); + assert(nTG < CConfig::ToneGenerators); m_ChannelMap[nTG] = ucChannel; } -u8 CMIDIDevice::GetChannel (unsigned nTG) const +u8 CMIDIDevice::GetChannel(unsigned nTG) const { - assert (nTG < CConfig::ToneGenerators); + assert(nTG < CConfig::ToneGenerators); return m_ChannelMap[nTG]; } -void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsigned nCable) +void CMIDIDevice::MIDIMessageHandler(const u8 *pMessage, size_t nLength, unsigned nCable) { // The packet contents are just normal MIDI data - see // https://www.midi.org/specifications/item/table-1-summary-of-midi-message - if (m_pConfig->GetMIDIDumpEnabled ()) + if (m_pConfig->GetMIDIDumpEnabled()) { switch (nLength) { case 1: - if ( pMessage[0] != MIDI_TIMING_CLOCK - && pMessage[0] != MIDI_ACTIVE_SENSING) + if (pMessage[0] != MIDI_TIMING_CLOCK && pMessage[0] != MIDI_ACTIVE_SENSING) { - printf ("MIDI%u: %02X\n", nCable, (unsigned) pMessage[0]); + printf("MIDI%u: %02X\n", nCable, (unsigned)pMessage[0]); } break; case 2: - printf ("MIDI%u: %02X %02X\n", nCable, - (unsigned) pMessage[0], (unsigned) pMessage[1]); + printf("MIDI%u: %02X %02X\n", nCable, + (unsigned)pMessage[0], (unsigned)pMessage[1]); break; case 3: - printf ("MIDI%u: %02X %02X %02X\n", nCable, - (unsigned) pMessage[0], (unsigned) pMessage[1], - (unsigned) pMessage[2]); + printf("MIDI%u: %02X %02X %02X\n", nCable, + (unsigned)pMessage[0], (unsigned)pMessage[1], + (unsigned)pMessage[2]); break; default: - switch(pMessage[0]) + switch (pMessage[0]) { - case MIDI_SYSTEM_EXCLUSIVE_BEGIN: - printf("MIDI%u: SysEx data length: [%d]:",nCable, uint16_t(nLength)); - for (uint16_t i = 0; i < nLength; i++) - { - if((i % 16) == 0) - printf("\n%04d:",i); - printf(" 0x%02x",pMessage[i]); - } - printf("\n"); - break; - default: - printf("MIDI%u: Unhandled MIDI event type %0x02x\n",nCable,pMessage[0]); + case MIDI_SYSTEM_EXCLUSIVE_BEGIN: + printf("MIDI%u: SysEx data length: [%d]:", nCable, uint16_t(nLength)); + for (uint16_t i = 0; i < nLength; i++) + { + if ((i % 16) == 0) + printf("\n%04d:", i); + printf(" 0x%02x", pMessage[i]); + } + printf("\n"); + break; + default: + printf("MIDI%u: Unhandled MIDI event type %0x02x\n", nCable, pMessage[0]); } break; } } // Only for debugging: -/* - if(pMessage[0]==MIDI_SYSTEM_EXCLUSIVE_BEGIN) - { - printf("MIDI%u: SysEx data length: [%d]:",nCable, uint16_t(nLength)); - for (uint16_t i = 0; i < nLength; i++) + /* + if(pMessage[0]==MIDI_SYSTEM_EXCLUSIVE_BEGIN) { - if((i % 16) == 0) - printf("\n%04d:",i); - printf(" 0x%02x",pMessage[i]); + printf("MIDI%u: SysEx data length: [%d]:",nCable, uint16_t(nLength)); + for (uint16_t i = 0; i < nLength; i++) + { + if((i % 16) == 0) + printf("\n%04d:",i); + printf(" 0x%02x",pMessage[i]); + } + printf("\n"); } - printf("\n"); - } -*/ + */ // Handle MIDI Thru - if (m_DeviceName.compare (m_pConfig->GetMIDIThruIn ()) == 0) + if (m_DeviceName.compare(m_pConfig->GetMIDIThruIn()) == 0) { TDeviceMap::const_iterator Iterator; - Iterator = s_DeviceMap.find (m_pConfig->GetMIDIThruOut ()); - if (Iterator != s_DeviceMap.end ()) + Iterator = s_DeviceMap.find(m_pConfig->GetMIDIThruOut()); + if (Iterator != s_DeviceMap.end()) { - Iterator->second->Send (pMessage, nLength, nCable); + Iterator->second->Send(pMessage, nLength, nCable); } } @@ -171,17 +170,17 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign return; } - m_MIDISpinLock.Acquire (); + m_MIDISpinLock.Acquire(); - u8 ucStatus = pMessage[0]; + u8 ucStatus = pMessage[0]; u8 ucChannel = ucStatus & 0x0F; - u8 ucType = ucStatus >> 4; + u8 ucType = ucStatus >> 4; // GLOBAL MIDI SYSEX - if (pMessage[0] == MIDI_SYSTEM_EXCLUSIVE_BEGIN && pMessage[3] == 0x04 && pMessage[4] == 0x01 && pMessage[nLength-1] == MIDI_SYSTEM_EXCLUSIVE_END) // MASTER VOLUME + if (pMessage[0] == MIDI_SYSTEM_EXCLUSIVE_BEGIN && pMessage[3] == 0x04 && pMessage[4] == 0x01 && pMessage[nLength - 1] == MIDI_SYSTEM_EXCLUSIVE_END) // MASTER VOLUME { - float32_t nMasterVolume=((pMessage[5] & 0x7c) & ((pMessage[6] & 0x7c) <<7))/(1<<14); - LOGNOTE("Master volume: %f",nMasterVolume); + float32_t nMasterVolume = ((pMessage[5] & 0x7c) & ((pMessage[6] & 0x7c) << 7)) / (1 << 14); + LOGNOTE("Master volume: %f", nMasterVolume); m_pSynthesizer->setMasterVolume(nMasterVolume); } else @@ -194,9 +193,9 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign case MIDI_NOTE_ON: 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; } @@ -209,14 +208,13 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign uint8_t ucSysExChannel = (pMessage[2] & 0x0F); if (m_ChannelMap[nTG] == ucSysExChannel || m_ChannelMap[nTG] == OmniMode) { - LOGNOTE("MIDI-SYSEX: channel: %u, len: %u, TG: %u",m_ChannelMap[nTG],nLength,nTG); + LOGNOTE("MIDI-SYSEX: channel: %u, len: %u, TG: %u", m_ChannelMap[nTG], nLength, nTG); HandleSystemExclusive(pMessage, nLength, nCable, nTG); } } else { - if ( m_ChannelMap[nTG] == ucChannel - || m_ChannelMap[nTG] == OmniMode) + if (m_ChannelMap[nTG] == ucChannel || m_ChannelMap[nTG] == OmniMode) { switch (ucType) { @@ -225,92 +223,92 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign { break; } - + if (pMessage[2] > 0) { if (pMessage[2] <= 127) { - m_pSynthesizer->keydown (pMessage[1], - pMessage[2], nTG); + m_pSynthesizer->keydown(pMessage[1], + pMessage[2], nTG); } } else { - m_pSynthesizer->keyup (pMessage[1], nTG); + m_pSynthesizer->keyup(pMessage[1], nTG); } break; - + case MIDI_NOTE_OFF: if (nLength < 3) { break; } - - m_pSynthesizer->keyup (pMessage[1], nTG); + + m_pSynthesizer->keyup(pMessage[1], nTG); break; - + case MIDI_CHANNEL_AFTERTOUCH: - - m_pSynthesizer->setAftertouch (pMessage[1], nTG); - m_pSynthesizer->ControllersRefresh (nTG); + + m_pSynthesizer->setAftertouch(pMessage[1], nTG); + m_pSynthesizer->ControllersRefresh(nTG); break; - + case MIDI_CONTROL_CHANGE: if (nLength < 3) { break; } - + switch (pMessage[1]) { case MIDI_CC_MODULATION: - m_pSynthesizer->setModWheel (pMessage[2], nTG); - m_pSynthesizer->ControllersRefresh (nTG); + m_pSynthesizer->setModWheel(pMessage[2], nTG); + m_pSynthesizer->ControllersRefresh(nTG); break; - + case MIDI_CC_FOOT_PEDAL: - m_pSynthesizer->setFootController (pMessage[2], nTG); - m_pSynthesizer->ControllersRefresh (nTG); + m_pSynthesizer->setFootController(pMessage[2], nTG); + m_pSynthesizer->ControllersRefresh(nTG); break; case MIDI_CC_BREATH_CONTROLLER: - m_pSynthesizer->setBreathController (pMessage[2], nTG); - m_pSynthesizer->ControllersRefresh (nTG); + m_pSynthesizer->setBreathController(pMessage[2], nTG); + m_pSynthesizer->ControllersRefresh(nTG); break; - + case MIDI_CC_VOLUME: - m_pSynthesizer->SetVolume (pMessage[2], nTG); + m_pSynthesizer->SetVolume(pMessage[2], nTG); break; - + case MIDI_CC_PAN_POSITION: - m_pSynthesizer->SetPan (pMessage[2], nTG); + m_pSynthesizer->SetPan(pMessage[2], nTG); break; - + case MIDI_CC_BANK_SELECT_MSB: - m_pSynthesizer->BankSelectMSB (pMessage[2], nTG); + m_pSynthesizer->BankSelectMSB(pMessage[2], nTG); break; - + case MIDI_CC_BANK_SELECT_LSB: - m_pSynthesizer->BankSelectLSB (pMessage[2], nTG); + m_pSynthesizer->BankSelectLSB(pMessage[2], nTG); break; - + case MIDI_CC_BANK_SUSTAIN: - m_pSynthesizer->setSustain (pMessage[2] >= 64, nTG); + m_pSynthesizer->setSustain(pMessage[2] >= 64, nTG); break; - + case MIDI_CC_RESONANCE: - m_pSynthesizer->SetResonance (maplong (pMessage[2], 0, 127, 0, 99), nTG); + m_pSynthesizer->SetResonance(maplong(pMessage[2], 0, 127, 0, 99), nTG); break; - + case MIDI_CC_FREQUENCY_CUTOFF: - m_pSynthesizer->SetCutoff (maplong (pMessage[2], 0, 127, 0, 99), nTG); + m_pSynthesizer->SetCutoff(maplong(pMessage[2], 0, 127, 0, 99), nTG); break; - + case MIDI_CC_REVERB_LEVEL: #ifdef MIXING_CONSOLE_ENABLE this->m_pSynthesizer->setMixingConsoleSendLevel(nTG, MixerOutput::FX_PlateReverb, maplong(pMessage[2], 0, 127, 0, 99)); #else - m_pSynthesizer->SetReverbSend (maplong (pMessage[2], 0, 127, 0, 99), nTG); + m_pSynthesizer->SetReverbSend(maplong(pMessage[2], 0, 127, 0, 99), nTG); #endif break; @@ -330,46 +328,51 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign if (pMessage[2] == 0) { // "0 to 127, with 0 being no celeste (detune) effect applied at all." - m_pSynthesizer->SetMasterTune (0, nTG); + m_pSynthesizer->SetMasterTune(0, nTG); } else { - m_pSynthesizer->SetMasterTune (maplong (pMessage[2], 1, 127, -99, 99), nTG); + m_pSynthesizer->SetMasterTune(maplong(pMessage[2], 1, 127, -99, 99), nTG); } break; - + case MIDI_CC_ALL_SOUND_OFF: - m_pSynthesizer->panic (pMessage[2], nTG); + m_pSynthesizer->panic(pMessage[2], nTG); break; - + case MIDI_CC_ALL_NOTES_OFF: - if (!m_pConfig->GetIgnoreAllNotesOff ()) + // As per "MIDI 1.0 Detailed Specification" v4.2 + // From "ALL NOTES OFF" states: + // "Receivers should ignore an All Notes Off message while Omni is on (Modes 1 & 2)" + if (!m_pConfig->GetIgnoreAllNotesOff() && m_ChannelMap[nTG] != OmniMode) { - m_pSynthesizer->notesOff (pMessage[2], nTG); + m_pSynthesizer->notesOff(pMessage[2], nTG); } break; } break; - + case MIDI_PROGRAM_CHANGE: // do program change only if enabled in config - if( m_pConfig->GetMIDIRXProgramChange() ) - m_pSynthesizer->ProgramChange (pMessage[1], nTG); + if (m_pConfig->GetMIDIRXProgramChange()) + m_pSynthesizer->ProgramChange(pMessage[1], nTG); break; - - case MIDI_PITCH_BEND: { + + case MIDI_PITCH_BEND: + { if (nLength < 3) { break; } - + s16 nValue = pMessage[1]; - nValue |= (s16) pMessage[2] << 7; + nValue |= (s16)pMessage[2] << 7; nValue -= 0x2000; - - m_pSynthesizer->setPitchbend (nValue, nTG); - } break; - + + m_pSynthesizer->setPitchbend(nValue, nTG); + } + break; + default: break; } @@ -377,162 +380,161 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign } } } - m_MIDISpinLock.Release (); + m_MIDISpinLock.Release(); } -void CMIDIDevice::AddDevice (const char *pDeviceName) +void CMIDIDevice::AddDevice(const char *pDeviceName) { - assert (pDeviceName); + assert(pDeviceName); - assert (m_DeviceName.empty ()); + assert(m_DeviceName.empty()); m_DeviceName = pDeviceName; - assert (!m_DeviceName.empty ()); + assert(!m_DeviceName.empty()); - s_DeviceMap.insert (std::pair (pDeviceName, this)); + s_DeviceMap.insert(std::pair(pDeviceName, this)); } -void CMIDIDevice::HandleSystemExclusive(const uint8_t* pMessage, const size_t nLength, const unsigned nCable, const uint8_t nTG) +void CMIDIDevice::HandleSystemExclusive(const uint8_t *pMessage, const size_t nLength, const unsigned nCable, const uint8_t nTG) { - int16_t sysex_return; - - sysex_return = m_pSynthesizer->checkSystemExclusive(pMessage, nLength, nTG); - LOGDBG("SYSEX handler return value: %d", sysex_return); - - switch (sysex_return) - { - case -1: - LOGERR("SysEx end status byte not detected."); - break; - case -2: - LOGERR("SysEx vendor not Yamaha."); - break; - case -3: - LOGERR("Unknown SysEx parameter change."); - break; - case -4: - LOGERR("Unknown SysEx voice or function."); - break; - case -5: - LOGERR("Not a SysEx voice bulk upload."); - break; - case -6: - LOGERR("Wrong length for SysEx voice bulk upload (not 155)."); - break; - case -7: - LOGERR("Checksum error for one voice."); - break; - case -8: - LOGERR("Not a SysEx bank bulk upload."); - break; - case -9: - LOGERR("Wrong length for SysEx bank bulk upload (not 4096)."); - case -10: - LOGERR("Checksum error for bank."); - break; - case -11: - LOGERR("Unknown SysEx message."); - break; - case 64: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setMonoMode(pMessage[5],nTG); - break; - case 65: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setPitchbendRange(pMessage[5],nTG); - break; - case 66: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setPitchbendStep(pMessage[5],nTG); - break; - case 67: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setPortamentoMode(pMessage[5],nTG); - break; - case 68: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setPortamentoGlissando(pMessage[5],nTG); - break; - case 69: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setPortamentoTime(pMessage[5],nTG); - break; - case 70: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setModWheelRange(pMessage[5],nTG); - break; - case 71: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setModWheelTarget(pMessage[5],nTG); - break; - case 72: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setFootControllerRange(pMessage[5],nTG); - break; - case 73: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setFootControllerTarget(pMessage[5],nTG); - break; - case 74: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setBreathControllerRange(pMessage[5],nTG); - break; - case 75: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setBreathControllerTarget(pMessage[5],nTG); - break; - case 76: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setAftertouchRange(pMessage[5],nTG); - break; - case 77: - LOGDBG("SysEx Function parameter change: %d Value %d",pMessage[4],pMessage[5]); - m_pSynthesizer->setAftertouchTarget(pMessage[5],nTG); - break; - case 100: - // load sysex-data into voice memory - LOGDBG("One Voice bulk upload"); - m_pSynthesizer->loadVoiceParameters(pMessage,nTG); - break; - case 200: - LOGDBG("Bank bulk upload."); - //TODO: add code for storing a bank bulk upload - LOGNOTE("Currently code for storing a bulk bank upload is missing!"); - break; - default: - if(sysex_return >= 300 && sysex_return < 500) - { - LOGDBG("SysEx voice parameter change: Parameter %d value: %d",pMessage[4] + ((pMessage[3] & 0x03) * 128), pMessage[5]); - m_pSynthesizer->setVoiceDataElement(pMessage[4] + ((pMessage[3] & 0x03) * 128), pMessage[5],nTG); - switch(pMessage[4] + ((pMessage[3] & 0x03) * 128)) - { - case 134: - m_pSynthesizer->notesOff(0,nTG); - break; - } - } - else if(sysex_return >= 500 && sysex_return < 600) - { - LOGDBG("SysEx send voice %u request",sysex_return-500); - SendSystemExclusiveVoice(sysex_return-500, nCable, nTG); - } - break; - } + int16_t sysex_return; + + sysex_return = m_pSynthesizer->checkSystemExclusive(pMessage, nLength, nTG); + LOGDBG("SYSEX handler return value: %d", sysex_return); + + switch (sysex_return) + { + case -1: + LOGERR("SysEx end status byte not detected."); + break; + case -2: + LOGERR("SysEx vendor not Yamaha."); + break; + case -3: + LOGERR("Unknown SysEx parameter change."); + break; + case -4: + LOGERR("Unknown SysEx voice or function."); + break; + case -5: + LOGERR("Not a SysEx voice bulk upload."); + break; + case -6: + LOGERR("Wrong length for SysEx voice bulk upload (not 155)."); + break; + case -7: + LOGERR("Checksum error for one voice."); + break; + case -8: + LOGERR("Not a SysEx bank bulk upload."); + break; + case -9: + LOGERR("Wrong length for SysEx bank bulk upload (not 4096)."); + case -10: + LOGERR("Checksum error for bank."); + break; + case -11: + LOGERR("Unknown SysEx message."); + break; + case 64: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setMonoMode(pMessage[5], nTG); + break; + case 65: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setPitchbendRange(pMessage[5], nTG); + break; + case 66: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setPitchbendStep(pMessage[5], nTG); + break; + case 67: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setPortamentoMode(pMessage[5], nTG); + break; + case 68: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setPortamentoGlissando(pMessage[5], nTG); + break; + case 69: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setPortamentoTime(pMessage[5], nTG); + break; + case 70: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setModWheelRange(pMessage[5], nTG); + break; + case 71: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setModWheelTarget(pMessage[5], nTG); + break; + case 72: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setFootControllerRange(pMessage[5], nTG); + break; + case 73: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setFootControllerTarget(pMessage[5], nTG); + break; + case 74: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setBreathControllerRange(pMessage[5], nTG); + break; + case 75: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setBreathControllerTarget(pMessage[5], nTG); + break; + case 76: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setAftertouchRange(pMessage[5], nTG); + break; + case 77: + LOGDBG("SysEx Function parameter change: %d Value %d", pMessage[4], pMessage[5]); + m_pSynthesizer->setAftertouchTarget(pMessage[5], nTG); + break; + case 100: + // load sysex-data into voice memory + LOGDBG("One Voice bulk upload"); + m_pSynthesizer->loadVoiceParameters(pMessage, nTG); + break; + case 200: + LOGDBG("Bank bulk upload."); + // TODO: add code for storing a bank bulk upload + LOGNOTE("Currently code for storing a bulk bank upload is missing!"); + break; + default: + if (sysex_return >= 300 && sysex_return < 500) + { + LOGDBG("SysEx voice parameter change: Parameter %d value: %d", pMessage[4] + ((pMessage[3] & 0x03) * 128), pMessage[5]); + m_pSynthesizer->setVoiceDataElement(pMessage[4] + ((pMessage[3] & 0x03) * 128), pMessage[5], nTG); + switch (pMessage[4] + ((pMessage[3] & 0x03) * 128)) + { + case 134: + m_pSynthesizer->notesOff(0, nTG); + break; + } + } + else if (sysex_return >= 500 && sysex_return < 600) + { + LOGDBG("SysEx send voice %u request", sysex_return - 500); + SendSystemExclusiveVoice(sysex_return - 500, nCable, nTG); + } + break; + } } void CMIDIDevice::SendSystemExclusiveVoice(uint8_t nVoice, const unsigned nCable, uint8_t nTG) { - uint8_t voicedump[163]; + uint8_t voicedump[163]; - // Get voice sysex dump from TG - m_pSynthesizer->getSysExVoiceDump(voicedump, nTG); + // Get voice sysex dump from TG + m_pSynthesizer->getSysExVoiceDump(voicedump, nTG); - TDeviceMap::const_iterator Iterator; + TDeviceMap::const_iterator Iterator; - // send voice dump to all MIDI interfaces - auto end = s_DeviceMap.end(); - for(Iterator = s_DeviceMap.begin(); Iterator != end; ++Iterator) - { - Iterator->second->Send (voicedump, sizeof(voicedump)*sizeof(uint8_t)); - // LOGDBG("Send SYSEX voice dump %u to \"%s\"",nVoice,Iterator->first.c_str()); - } -} + // send voice dump to all MIDI interfaces + for (Iterator = s_DeviceMap.begin(); Iterator != s_DeviceMap.end(); ++Iterator) + { + Iterator->second->Send(voicedump, sizeof(voicedump) * sizeof(uint8_t)); + // LOGDBG("Send SYSEX voice dump %u to \"%s\"",nVoice,Iterator->first.c_str()); + } +} diff --git a/src/minidexed.cpp b/src/minidexed.cpp index 8a0d22a..d7aac98 100644 --- a/src/minidexed.cpp +++ b/src/minidexed.cpp @@ -51,6 +51,7 @@ CMiniDexed::CMiniDexed ( #ifdef ARM_ALLOW_MULTI_CORE m_nActiveTGsLog2 (0), #endif + m_GetChunkTimer ("GetChunk", 1000000U * pConfig->GetChunkSize ()/2 / pConfig->GetSampleRate ()), m_bProfileEnabled (m_pConfig->GetProfileEnabled ()), m_bSavePerformance (false), @@ -82,6 +83,15 @@ CMiniDexed::CMiniDexed ( m_nNoteLimitHigh[i] = 127; m_nNoteShift[i] = 0; + + + + + + + + + m_nModulationWheelRange[i] = 99; m_nModulationWheelTarget[i] = 7; m_nFootControlRange[i] = 99; @@ -318,6 +328,8 @@ bool CMiniDexed::Initialize (void) } #if defined(ARM_ALLOW_MULTI_CORE) + + m_pSoundDevice->SetWriteFormat (SoundFormatSigned16, 2); // 16-bit Stereo #else m_pSoundDevice->SetWriteFormat (SoundFormatSigned16, 1); // 16-bit Mono @@ -510,13 +522,34 @@ void CMiniDexed::ProgramChange (unsigned nProgram, unsigned nTG) { assert (m_pConfig); - nProgram=constrain((int)nProgram,0,31); + unsigned nBankOffset; + bool bPCAcrossBanks = m_pConfig->GetExpandPCAcrossBanks(); + if (bPCAcrossBanks) + { + // Note: This doesn't actually change the bank in use + // but will allow PC messages of 0..127 + // to select across four consecutive banks of voices. + // + // So if the current bank = 5 then: + // PC 0-31 = Bank 5, Program 0-31 + // PC 32-63 = Bank 6, Program 0-31 + // PC 64-95 = Bank 7, Program 0-31 + // PC 96-127 = Bank 8, Program 0-31 + nProgram=constrain((int)nProgram,0,127); + nBankOffset = nProgram >> 5; + nProgram = nProgram % 32; + } + else + { + nBankOffset = 0; + nProgram=constrain((int)nProgram,0,31); + } assert (nTG < CConfig::ToneGenerators); m_nProgram[nTG] = nProgram; uint8_t Buffer[156]; - m_SysExFileLoader.GetVoice (m_nVoiceBankID[nTG], nProgram, Buffer); + m_SysExFileLoader.GetVoice (m_nVoiceBankID[nTG]+nBankOffset, nProgram, Buffer); assert (m_pTG[nTG]); m_pTG[nTG]->loadVoiceParameters (Buffer); @@ -656,6 +689,8 @@ void CMiniDexed::SetResonance (int nResonance, unsigned nTG) m_UI.ParameterChanged (); } + + void CMiniDexed::SetMIDIChannel (uint8_t uchChannel, unsigned nTG) { assert (nTG < CConfig::ToneGenerators); @@ -771,6 +806,7 @@ void CMiniDexed::setModWheel (uint8_t value, unsigned nTG) m_pTG[nTG]->setModWheel (value); } + void CMiniDexed::setFootController (uint8_t value, unsigned nTG) { assert (nTG < CConfig::ToneGenerators); @@ -808,6 +844,8 @@ void CMiniDexed::ControllersRefresh (unsigned nTG) void CMiniDexed::SetParameter (TParameter Parameter, int nValue) { + + assert(Parameter < TParameter::ParameterUnknown); m_nParameter[Parameter] = nValue; @@ -1812,6 +1850,8 @@ void CMiniDexed::ProcessSound (void) uint8_t indexL=0, indexR=1; // BEGIN TG mixing + float32_t tmp_float[nFrames*2]; + if(nMasterVolume > 0.0f) { for (uint8_t i = 0; i < CConfig::ToneGenerators; i++) @@ -2315,6 +2355,11 @@ void CMiniDexed::getSysExVoiceDump(uint8_t* dest, uint8_t nTG) void CMiniDexed::setMasterVolume (float32_t vol) { this->nMasterVolume = constrain(vol, 0.0f, 1.0f); + + + + + } std::string CMiniDexed::GetPerformanceFileName(unsigned nID) @@ -2375,7 +2420,7 @@ bool CMiniDexed::DoSetNewPerformance (void) bool CMiniDexed::SavePerformanceNewFile () { - m_bSavePerformanceNewFile = m_PerformanceConfig.GetInternalFolderOk(); + m_bSavePerformanceNewFile = m_PerformanceConfig.GetInternalFolderOk() && m_PerformanceConfig.CheckFreePerformanceSlot(); return m_bSavePerformanceNewFile; } @@ -2404,7 +2449,8 @@ void CMiniDexed::LoadPerformanceParameters(void) { for (unsigned nTG = 0; nTG < CConfig::ToneGenerators; nTG++) { - BankSelectLSB (m_PerformanceConfig.GetBankNumber (nTG), nTG); + + BankSelect (m_PerformanceConfig.GetBankNumber (nTG), nTG); ProgramChange (m_PerformanceConfig.GetVoiceNumber (nTG), nTG); SetMIDIChannel (m_PerformanceConfig.GetMIDIChannel (nTG), nTG); SetVolume (m_PerformanceConfig.GetVolume (nTG), nTG); @@ -2421,6 +2467,24 @@ void CMiniDexed::LoadPerformanceParameters(void) m_nNoteLimitLow[nTG] = m_PerformanceConfig.GetNoteLimitLow (nTG); m_nNoteLimitHigh[nTG] = m_PerformanceConfig.GetNoteLimitHigh (nTG); m_nNoteShift[nTG] = m_PerformanceConfig.GetNoteShift (nTG); + + + + + + + + + + + + + + + + + + if(m_PerformanceConfig.VoiceDataFilled(nTG)) { @@ -2429,6 +2493,7 @@ void CMiniDexed::LoadPerformanceParameters(void) } setMonoMode(m_PerformanceConfig.GetMonoMode(nTG) ? 1 : 0, nTG); + this->SetParameter(TParameter::ParameterCompressorEnable, this->m_PerformanceConfig.GetCompressorEnable()); #if defined(MIXING_CONSOLE_ENABLE) for(size_t fx = 0; fx < MixerOutput::kFXCount; ++fx) @@ -2738,5 +2803,4 @@ unsigned CMiniDexed::getModController (unsigned controller, unsigned parameter, return 0; break; } - } diff --git a/src/performanceconfig.cpp b/src/performanceconfig.cpp index 74cfca4..87f4863 100644 --- a/src/performanceconfig.cpp +++ b/src/performanceconfig.cpp @@ -20,11 +20,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . // +#include #include "performanceconfig.h" #include "mididevice.h" #include -#include -#include +#include + +LOGMODULE ("Performance"); CPerformanceConfig::CPerformanceConfig (FATFS *pFileSystem) : m_Properties ("performance.ini", pFileSystem) @@ -890,8 +892,27 @@ bool CPerformanceConfig::GetInternalFolderOk() return nInternalFolderOk; } +bool CPerformanceConfig::CheckFreePerformanceSlot(void) +{ + if (nLastPerformance < NUM_PERFORMANCES) + { + // There is a free slot... + return true; + } + else + { + return false; + } +} + bool CPerformanceConfig::CreateNewPerformanceFile(void) { + if (nLastPerformance >= NUM_PERFORMANCES) { + // No space left for new performances + LOGWARN ("No space left for new performance"); + return false; + } + std::string sPerformanceName = NewPerformanceName; NewPerformanceName=""; nActualPerformance=nLastPerformance; @@ -972,19 +993,26 @@ bool CPerformanceConfig::ListPerformances() Result = f_findfirst (&Directory, &FileInfo, "SD:/" PERFORMANCE_DIR, "*.ini"); for (unsigned i = 0; Result == FR_OK && FileInfo.fname[0]; i++) { - if (!(FileInfo.fattrib & (AM_HID | AM_SYS))) + if (nLastPerformance >= NUM_PERFORMANCES) { - std::string FileName = FileInfo.fname; - size_t nLen = FileName.length(); - if ( nLen > 8 && nLen <26 && strcmp(FileName.substr(6,1).c_str(), "_")==0) - { - nPIndex=stoi(FileName.substr(0,6)); - if(nPIndex > nLastFileIndex) - { - nLastFileIndex=nPIndex; + LOGNOTE ("Skipping performance %s", FileInfo.fname); + } + else + { + if (!(FileInfo.fattrib & (AM_HID | AM_SYS))) + { + std::string FileName = FileInfo.fname; + size_t nLen = FileName.length(); + if ( nLen > 8 && nLen <26 && strcmp(FileName.substr(6,1).c_str(), "_")==0) + { + nPIndex=stoi(FileName.substr(0,6)); + if(nPIndex > nLastFileIndex) + { + nLastFileIndex=nPIndex; + } + + m_nPerformanceFileName[nLastPerformance++]= FileName; } - - m_nPerformanceFileName[nLastPerformance++]= FileName; } } @@ -993,13 +1021,14 @@ bool CPerformanceConfig::ListPerformances() // sort by performance number-name if (nLastPerformance > 2) { - sort (m_nPerformanceFileName+1, m_nPerformanceFileName + nLastPerformance); // default is always on first place. %%%%%%%%%%%%%%%% + sort (m_nPerformanceFileName+1, m_nPerformanceFileName + nLastPerformance); // default is always on first place. %%%%%%%%%%%%%%%% } } + LOGNOTE ("Number of Performances: %d", nLastPerformance); + return nInternalFolderOk; } - void CPerformanceConfig::SetNewPerformance (unsigned nID) { diff --git a/src/performanceconfig.h b/src/performanceconfig.h index 06731e9..7cd0da7 100644 --- a/src/performanceconfig.h +++ b/src/performanceconfig.h @@ -29,6 +29,7 @@ #include #define NUM_VOICE_PARAM 156 #define PERFORMANCE_DIR "performance" +#define NUM_PERFORMANCES 256 class CPerformanceConfig // Performance configuration { @@ -212,6 +213,7 @@ public: std::string GetNewPerformanceDefaultName(void); void SetNewPerformanceName(std::string nName); bool DeletePerformance(unsigned nID); + bool CheckFreePerformanceSlot(void); private: CPropertiesFatFsFile m_Properties; @@ -251,7 +253,7 @@ private: unsigned nLastFileIndex; unsigned nActualPerformance = 0; //unsigned nMenuSelectedPerformance = 0; - std::string m_nPerformanceFileName[1024]; + std::string m_nPerformanceFileName[NUM_PERFORMANCES]; FATFS *m_pFileSystem; bool nInternalFolderOk=false; diff --git a/src/uimenu.cpp b/src/uimenu.cpp index 0e31b54..7934d17 100644 --- a/src/uimenu.cpp +++ b/src/uimenu.cpp @@ -893,6 +893,7 @@ const CUIMenu::TMenuItem CUIMenu::s_PerformanceMenu[] = {0} }; + CUIMenu::CUIMenu (CUserInterface *pUI, CMiniDexed *pMiniDexed) : m_pUI (pUI), m_pMiniDexed (pMiniDexed), @@ -904,6 +905,23 @@ CUIMenu::CUIMenu (CUserInterface *pUI, CMiniDexed *pMiniDexed) : m_nCurrentMenuDepth (0) { assert(pMiniDexed); +#ifndef ARM_ALLOW_MULTI_CORE + // If there is just one core, then there is only a single + // tone generator so start on the TG1 menu... + m_pParentMenu = s_MainMenu; + m_pCurrentMenu = s_TGMenu; + m_nCurrentMenuItem = 0; + m_nCurrentSelection = 0; + m_nCurrentParameter = 0; + m_nCurrentMenuDepth = 1; + + // Place the "root" menu at the top of the stack + m_MenuStackParent[0] = s_MenuRoot; + m_MenuStackMenu[0] = s_MainMenu; + m_nMenuStackItem[0] = 0; + m_nMenuStackSelection[0] = 0; + m_nMenuStackParameter[0] = 0; +#endif } void CUIMenu::EventHandler (TMenuEvent Event) @@ -926,13 +944,28 @@ void CUIMenu::EventHandler (TMenuEvent Event) break; case MenuEventHome: +#ifdef ARM_ALLOW_MULTI_CORE m_pParentMenu = s_MenuRoot; m_pCurrentMenu = s_MainMenu; m_nCurrentMenuItem = 0; m_nCurrentSelection = 0; m_nCurrentParameter = 0; m_nCurrentMenuDepth = 0; - +#else + // "Home" is the TG0 menu if only one TG active + m_pParentMenu = s_MainMenu; + m_pCurrentMenu = s_TGMenu; + m_nCurrentMenuItem = 0; + m_nCurrentSelection = 0; + m_nCurrentParameter = 0; + m_nCurrentMenuDepth = 1; + // Place the "root" menu at the top of the stack + m_MenuStackParent[0] = s_MenuRoot; + m_MenuStackMenu[0] = s_MainMenu; + m_nMenuStackItem[0] = 0; + m_nMenuStackSelection[0] = 0; + m_nMenuStackParameter[0] = 0; +#endif EventHandler (MenuEventUpdate); break; @@ -954,12 +987,17 @@ void CUIMenu::MenuHandler (CUIMenu *pUIMenu, TMenuEvent Event) pUIMenu->m_MenuStackParent[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_pParentMenu; pUIMenu->m_MenuStackMenu[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_pCurrentMenu; pUIMenu->m_nMenuStackItem[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_nCurrentMenuItem; + pUIMenu->m_nMenuStackSelection[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_nCurrentSelection; + pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth] = pUIMenu->m_nCurrentParameter; + pUIMenu->m_nCurrentMenuDepth++; pUIMenu->m_pParentMenu = pUIMenu->m_pCurrentMenu; + pUIMenu->m_nCurrentParameter = pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].Parameter; + pUIMenu->m_pCurrentMenu = pUIMenu->m_pCurrentMenu[pUIMenu->m_nCurrentSelection].MenuItem; pUIMenu->m_nCurrentMenuItem = pUIMenu->m_nCurrentSelection; pUIMenu->m_nCurrentSelection = 0; @@ -1092,7 +1130,6 @@ void CUIMenu::EditVoiceBankNumber (CUIMenu *pUIMenu, TMenuEvent Event) void CUIMenu::EditProgramNumber (CUIMenu *pUIMenu, TMenuEvent Event) { unsigned nTG = pUIMenu->m_nMenuStackParameter[pUIMenu->m_nCurrentMenuDepth-1]; - int nHighestBank = pUIMenu->m_pMiniDexed->GetSysExFileLoader ()->GetNumHighestBank(); int nValue = pUIMenu->m_pMiniDexed->GetTGParameter (CMiniDexed::TTGParameter::TGParameterProgram, nTG); @@ -1107,11 +1144,7 @@ void CUIMenu::EditProgramNumber (CUIMenu *pUIMenu, TMenuEvent Event) // Switch down a voice bank and set to the last voice nValue = CSysExFileLoader::VoicesPerBank-1; int nVB = pUIMenu->m_pMiniDexed->GetTGParameter(CMiniDexed::TTGParameter::TGParameterVoiceBank, nTG); - if (--nVB < 0) - { - // Wrap around to last loaded bank - nVB = nHighestBank; - } + nVB = pUIMenu->m_pMiniDexed->GetSysExFileLoader ()->GetNextBankDown(nVB); pUIMenu->m_pMiniDexed->SetTGParameter (CMiniDexed::TTGParameter::TGParameterVoiceBank, nVB, nTG); } pUIMenu->m_pMiniDexed->SetTGParameter (CMiniDexed::TTGParameter::TGParameterProgram, nValue, nTG); @@ -1123,11 +1156,7 @@ void CUIMenu::EditProgramNumber (CUIMenu *pUIMenu, TMenuEvent Event) // Switch up a voice bank and reset to voice 0 nValue = 0; int nVB = pUIMenu->m_pMiniDexed->GetTGParameter(CMiniDexed::TTGParameter::TGParameterVoiceBank, nTG); - if (++nVB > (int) nHighestBank) - { - // Wrap around to first bank - nVB = 0; - } + nVB = pUIMenu->m_pMiniDexed->GetSysExFileLoader ()->GetNextBankUp(nVB); pUIMenu->m_pMiniDexed->SetTGParameter (CMiniDexed::TTGParameter::TGParameterVoiceBank, nVB, nTG); } pUIMenu->m_pMiniDexed->SetTGParameter (CMiniDexed::TTGParameter::TGParameterProgram, nValue, nTG); @@ -2145,5 +2174,3 @@ void CUIMenu::EditTGParameterModulation (CUIMenu *pUIMenu, TMenuEvent Event) nValue > rParam.Minimum, nValue < rParam.Maximum); } - -