Soft Pause / Soft Resume / Soft Volume Changes

Cool stuff you can do with MPD. A place for you to put your hacks and patches, or be inspired by others'.
Post Reply
Zaaphod
Posts: 2
Joined: February 12th, 2015, 12:00 pm

Soft Pause / Soft Resume / Soft Volume Changes

Post by Zaaphod » February 12th, 2015, 12:11 pm

Is there a way I could hack MPD to achieve soft pause, soft resume, and soft volume changes?

I have a very high powered system and if I need to pause playback to answer the phone or something, then forget to turn it down, the shock of it suddenly playing at a loud volume is very annoying. Instead, when it gets a signal to pause, I would like it to quickly turn down the volume, maybe get down to 0 in 1 second or so, then pause, then when I resume, go from 0 to wherever it was very gradually, perhaps taking as much as 10 seconds.

I would also like to use these delays for volume increases and decreases, so when increasing the volume it does so very slowly, but decreasing it is fairly quick. this would eliminate the sudden volume fluxuations that happen when you get when trying to adjust the volume with something like cell phone app.. if it's gradually increasing, and starts to get too loud you could back it off... elegantly

I would like this to be something MPD did fundamentally on its own, so the rates at which it increased / decreased the volume would be consistent no matter what client I am using to control it.

max
Forum team
Posts: 854
Joined: January 15th, 2013, 3:43 pm

Re: Soft Pause / Soft Resume / Soft Volume Changes

Post by max » February 12th, 2015, 12:27 pm

This feature has been requested, but has not yet been implemented. You are welcome to give it a try, but beware: the player thread is the most complicated piece of code inside MPD, and it has resisted several attempts by volunteers to get it implemented.

Zaaphod
Posts: 2
Joined: February 12th, 2015, 12:00 pm

Re: Soft Pause / Soft Resume / Soft Volume Changes

Post by Zaaphod » February 12th, 2015, 2:10 pm

Thanks for the warning :) The logic for doing this isn't all that difficult, however, figuring out where to put it in an unfamiliar project is another thing altogether, I wouldn't even know which files to open to get started and on top of that making it useful could get quite involved as there are some variables that need to be configured and made so users can adjust the timings (enable feature, rate to turn down, rate to turn up, and minimum volume before pause).

I was hoping I could possibly stick this in whatever was responsible for sending and receiving commands to clients.. just fix it that when it receives a pause command, it issues it's own volume change commands before the pause... something like that. but I have absolutely no idea where to look for that part of things...

It's probably best that I leave it to those who are already familiar with the project.

Post Reply