Skip to content

Commit

Permalink
VLC-Plugin: Added ability to enable/disable plugin
Browse files Browse the repository at this point in the history
VLC has no embedded way to switch different MIDI plugins (or different codecs of the same format), therefore it's need to reject playing from the codec itself when it's not needed.
  • Loading branch information
Wohlstand committed Jan 6, 2019
1 parent 43fdc92 commit 25c48a9
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions utils/vlc_codec/libadlmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@

#include <adlmidi.h>

#define ENABLE_CODEC_TEXT N_("Enable this synthesizer")
#define ENABLE_CODEC_LONGTEXT N_( \
"Enable using of this synthesizer, otherwise, other MIDI synthesizers will be used")

#define FMBANK_TEXT N_("Custom bank file")
#define FMBANK_LONGTEXT N_( \
"Custom bank file (in WOPL format) to use for software synthesis." )
Expand Down Expand Up @@ -122,6 +126,9 @@ vlc_module_begin ()
set_subcategory (SUBCAT_INPUT_ACODEC)
set_callbacks (Open, Close)

add_bool( CONFIG_PREFIX "enable", true, ENABLE_CODEC_TEXT,
ENABLE_CODEC_LONGTEXT, false )

embedded_bank_count = adl_getBanksCount();
for (embedded_bank_i = 0; embedded_bank_i < embedded_bank_count; embedded_bank_i++)
embedded_bank_values[embedded_bank_i] = embedded_bank_i;
Expand All @@ -138,7 +145,7 @@ 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 "emulator-type", 0, EMULATOR_TYPE_TEXT, EMULATOR_TYPE_LINGTEXT, true)
add_integer (CONFIG_PREFIX "emulator-type", 0, EMULATOR_TYPE_TEXT, EMULATOR_TYPE_LINGTEXT, false)
change_integer_list( emulator_type_values, emulator_type_descriptions )

add_integer (CONFIG_PREFIX "emulated-chips", 6, EMULATED_CHIPS_TEXT, EMULATED_CHIPS_LONGTEXT, true)
Expand All @@ -148,10 +155,10 @@ vlc_module_begin ()
change_integer_range (22050, 96000)

add_bool( CONFIG_PREFIX "full-range-brightness", false, FULL_RANGE_CC74_TEXT,
FULL_RANGE_CC74_LONGTEXT, false )
FULL_RANGE_CC74_LONGTEXT, true )

add_bool( CONFIG_PREFIX "full-panning", false, FULL_PANNING_TEXT,
FULL_PANNING_LONGTEXT, false )
add_bool( CONFIG_PREFIX "full-panning", true, FULL_PANNING_TEXT,
FULL_PANNING_LONGTEXT, true )

vlc_module_end ()

Expand Down Expand Up @@ -185,6 +192,9 @@ static int Open (vlc_object_t *p_this)
if (p_dec->fmt_in.i_codec != VLC_CODEC_MIDI)
return VLC_EGENERIC;

if (!var_InheritBool(p_this, CONFIG_PREFIX "enable"))
return VLC_EGENERIC;

decoder_sys_t *p_sys = malloc (sizeof (*p_sys));
if (unlikely(p_sys == NULL))
return VLC_ENOMEM;
Expand Down

0 comments on commit 25c48a9

Please sign in to comment.