Skip to content

SW volume control improvement in case of DAC off-on or unplug-plug wout HW mixer#208

Open
csutihu wants to merge 2 commits into
volumio:masterfrom
csutihu:volume_control_improvement_of_SW_mixer
Open

SW volume control improvement in case of DAC off-on or unplug-plug wout HW mixer#208
csutihu wants to merge 2 commits into
volumio:masterfrom
csutihu:volume_control_improvement_of_SW_mixer

Conversation

@csutihu

@csutihu csutihu commented Feb 18, 2025

Copy link
Copy Markdown

Dear Developers,

Please review my pull request. I have made the following changes to the volumecontrol.js file:

Issue: Addressed an issue where volume control was not functioning correctly when a DAC was turned off and on, or unplugged and plugged back in, without a hardware mixer. (default volume level = 100%)
Solution: Implemented logic to ensure proper volume control functionality in these scenarios.
Testing: Thoroughly tested the changes by simulating DAC off/on and unplug/plug events, confirming that volume control now works as expected.

https://community.volumio.com/t/sw-mixer-volume-level-after-external-dac-off-on/71222

Comment thread app/volumecontrol.js Outdated
self.logger.error('Cannot set ALSA Volume: ' + err);
}
});
var startupVolume = this.commandRouter.executeOnPlugin('audio_interface', 'alsa_controller', 'getConfigParam', 'volumestart');

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally:

  • You will use the function already there: self.setStartupVolume();
  • Create a condition only for software volume, if volume none it should go to 100

Thanks for your contribution!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, I will come back soon

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to fix it.
Prev version:

  if (data.mixertype !== undefined && mixertype !== 'None' && mixer !== undefined && mixer.length && (data.mixertype === 'None' || data.mixertype === 'Software')) {
    var startupVolume = this.commandRouter.executeOnPlugin('audio_interface', 'alsa_controller', 'getConfigParam', 'volumestart');
    if (startupVolume !== 'disabled') {
        self.setVolume(parseInt(startupVolume), function (err) {
            if (err) {
                self.logger.error('Cannot set ALSA Volume: ' + err);
            }
        });
    } else {
        self.setVolume(30, function (err) {
            if (err) {
                self.logger.error('Cannot set ALSA Volume: ' + err);
            }
        });
    }
  }

changed to:

  if (data.mixertype !== undefined && mixertype !== 'None' && mixer !== undefined && mixer.length) {
    if (data.mixertype === 'Software') {
        setTimeout(() => {
          self.setStartupVolume();
  //        self.logger.info('new mixertye handling - setstartupvolume');
        }, 5000);
    } else if (data.mixertype === 'None') {
        self.setVolume(100, function (err) {
            if (err) {
                self.logger.error('Cannot set ALSA Volume: ' + err);
            }
        });
    }
  }

optimization of handling sw mixertype updateVolumeSettings
@csutihu

csutihu commented Mar 6, 2025

Copy link
Copy Markdown
Author

I would like to kindly ask if any further modifications are needed from me? Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants