Disable Mixer

Hi

I had a switch to enable / disable mixer in playback options
This is not perfect, and you may to restart volumio to fully apply … But this is working :slight_smile:
I mis something, but for a first attempt not so bad

I had a description in /volumio/app/i18n/strings_xx.json to fit with my own langauge

Modify /volumio/app/plugins/audio_interface/alsa_controller/UIConfig.json
add "enable_volume in
{
“id”: “volume_options”,
“element”: “section”,
“label”: “TRANSLATE.PLAYBACK_OPTIONS.VOLUME_OPTIONS”,
“icon”: “fa-volume-up”,
“onSave”: {“type”:“controller”, “endpoint”:“audio_interface/alsa_controller”, “method”:“saveVolumeOptions”},
“saveButton”: {
“label”: “TRANSLATE.COMMON.SAVE”,
“data”: [
“mixer_type”,
“mixer”,
“volumestart”,
“volumemax”,
“volumesteps”,
“volumecurvemode” ,
“enable_volume”

add

   "visibleIf": {
            "field": "enable_volume",
            "value": true
      },

,
for each field of volume option

add the swith at the end of volume option
{
“id”: “enable_volume”,
“element”: “switch”,
“doc”: “Enable or disable Volume control”,
“label”: “TRANSLATE.PLAYBACK_OPTIONS.VOLUME_ENABLE”,
“value”: true
}

modify /volumio/app/plugins/audio_interface/alsa_controller/ndex.js

in ControllerAlsa.prototype.saveVolumeOptions add :
self.setConfigParam({key: ‘volumesteps’, value: data.volumesteps.value});
if (data.enable_volume) {
// this.logger.info(‘Enable value : true’);
}
else {
//this.logger.info(‘Enable value : False’);
data.mixer_type.value = ‘None’;
this.logger.info('mixre typ : ’ + data.mixer_type.value);
}

if (data.mixer_type.value === ‘Hardware’) {
self.setConfigParam({key: ‘mixer’, value: data.mixer.value});
} else if (data.mixer_type.value === ‘Software’) {
var outdevice = self.config.get(‘outputdevice’);
self.enableSoftMixer(outdevice);
} else if (data.mixer_type.value === ‘None’){
self.setConfigParam({key: ‘mixer’, value: ‘’});
var outdevice = self.config.get(‘outputdevice’);
this.logger.info("Output device : "+ outdevice);
this.logger.info(‘softvolumenomber :’ + self.config.get(‘softvolumenumber’));
//if (outdevice == undefined){
var outdevice = self.config.get(‘softvolumenumber’);
if (outdevice == undefined){
outdevice = 0;
}

//}
self.commandRouter.sharedVars.set(‘alsa.outputdevice’, outdevice);

modifiy in ControllerAlsa.prototype.getUIConfig

                    if (activemixer_type === 'None') {

                            self.configManager.pushUIConfigParam(uiconf, 'sections[2].content[0].options', {
                                    value: 'None',
                                    label: self.commandRouter.getI18nString('COMMON.NONE')
                            });

                            self.configManager.pushUIConfigParam(uiconf, 'sections[2].content[0].options', {
                                    value: 'Hardware',
                                    label: 'Hardware'
                            });

                            self.configManager.pushUIConfigParam(uiconf, 'sections[2].content[0].options', {
                                    value: 'Software',
                                    label: 'Software'
                            });

                            self.configManager.setUIConfigParam(uiconf, 'sections[2].content[0].value', {
                                    value: 'None',
                                    label: self.commandRouter.getI18nString('COMMON.NONE')
                            });

                          [b]  self.configManager.setUIConfigParam(uiconf, 'sections[2].content[6].value', {
                                    value: false
                            })[/b];

Could be more elegant and efficient … But Works… And even if i have to restart volumio … I don’t change this parameter every days

Could be better
When rectivated mixer => You have to chose hardaware or software, save and chose the name of Mixer
Save button actio not alwaay clear at screen (in logfiles this is fine)
Add all languages

if can help somebody provide my index.js as sample

Regrads