diff --git a/MicroDexed.ino b/MicroDexed.ino index 3a4435b..ef83321 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -889,6 +889,49 @@ void loop() #endif } +/****************************************************************************** + MIDI HELPER +******************************************************************************/ +bool checkMidiChannel(byte inChannel, uint8_t instance_id) +{ + // check for MIDI channel + if (configuration.dexed[instance_id].midi_channel == MIDI_CHANNEL_OMNI) + { + return (true); + } + else if (inChannel != configuration.dexed[instance_id].midi_channel) + { +#ifdef DEBUG + Serial.print(F("INSTANCE ")); + Serial.print(instance_id, DEC); + Serial.print(F(": Ignoring MIDI data on channel ")); + Serial.print(inChannel); + Serial.print(F("(listening on ")); + Serial.print(configuration.dexed[instance_id].midi_channel); + Serial.println(F(")")); +#endif + return (false); + } + return (true); +} + +void init_MIDI_send_CC(void) +{ +#ifdef DEBUG + Serial.println("init_MIDI_send_CC():"); +#endif + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 7, configuration.dexed[selected_instance_id].sound_intensity); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 10, configuration.dexed[selected_instance_id].pan); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 91, configuration.fx.reverb_send[selected_instance_id]); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 93, configuration.fx.chorus_level[selected_instance_id]); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 94, configuration.dexed[selected_instance_id].tune); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 103, configuration.fx.filter_resonance[selected_instance_id]); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 104, configuration.fx.filter_cutoff[selected_instance_id]); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 105, configuration.fx.delay_time[selected_instance_id]); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 106, configuration.fx.delay_feedback[selected_instance_id]); + MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 107, configuration.fx.delay_level[selected_instance_id]); +} + /****************************************************************************** MIDI MESSAGE HANDLER ******************************************************************************/ @@ -1077,7 +1120,6 @@ void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity) } } - #if defined(USE_EPIANO) if (configuration.epiano.midi_channel == MIDI_CHANNEL_OMNI || configuration.epiano.midi_channel == inChannel) { @@ -1775,20 +1817,6 @@ void handleClock(void) midi_bpm_counter++; } -void dac_mute(void) -{ - sgtl5000.lineOutLevel(0.0); - sgtl5000.dacVolume(0.0); - sgtl5000.volume(0.0, 0.0); // Headphone volume -} - -void dac_unmute(void) -{ - sgtl5000.lineOutLevel(SGTL5000_LINEOUT_LEVEL); - sgtl5000.dacVolume(1.0); - sgtl5000.volume(SGTL5000_HEADPHONE_VOLUME, SGTL5000_HEADPHONE_VOLUME); // Headphone volume -} - void handleStart(void) { midi_bpm_timer = 0; @@ -1828,52 +1856,22 @@ void handleSystemReset(void) } /****************************************************************************** - MIDI HELPER + VOLUME HELPER ******************************************************************************/ -bool checkMidiChannel(byte inChannel, uint8_t instance_id) +void dac_mute(void) { - // check for MIDI channel - if (configuration.dexed[instance_id].midi_channel == MIDI_CHANNEL_OMNI) - { - return (true); - } - else if (inChannel != configuration.dexed[instance_id].midi_channel) - { -#ifdef DEBUG - Serial.print(F("INSTANCE ")); - Serial.print(instance_id, DEC); - Serial.print(F(": Ignoring MIDI data on channel ")); - Serial.print(inChannel); - Serial.print(F("(listening on ")); - Serial.print(configuration.dexed[instance_id].midi_channel); - Serial.println(F(")")); -#endif - return (false); - } - return (true); + sgtl5000.lineOutLevel(0.0); + sgtl5000.dacVolume(0.0); + sgtl5000.volume(0.0, 0.0); // Headphone volume } -void init_MIDI_send_CC(void) +void dac_unmute(void) { -#ifdef DEBUG - Serial.println("init_MIDI_send_CC():"); -#endif - MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 7, configuration.dexed[selected_instance_id].sound_intensity); - MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 10, configuration.dexed[selected_instance_id].pan); - MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 91, configuration.fx.reverb_send[selected_instance_id]); - MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 93, configuration.fx.chorus_level[selected_instance_id]); - MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 94, configuration.dexed[selected_instance_id].tune); - MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 103, configuration.fx.filter_resonance[selected_instance_id]); - MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 104, configuration.fx.filter_cutoff[selected_instance_id]); - MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 105, configuration.fx.delay_time[selected_instance_id]); - MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 106, configuration.fx.delay_feedback[selected_instance_id]); - MD_sendControlChange(configuration.dexed[selected_instance_id].midi_channel, 107, configuration.fx.delay_level[selected_instance_id]); + sgtl5000.lineOutLevel(SGTL5000_LINEOUT_LEVEL); + sgtl5000.dacVolume(1.0); + sgtl5000.volume(SGTL5000_HEADPHONE_VOLUME, SGTL5000_HEADPHONE_VOLUME); // Headphone volume } -/****************************************************************************** - VOLUME HELPER -******************************************************************************/ - void set_drums_volume(float vol) { master_mixer_r.gain(MASTER_MIX_CH_DRUMS, vol); diff --git a/config.h b/config.h index a202609..e7fb539 100644 --- a/config.h +++ b/config.h @@ -914,7 +914,6 @@ typedef struct performance_s { typedef struct drums_s { uint8_t vol; - bool smartfilter; } drum_t; typedef struct configuration_s { @@ -926,7 +925,6 @@ typedef struct configuration_s { fx_t fx; } config_t; - enum master_mixer_ports { MASTER_MIX_CH_DEXED2, MASTER_MIX_CH_DEXED1,