From 8e3a15f9ae5a382807e4f3590570574990f43c7a Mon Sep 17 00:00:00 2001 From: Holger Wirtz Date: Fri, 24 Apr 2020 11:48:40 +0200 Subject: [PATCH] Fixes for multi-instance. --- MicroDexed.ino | 28 ++++++++++++++++++---------- config.h | 8 ++++---- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/MicroDexed.ino b/MicroDexed.ino index d996c9d..9913359 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -1322,16 +1322,6 @@ void init_configuration(void) configuration.dexed[instance_id].pan = PANORAMA_DEFAULT; configuration.dexed[instance_id].transpose = TRANSPOSE_DEFAULT; configuration.dexed[instance_id].tune = TUNE_DEFAULT; - -#if NUM_DEXED > 1 - configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT / 2; -#else - if (instance_id == 0) - configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT; - else - configuration.dexed[instance_id].polyphony = 0; -#endif - configuration.dexed[instance_id].velocity_level = VELOCITY_LEVEL_DEFAULT; configuration.dexed[instance_id].engine = ENGINE_DEFAULT; configuration.dexed[instance_id].monopoly = MONOPOLY_DEFAULT; @@ -1358,7 +1348,25 @@ void init_configuration(void) configuration.performance.bank[instance_id] = SYSEXBANK_DEFAULT; configuration.performance.voice[instance_id] = SYSEXSOUND_DEFAULT; +#if NUM_DEXED > 1 + configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT / 2; +#else + if (instance_id == 0) + { + configuration.dexed[instance_id].polyphony = POLYPHONY_DEFAULT; + } + else + { + configuration.dexed[instance_id].polyphony = 0; + } +#endif + +#if NUM_DEXED > 1 MicroDexed[instance_id]->controllers.refresh(); +#else + if (instance_id == 0) + MicroDexed[instance_id]->controllers.refresh(); +#endif } set_volume(configuration.sys.vol, configuration.sys.mono); diff --git a/config.h b/config.h index 9b3c6ee..2138b2a 100644 --- a/config.h +++ b/config.h @@ -577,9 +577,9 @@ typedef struct fx_s { } fx_t; typedef struct performance_s { - uint8_t bank[NUM_DEXED]; - uint8_t voice[NUM_DEXED]; - uint8_t voiceconfig_number[NUM_DEXED]; + uint8_t bank[MAX_DEXED]; + uint8_t voice[MAX_DEXED]; + uint8_t voiceconfig_number[MAX_DEXED]; uint8_t fx_number; } performance_t; @@ -595,7 +595,7 @@ typedef struct configuration_s { sys_t sys; fx_t fx; performance_t performance; - dexed_t dexed[NUM_DEXED]; + dexed_t dexed[MAX_DEXED]; uint32_t _marker_; } config_t;