Bug 9804 - Fixed volume with pseudo volume showing
: Fixed volume with pseudo volume showing
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Audio
: 7.2.1
: PC Windows XP
: -- enhancement (vote)
: Future
Assigned To: Unassigned bug - please assign me!
http://forums.slimdevices.com/showthr...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-10-24 14:55 UTC by Barry Gordon
Modified: 2009-10-16 15:45 UTC (History)
3 users (show)

See Also:
Category: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barry Gordon 2008-10-24 14:55:25 UTC
This is not a bug report, but a request for a change/new capability

Background. In my listening room / Theater I have the transporter and a 7.1 channel sound system at audiophile quality. I own and have ripped to flac a lot of DTS encoded CD's. 

To play an encoded CD the volume of the slim systems must be set to 100 or the encoded stream will be modified and not be heard. There is a squeezecenter player option to hold the volume fixed at 100 and that is good but causes another problem

The IR blaster plgin has no issue as it puts out signals for Volume change Up and volume change Down. These can be used to instruct the preamp to change the gain af the stream after decoding by a fixed percentage.

The XAP plugin which is the one I want to use, sends back the absolute volume value avery time it is "changed", e.g. when I send a CLI command to change the volume by +/- n units. On the Transporter the result is always 100 units as per the prior discussion re encoded streams and volume sttings.

What I would like to see is the ability to set the Digital output to be fixed at 100 (maximum) but that the system display the "volume" as it is changed by requests to do so. If done the way I have in mind, the volume display would show a pseudo volume between 0 and 100 which is what the preamp might want to see, but the encoded digital output would always be at full volume. The XAP plugin would then report the Pseudo volume over the network and various networked subsystems could adjust the volume after decoding.

Having the stereo outputs running at the true volume would be fine, so perhaps the easiest implementation is that somehow the signal for the digital output always be taken before volume modification, in fact before any mixer operations at all if so requested.  If this could be done by detecting that the stream is encoded that would be even better.

Thanks
Comment 1 KDF 2008-10-24 16:04:57 UTC
linking with forum thread and clearing target for assignment post-review.
Comment 2 Peter Watkins 2009-02-02 19:34:38 UTC
I think the "true" device output should be separate from the "displayed" volume such that 3rd party code could alter one without changing the other. This would also benefit owners of gear like the Denon network-enabled receivers that have a TCP/IP CLI for setting and obtaining info.

Architecturally, I'm thinking
 1) have two prefs, "volume" and "displayVolume"
 2) add a new mixer subcommand, displayvolume
 3) all UIs -- web, SqueezePlay, VFD/player -- would display the displayVolume setting rather than the actual device output
 4) volume change mechanisms would continue to call the "mixer volume" command to effect changes, and would offer up/down controls so long as 0 < displayvolume < 100
 5) the "mixer volume" command would by default execute the "mixer displayvolume" command to keep the two prefs in sync so that the displayed volume is accurate

Third-party code could then intercept both "mixer volume" and "mixer displayvolume" commands. A plugin for Denon network gear, for instance, might set the true volume at 100, translate "mixer volume" into Denon commands, and execute "mixer displayvolume" to set the display pref to match the current receiver state.

Third party code interacting with dumb gear -- like IR Blaster with an amp that only receives IR commands -- might be able to approximate the correct displayvolume, and make sure the volume was always > 0 and < 100 so that volume control mechanisms would still offer volume up / volume down options, and still send mixer volume +N/mixer volume -N commands.
Comment 3 Joerg Schwieder 2009-03-15 17:25:01 UTC
I would suggest to run this the other way 'round:
Use "mixer volume" as the volume that is being displayed and add an additional "output volume" that can or can not be linked to the mixer volume.

That way you will not need to change any apps that currently use "mixer volume" since the change would be transparent to them.
Comment 4 Peter Watkins 2009-04-29 21:34:29 UTC
I've started fiddling with this. Here's what I'm working towards:
 - adding a new CLI command, 'output' 'volume', that's responsible for changing the player volume and, by extension, updating the "volume" server pref
 - leaving 'mixer' 'volume' pretty much as-is...

...the current official code has 'mixer' 'volume' directly calling a client method that changes the volume on the player, e.g. $client->volume($newvalue). In my approach, 'mixer' 'volume' would execute the CLI 'output' 'volume', and the default implementation of 'output' 'volume' merely calls $client->volume($newvalue). 

Performance looks good. On a Core 2 Duo running around 800 MHz, the new command seems to add about 0.05 to 0.10 milliseconds (yes, milliseconds) to the time required to change the volume. (Actually changing the player volume, with the existing client method, takes 3 times that long, with the SB3 player connected over 802.11g.)

So if you wanted to set the player's real output at 100% and manipulate the volume on the amp via serial or network protocols, you'd write a plugin that "intercepts" 'output' 'volume' (probably with addDispatch). Every time a user requested a volume change with the IR remote, web UI, Controller, third-party app like Moose, etc., those change requests would go to 'mixer' 'volume'. 'mixer' 'volume' would decide what the 0-100 new volume should be, and would ask 'output' 'volume' to make that change. The plugin would prevent the normal client method that changes actual player output from running, and would trigger whatever needs to happen to change the actual amp volume. And the plugin would change the "volume" pref that SqueezeCenter uses for displaying what it thinks is the current player volume -- probably to whatever 'mixer' 'volume' thought it should be. A good plugin would also detect changes made to the amp volume by other means and update the "volume" pref in SqueezeCenter so it remains accurate. For instance, if the Squeezebox player had an IR sensor (as the Classic/SB3 does) and saw an IR code it recognized as an IR command for amp volume, it might query the amp for its volume and update the SC pref. The plugin might also periodically poll the amp to see if the volume had changed some other way -- maybe an IR command the Squeezebox didn't see, maybe someone using the volume knob on the amp itself.

How does that sound to you all?

Something similar might need to be done for the $client->fade_volume() API that's used when muting, but maybe not -- a plugin could intercept 'mixer' 'muting' and handle that on its own.

I see this having utility beyond playing music with a Squeezbox. In my AV system, most of my gear is pretty well hidden. And the Squeezebox volume display is easier to read than the volume display on most amps/receivers -- especially those that have a tiny dot on a big black knob. It'd be nice if I could use my Squeezebox to change the volume while watching a movie or TV with the audio piped through the stereo receiver.
Comment 5 Barry Gordon 2009-04-30 04:21:14 UTC
My specific problem has been solved by the xAP plugin.  That plugin sends standard xAP protocol messages on multiple Squeezecenter state changes.  The ones I use are power on off, Volume Up/Down and the absolute value of the mixer volume not the forced 100.

The system that controls my Home theater then receives these messages and deals with the Audio processor over RS232.  It is working perfectly for me.  What is nice is that it does not matter how you change things (remote, web, Transporter panel) the xAP messages always track the player state. 

The use of the xAP plugin with its state messages is a very fast easy way to deal with all sorts of event changes, by player, if you have a PC based control system for controlling audio components.
Comment 6 Peter Watkins 2009-04-30 15:20:39 UTC
Hmm, maybe I'm overthinking it. Maybe the solution is as simple as
 - intercept mixer volume and mixer muting
 - for players NOT using the amp volume control, run the real mixer command
 - for players that do use amp volume control, never call $client->volume(), just adjust the amp volume via RS232, TCP, whatever, and set the 'volume' pref for the player so that the VFD, web, and Controller interfaces show the amp's volume
Maybe that's all that the xAP plugin is doing.
Comment 7 Peter Watkins 2009-05-02 11:49:13 UTC
I think SC does have to change for this to work well with SC 7.4. I can come close to what I want by doing something like this instead of executing the real mixer volume:

# 1: set the amp volume (has no effect on SC-displayed volume)
&setAmpVolume($newValue,$client); # whatever this takes
# 2: set the client 'volume' pref for SC display purposes
preferences('server')->client($client)->set('volume',$newValue);
# 3: set the temporary volume (not reflected in the SC display)
$client->volume(100,1); # 2nd arg indicates this is a "temporary" change

The problem is that Player.pm registered a pref change handler for the 'volume'  pref, so after step 2, SC changes the actual player volume. pref change handlers cannot be replaced or intercepted, so it looks like there's currently step 2 must result in a brief change in the player's output -- step 3 restores full output quickly, but doesn't prevent the dip. That volume change probably isn't too bad with analog outputs, but for digital it could be a problem, as anything other than full volume messes up things like DTS processing. And even in non-DTS situations, it seems clunky to have a dip/restore every time the volume changes.

If there were a $client->lock_volume() method that would make $client->volume() and $client-fade_volume() do nothing, then a 3rd party plugin could do something like

# at startup, for a $client using the amp's volume control
$client->volume(100);
$client->lock_volume(1); # "1" == lock the output level
preferences('server')->client($client)->set('volume',$ampVolume);

# on volume change requests for a $client using the amp's volume control
# 1: set the amp volume (has no effect on SC-displayed volume)
&setAmpVolume($newValue,$client); # whatever this takes
# 2: set the client 'volume' pref for SC display purposes
preferences('server')->client($client)->set('volume',$newValue);
Comment 8 Peter Watkins 2009-05-03 20:25:55 UTC
OK, Barry. I see how xAP is probably working for you. If you're willing to lock the player volume at 100% in the SqueezeCenter audio settings, then you end up with SqueezeCenter reporting a volume level that's a complete fiction. You can even run 'mixer muting 1' and there's no effect on the output level, not even analog (in 7.4). With that setup, it's easy for a 3rd party plugin to intercept 'mixer volume' and handle the amp volume. And no dips in volume level.

Beyond the 100% volume limitation, there's another. If you set two SB3s to synchronize including volume where one has volume fixed at 100% and the other allows volume changes, changes to the fictional/amp volume player don't have any effect on the player that allows changes (but changes on the player that does allow true volume control do affect the fictional volume on the other player). I suppose I should look for/open a bug on that.
Comment 9 Barry Gordon 2009-05-03 21:41:25 UTC
My personal issue was only with my Transporter in my Theater.  that is the only one I use to play DTS encoded music.  When playing DTS encoded music the volume must be fixed at 100%
Comment 10 Peter Watkins 2009-10-16 14:14:05 UTC
Barry, do you still care about this, or should it be closed? Personally I'm taking advantage of the fixed output + fictional volume with my Denon amp, and am quite happy with the behavior in 7.3 and 7.4.
Comment 11 Barry Gordon 2009-10-16 15:11:10 UTC
As far as I am concerned it may be closed.
Comment 12 James Richardson 2009-10-16 15:45:42 UTC
Closing per comment 11