Author Topic: How to Respond to Display On/Off Events  (Read 3086 times)

alx9r

  • Guru
  • ****
  • Posts: 187
    • View Profile
How to Respond to Display On/Off Events
« on: May 13, 2009, 05:41:07 am »
Does anyone know how to create a "Respond to Events" entry that responds to a media director display turning on or off? 

I have other "Respond to Events" entries working (set volume when playing media for example).  I haven't figured out how to set the criteria for an event such that it fires when an MD display is turned on or off.

The obvious General=>on/off event doesn't seem to fire at all (I tried setting it up to respond to my TV's on/off).  I think I might be misunderstanding how events work.  If someone who's had some success with Advanced Events could point me in the right direction I'd appreciate it.


Why do I want to respond to an MD display on/off event?  I am using some powered speakers (actually studio monitors) with one of my media directors.  I would like to turn them on and off with the display (i.e. the TV).  I have the X10 gear to switch the power, but the tricky part seems to be hooking into the display on/off events.   

Perhaps someone else who is using PC speakers or a straight power amplifier has come across a good solution to powering them on and off.


Regards,

Alex

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Re: How to Respond to Display On/Off Events
« Reply #1 on: May 13, 2009, 08:13:01 am »
Alex,

I think that I have the same scenario on my Spa MD. It has an LCD monotor which I turn on/off with DPMS calls. It works fine when hooked up as the video pipe for the MD.
I have a Car Audio amplifier hooked up to the speakers in the spa and to the sound card line out of the MD. I have hooked a relay to this and control the relay with the parallel port and some simple C code so it can also be turned on/off. If I hook this up as the audio pipe for the MD then on/off work as expected and I expect it would do the same for you.

However.... Using an audio pipe means that volume commands are directed to the pipe (whether it handles them or not) so in my scenario (and yours I suspect) there is now no way to control the volume as these commands need to be processed by the App Server (which controls the sound card volume controls).

I discussed this on IRC with Thom I think it was and he is convinced that i am using the system in an inappropriate way and that is expected behaviour. I disagree and believe that volume commands should be able to be directed to whatever device can handle them perhaps with a heirarchy based order - but until I can change this code then that it teh way it works.

My temporary solution which might help you was to listen for the Media Playing and Media Stopped events and use these to turn the Amp on/off. This meant removing the audio pipe so that the volume commands would still be handled by app server and go to the sound card. It works but is a bit of a hack really and ideally I would like to have the pipe connected but that is just added to teh list of things that I would liek to do.....

Hope that helps in some way

Darren

alx9r

  • Guru
  • ****
  • Posts: 187
    • View Profile
Re: How to Respond to Display On/Off Events
« Reply #2 on: May 13, 2009, 04:57:22 pm »
Darren,
Thanks for the response.  In terms of power and volume control it seems your Spa MD setup is indeed similar to my Bedroom MD setup. 

However.... Using an audio pipe means that volume commands are directed to the pipe (whether it handles them or not) so in my scenario (and yours I suspect) there is now no way to control the volume as these commands need to be processed by the App Server (which controls the sound card volume controls).
Your suspicion was exactly right.  I ran into this problem also.

Quote
I discussed this on IRC with Thom I think it was and he is convinced that i am using the system in an inappropriate way and that is expected behaviour. I disagree and believe that volume commands should be able to be directed to whatever device can handle them perhaps with a heirarchy based order - but until I can change this code then that it teh way it works.

I can't comment on whether this behavior is expected or not or good or bad. However, I think it is worth stating the following explicity: There doesn't seem to be a way to properly control the power-only of a device that is somewhere in the audio signal path between the MD and speakers that does not control the volume.  This type of device includes stereo amplifiers and equalizers (think audiophile), studio monitors (like I am using), any kind of rack mount processing gear (I'm thinking compressors, noise gates, etc.), and multimedia computer speakers.

Quote
My temporary solution which might help you was to listen for the Media Playing and Media Stopped events and use these to turn the Amp on/off. This meant removing the audio pipe so that the volume commands would still be handled by app server and go to the sound card. It works but is a bit of a hack really and ideally I would like to have the pipe connected but that is just added to teh list of things that I would liek to do.....
The downside, of course, of using the Media Playing/Stopped events is that power to the amplifier is toggled more frequently.

I've got some good news.  I did get both the power and volume behavior working correctly late last night.  The solution isn't that elegant though:
1. I created an an "Amp/Preamps/Recevers/Tuners" GSD device template
2a. I patched the commands for volume and mute to the TV device (I am using it to control volume, I suspect they could be patched to control the sound card volume somehow).
2b. I patched the command for power to the X10 switch device that controls the power to the speaker amplifiers.

So the "power on" ruby rectangles looks like this:
Code: [Select]
dest = <X10 switch device ID>;
cmd = Command.new(0,dest ,1,1,192);
cmd.params_[97] = "98";
SendCommand(cmd);

Quote
Hope that helps in some way
It sure does.  I was hoping someone could comment on whether I am approaching the problem in a productive way.

Regards,

Alex