From 48ec16f3d2a04295767b6bac38aed7bef5180881 Mon Sep 17 00:00:00 2001 From: Wohlstand Date: Wed, 29 Jun 2022 18:27:00 +0300 Subject: Added the chip channels allocation mode option --- utils/midiplay/adlmidiplay.cpp | 34 +++++++++++++++++++++++++++++++++- utils/vlc_codec/libadlmidi.c | 19 +++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) (limited to 'utils') diff --git a/utils/midiplay/adlmidiplay.cpp b/utils/midiplay/adlmidiplay.cpp index ae90187..dafad8a 100644 --- a/utils/midiplay/adlmidiplay.cpp +++ b/utils/midiplay/adlmidiplay.cpp @@ -231,6 +231,25 @@ const char* volume_model_to_str(int vm) } } +const char* chanalloc_to_str(int vm) +{ + switch(vm) + { + default: + case ADLMIDI_ChanAlloc_AUTO: + return ""; + + case ADLMIDI_ChanAlloc_OffDelay: + return "Off Delay"; + + case ADLMIDI_ChanAlloc_SameInst: + return "Same instrument"; + + case ADLMIDI_ChanAlloc_AnyReleased: + return "Any released"; + } +} + static bool is_number(const std::string &s) { @@ -485,6 +504,7 @@ int main(int argc, char **argv) int loopEnabled = 1; #endif int autoArpeggioEnabled = 0; + int chanAlloc = ADLMIDI_ChanAlloc_AUTO; #ifndef HARDWARE_OPL3 int emulator = ADLMIDI_EMU_NUKED; @@ -590,12 +610,22 @@ int main(int argc, char **argv) { if(argc <= 3) { - printError("The option --solo requires an argument!\n"); + printError("The option -vm requires an argument!\n"); return 1; } volumeModel = std::strtol(argv[3], NULL, 10); had_option = true; } + else if(!std::strcmp("-ca", argv[2])) + { + if(argc <= 3) + { + printError("The option -carequires an argument!\n"); + return 1; + } + chanAlloc = std::strtol(argv[3], NULL, 10); + had_option = true; + } else if(!std::strcmp("--solo", argv[2])) { if(argc <= 3) @@ -646,6 +676,7 @@ int main(int argc, char **argv) #endif adl_setAutoArpeggio(myDevice, autoArpeggioEnabled); + adl_setChannelAllocMode(myDevice, chanAlloc); #ifdef DEBUG_TRACE_ALL_EVENTS //Hook all MIDI events are ticking while generating an output buffer @@ -828,6 +859,7 @@ int main(int argc, char **argv) std::fprintf(stdout, " - Number of four-ops %d\n", adl_getNumFourOpsChnObtained(myDevice)); std::fprintf(stdout, " - Track count: %lu\n", static_cast(adl_trackCount(myDevice))); std::fprintf(stdout, " - Volume model: %s\n", volume_model_to_str(adl_getVolumeRangeModel(myDevice))); + std::fprintf(stdout, " - Channel allocation mode: %s\n", chanalloc_to_str(adl_getChannelAllocMode(myDevice))); if(soloTrack != ~static_cast(0)) { diff --git a/utils/vlc_codec/libadlmidi.c b/utils/vlc_codec/libadlmidi.c index 5ce054f..278233f 100644 --- a/utils/vlc_codec/libadlmidi.c +++ b/utils/vlc_codec/libadlmidi.c @@ -77,6 +77,10 @@ #define VOLUME_MODEL_LONGTEXT N_( \ "Declares volume scaling model which will affect volume levels.") +#define CHANNEL_ALLOCATION_TEXT N_("Channel allocation mode") +#define CHANNEL_ALLOCATION_LONGTEXT N_( \ + "Declares the method of chip channel allocation for new notes.") + #define FULL_RANGE_CC74_TEXT N_("Full-range of brightness") #define FULL_RANGE_CC74_LONGTEXT N_( \ "Scale range of CC-74 \"Brightness\" with full 0~127 range. By default is only 0~64 affects the sounding.") @@ -103,6 +107,16 @@ static const char * const volume_models_descriptions[] = NULL }; +static const int channel_alloc_values[] = { -1, 0, 1, 2 }; +static const char * const channel_alloc_descriptions[] = +{ + N_("Auto (defined by bank)"), + N_("By sounding delays"), + N_("Released channel of same instrument"), + N_("Any released channel"), + NULL +}; + #define EMULATOR_TYPE_TEXT N_("OPL3 Emulation core") #define EMULATOR_TYPE_LINGTEXT N_( \ "OPL3 Emulator that will be used to generate final sound.") @@ -157,6 +171,9 @@ vlc_module_begin () add_integer (CONFIG_PREFIX "volume-model", 0, VOLUME_MODEL_TEXT, VOLUME_MODEL_LONGTEXT, false ) change_integer_list( volume_models_values, volume_models_descriptions ) + add_integer (CONFIG_PREFIX "channel-allocation", -1, CHANNEL_ALLOCATION_TEXT, CHANNEL_ALLOCATION_LONGTEXT, false ) + change_integer_list( channel_alloc_values, channel_alloc_descriptions ) + add_integer (CONFIG_PREFIX "emulator-type", 0, EMULATOR_TYPE_TEXT, EMULATOR_TYPE_LINGTEXT, false) change_integer_list( emulator_type_values, emulator_type_descriptions ) @@ -223,6 +240,8 @@ static int Open (vlc_object_t *p_this) adl_setVolumeRangeModel(p_sys->synth, var_InheritInteger(p_this, CONFIG_PREFIX "volume-model")); + adl_setChannelAllocMode(p_sys->synth, var_InheritInteger(p_this, CONFIG_PREFIX "channel-allocation")); + adl_setSoftPanEnabled(p_sys->synth, var_InheritBool(p_this, CONFIG_PREFIX "full-panning")); adl_setFullRangeBrightness(p_sys->synth, var_InheritBool(p_this, CONFIG_PREFIX "full-range-brightness")); -- cgit v1.2.3