For Scalt.....VAC Setup

Help each other out

For Scalt.....VAC Setup

Postby scottw on Tue Jan 30, 2007 3:09 pm

Scalt,

I think I am going to be switching my setup over to using VAC, don't know why I did not do this before :D I love the way you can simply add another room/zone into the currently playing zone without having to stop the music.....WAF!!!!!

I am curious as to how you are using the audiorepeater instances.
The way I understand it, correct me if I am wrong, is you would launch a seperate copy of the audiorepeater app for each zone/room you wanted to play the music in right?
So if you wanted to play, from one source, in 3 different rooms you would have 3 copies of the app open right? Each pointing it's input to the VAC the source is on and outputting one to each soundcard output or channel (I am using KX) for the 3 rooms.


My 2nd question is how are you managing the instances of the audiorepeater? So in the above example I have 3 rooms playing from 1 source and I want to drop one of the rooms, is there a way to be able to close that particular copy of the AR app without interrupting the other 2 or do you just stop them all??

And lastly how are you using Xscript in this setup???

EDIT: OK I found you post discussing closing certain instances of AR, actually I tried to answer it :lol:
Did you get this working and if so are you will to share your scripts??

If at all possible could I have a peak/copy of your skin, if not I understand :D


Sorry for all of the questions but your setup has my interest and I want to understand everything before I jump in.


Thanks alot,
Scott
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Postby scottw on Thu Feb 01, 2007 7:38 pm

OK I got most of this working but now I need the help with Xscript...I am no programmer :D

I am trying to figure out how to launch an app, with xscript, get it's PID (Process ID) and then set that PID to a variable in XL. This way I can kill a certain copy of the audiorepeater app while leaving other copies open.
I can get the app to launch using:
ProcID = Shell("C:\audiorepeater.exe", AppWinStyle.NormalFocus)

but don't know where to go from there.

I found a bit of code on that will launch the app and display the PID in a message box but this code does not work in Xscript:
Code: Select all
dim process, rc, cdir, pid
set process = getobject("winmgmts:!Win32_Process")
cdir = "c:\"
rc = process.create("c:\audiorepeater.exe",cdir,,pid)
msgbox "pid=" & pid, vbsystemmodal


Can anyone help???
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Postby scalt on Thu Feb 01, 2007 8:12 pm

Do you have some programming background? Because you will have to modify my script to make it work with your setup.

Also, the version of Audio Repeater I am using had been sent to me by the author. He had added command line support. I could forward it to you if you'd like.


I'll post my scripts later on today...but I warn you, it's not the cleanest programming around...they're more of a hack then cleanly built scripts :P
scalt
 
Posts: 75
Joined: Tue Dec 06, 2005 10:53 pm

Postby scottw on Thu Feb 01, 2007 8:31 pm

Thanks for replying back!!!!!

Do you have some programming background? Because you will have to modify my script to make it work with your setup.


Programming background....no..but I think I can figure it out.

Also, the version of Audio Repeater I am using had been sent to me by the author. He had added command line support. I could forward it to you if you'd like.

That would be great also :D If you need to you can send it all to swindmiller at verizon dot net or just post it for download.


I don't mind hack solutions, half my setup is a hack :D


Thanks again!!!!
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Postby scalt on Thu Feb 01, 2007 9:59 pm

So here are my scripts. I can't really provide support for these and make no guarantees so they are provided as is. I am willing however to answer some questions if you have any.

There are 2 scripts. The first one is called by the buttons for the sources and the second one for the buttons for the different zones. You can look at the screenshot from the kXd plugin thread to get an idea of how things look.

Code: Select all
Module Script

'*************************************************************************
'
' filename : source.txt
'
' This script allows to control the Audio repeaters for the multizone
' system
'
' Updated 31/01/07
' Author : Scalt
'
'*************************************************************************
'
' To call this script you have to set the Xlobby Variable Syntaxe to :
'
'                   source.txt inSource status
'
'*************************************************************************

Public Sub Main(inSource as string, status as string)

   Dim sources(5) as String
   Dim tempSource as String
   sources(0) = "source_player1"
   sources(1) = "source_player2"
   sources(2) = "source_radio"
   sources(3) = "source_tv"
   sources(4) = "source_videos"
   sources(5) = "source_dvd"

   Dim zones(5) as String
   Dim tempZone as String
   zones(0) = "zone_den"
   zones(1) = "zone_kitchen"
   zones(2) = "zone_dinning"
   zones(3) = "zone_living"
   zones(4) = "zone_outside"
   zones(5) = "zone_other"


   if status = "Off" then
      Xlobby.ExecCommand("xlobby", "button state set", inSource + "~Off")
      Xlobby.ExecCommand("xlobby", "save to variable", "~selected_source" )
      'Disable all zone buttons
      for each tempZone in zones
         Xlobby.ExecCommand("xlobby", "button state set", tempZone + "~NA")
         Xlobby.ExecCommand("xlobby", "button set text", tempZone + "~ ")
      next
   else if status = "On" then
      'Set button to On, and all other buttons to Off
      Xlobby.ExecCommand("xlobby", "button state set", inSource + "~On")
      Xlobby.ExecCommand("xlobby", "save to variable", inSource + "~selected_source" )
      'msgbox(inSource)
      for each tempSource in sources
         if (tempSource <> inSource) then
            Xlobby.ExecCommand("xlobby", "button state set", tempSource + "~Off")
            'msgbox(tempSource)
         end if
      next
      'Set zone buttons to correct state
      for each tempZone in zones
         tempSource = Xlobby.GetXlobbyVar("%variable>" + tempZone + "%")
         if(tempSource = inSource)
            Xlobby.ExecCommand("xlobby", "button state set", tempZone + "~On")
            Xlobby.ExecCommand("xlobby", "button set text", tempZone + "~f")
         else
            Xlobby.ExecCommand("xlobby", "button state set", tempZone + "~Off")
            Xlobby.ExecCommand("xlobby", "button set text", tempZone + "~e")
         end if
      next
   end if
   
 
End Sub

End Module


Code: Select all
Module Script

'*************************************************************************
'
' filename : zones.txt
'
' This script allows to control the Audio repeaters for the multizone
' system
'
' Updated 31/01/07
' Author : Scalt
'
'*************************************************************************
'
' To call this script you have to set the Xlobby Variable Syntaxe to :
'
'                   zones.txt inZone status
'
'*************************************************************************

Public Sub Main(inZone as string, status as string)

   Dim sources(5) as String
   Dim tempSource as String
   sources(0) = "source_player1"
   sources(1) = "source_player2"
   sources(2) = "source_radio"
   sources(3) = "source_tv"
   sources(4) = "source_videos"
   sources(5) = "source_dvd"

   Dim zones(6) as String
   Dim tempZone as String
   zones(0) = "zone_den"
   zones(1) = "zone_kitchen"
   zones(2) = "zone_dinning"
   zones(3) = "zone_living"
   zones(4) = "zone_outside"
   zones(5) = "zone_other"
   zones(5) = "zone_television"

   Dim repeater as String
   Dim selectedSource as String
   Dim inputDeviceName as String
   Dim outputDeviceName as String

   Dim bitsPerSample as String
   Dim channels as String
   Dim totalBuffer as String
   Dim buffers as String
   Dim arguments as String

   bitsPerSample = "16"
   channels = "2"
   totalBuffer = "200"
   buffers = "8"

   if( inZone = "all")
      if( status = "Off")
         tempSource = Xlobby.GetXlobbyVar("%variable>selected_source%")
         if( tempSource <> "" )
            for each tempZone in zones
               Xlobby.ExecCommand("xlobby", "button state set", tempZone + "~Off")
               Xlobby.ExecCommand("xlobby", "button set text", tempZone + "~e")
               Xlobby.ExecCommand("xlobby", "save to variable", "~" + tempZone )
            next
         else
            for each tempZone in zones
               Xlobby.ExecCommand("xlobby", "button state set", tempZone + "~NA")
               Xlobby.ExecCommand("xlobby", "button set text", tempZone + "~")
               Xlobby.ExecCommand("xlobby", "save to variable", "~" + tempZone )
            next
         end if
         'Kill all repeaters
         Xlobby.ExecCommand("os", "kill process", "D:\xlobby\Audio\RepeaterDen.exe")
         Xlobby.ExecCommand("os", "kill process", "D:\xlobby\Audio\RepeaterKitchen.exe")
         Xlobby.ExecCommand("os", "kill process", "D:\xlobby\Audio\RepeaterDinning.exe")
         Xlobby.ExecCommand("os", "kill process", "D:\xlobby\Audio\RepeaterLiving.exe")
         Xlobby.ExecCommand("os", "kill process", "D:\xlobby\Audio\RepeaterOutside.exe")
         Xlobby.ExecCommand("os", "kill process", "D:\xlobby\Audio\RepeaterOther.exe")
         Xlobby.ExecCommand("os", "kill process", "D:\xlobby\Audio\RepeaterTelevision.exe")
      end if
   else
   
      if( inZone = "zone_den" )
         repeater = "D:\xlobby\Audio\RepeaterDen.exe"
         outputDeviceName = "kX Wave SB0350 10k2 [a000] 4/5"
      else if( inZone = "zone_kitchen" )
         repeater = "D:\xlobby\Audio\RepeaterKitchen.exe"
         outputDeviceName = "kX Wave SB0350 10k2 [a000] 6/7"
      else if( inZone = "zone_dinning" )
         repeater = "D:\xlobby\Audio\RepeaterDinning.exe"
         outputDeviceName = "kX Wave SB0350 10k2 [a000] 8/9"
      else if( inZone = "zone_living" )
         repeater = "D:\xlobby\Audio\RepeaterLiving.exe"
         outputDeviceName = "kX Wave SB0350 10k2 [a800] 4/5"
      else if( inZone = "zone_outside" )
         repeater = "D:\xlobby\Audio\RepeaterOutside.exe"
         outputDeviceName = "kX Wave SB0350 10k2 [a800] 6/7"
      else if( inZone = "zone_other" )
         repeater = "D:\xlobby\Audio\RepeaterOther.exe"
         outputDeviceName = "kX Wave SB0350 10k2 [a800] 8/9"
      else if( inZone = "zone_television" )
         repeater = "D:\xlobby\Audio\RepeaterTelevision.exe"
         outputDeviceName = "NVIDIA(R) nForce(TM) Audio"
      else
         repeater = ""
         outputDeviceName = ""
      end if
   
   
      if status = "Off" then
         'Set button state
         Xlobby.ExecCommand("xlobby", "button state set", inZone + "~Off")
         'Set empty source for the zone
         Xlobby.ExecCommand("xlobby", "save to variable", "~" + inZone )
         ' Kill the appropritate Audio Repeater
         Xlobby.ExecCommand("os", "kill process", repeater)
      else if status = "On" then
         'Set button to On
         Xlobby.ExecCommand("xlobby", "button state set", inZone + "~On")
         'Determine selected source
         selectedSource = Xlobby.GetXlobbyVar("%variable>selected_source%")
         'Save source for the zone
         Xlobby.ExecCommand("xlobby", "save to variable", selectedSource + "~" + inZone )
         'Determine parameters for Audio Repeater
         if ( selectedSource = "source_player1" )
            inputDeviceName = "Virtual Cable 1"
         else if ( selectedSource = "source_player2" )
            inputDeviceName = "Virtual Cable 2"
         else if ( selectedSource = "source_radio" )
            inputDeviceName = "Virtual Cable 3"
         else if ( selectedSource = "source_tv")
            inputDeviceName = "Virtual Cable 4"
         else if ( selectedSource = "source_videos")
            inputDeviceName = "Virtual Cable 5"
         else if ( selectedSource = "source_dvd")
            inputDeviceName = "Virtual Cable 6"
         end if
   
         'Launch the repeater
         arguments = "/input:""" + inputDeviceName + """ /output:""" + outputDeviceName + """ /bitspersample:" + bitsPerSample + " /channels:" + channels + " /bufferms:" + totalBuffer + " /buffers:" + buffers + " /autostart"
         'msgbox(arguments)
         'Kill previous repeater
         Xlobby.ExecCommand("os", "kill process", repeater)
         'Start new repeater
         Xlobby.ExecCommand("os", "execute file", repeater + "~" + arguments + "~d:\xlobby\audio~minimized")
         
      end if
   end if
   
 
End Sub

End Module


I will send you the audio repeater by e-mail
scalt
 
Posts: 75
Joined: Tue Dec 06, 2005 10:53 pm

Postby scottw on Thu Feb 01, 2007 11:10 pm

scalt wrote:So here are my scripts. I can't really provide support for these and make no guarantees so they are provided as is. I am willing however to answer some questions if you have any.



Of course, I just appreciate you sharing :D

I also got your email and after looking at the VAC site it looks like the new 4.04 has the command line support....thanks to you 8)

I will try it out later and let you know what happens.

Thanks again,
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Postby scalt on Sat Feb 03, 2007 5:42 am

Allright, I guess I'm going to explain a bit more in detail what I'm doing here so other people can implement this setup.

First of all, I'll put up a picture of what my screen looks like.

Image

As you can see, on the left, I have my various sources. For each source I have a multistate button that is called "source_NAME" that has 2 states : On, Off. All the buttons start of in the Off state.

The ON state has the triggers the following event (Music Player 1 example)

Code: Select all
  <event>
    <name>set music player 1</name>
    <commands>
      <command>
        <type>plugin</type>
        <execute>command</execute>
        <parameter>XScript</parameter>
        <parameter>ExecScript</parameter>
        <parameter>source.txt source_player1 On</parameter>
      </command>
    </commands>
  </event>


and the Off state

Code: Select all
  <event>
    <name>unset music player 1</name>
    <commands>
      <command>
        <type>plugin</type>
        <execute>command</execute>
        <parameter>XScript</parameter>
        <parameter>ExecScript</parameter>
        <parameter>source.txt source_player1 Off</parameter>
      </command>
    </commands>
  </event>


As you can see in the sources.exe script, to make sure only one source is selected at a time, whenever a button is clicked to the ON state, it puts all the other buttons to OFF. Another thing that is done is that the name of the current source is saved to the Xlobby variable "selected_source". This variable is used by the zones.txt script to point the Audio Repeaters to the correct Virtual Audio Cables (VAC). If you click on the same source again, it turns if off by calling the second event listed above. What happens then is that it disables all the zones on the right side of the screen because no source is selected at that point.

So quick recap to setup the sources : First of all, make sure that your different sources (WinAmp instances, DVD player software, MPC, Zoom Player, etc..) point to a seperate Virtual Audio cable. Then create a button for each source with the ID "source_NAME". For each button, create 2 states : On and Off. The event for the On state should be like my "set music player 1" event : it should call the sources.txt script with the ID of the button as the first parameter and On as the second parameter. For the Off state, the event should be like my "unset music player 1". The only difference is the use of Off for the second parameter.

Now onto the zones. Each zone must have a button and an audio repeater. I will use for example my zone called "Den". The button for this zone is called "zone_den" and it has an audio repeater called "RepeaterDen.exe". This button has 3 states : NA, On and Off. NA is the default state and it has no event associated to it. Obviously, you don't want to start an Audio Repeater when no source is selected, because that is basicly what the zone buttons do : they start the appropriate instance of the audio repeaters with the correct VAC as input.

The Off state calls the following event which basically calls the zones.txt script and changes the text of the zone. The font used is HTPC from one of the skins on this site (i forget..sorry) that has a bunch of very useful icons for HTPC. It just to happens that "e" and "f" represent little speakers with sound coming (and not) out of them...

Code: Select all
  <event>
    <name>zone den enable</name>
    <commands>
      <command>
        <type>plugin</type>
        <execute>command</execute>
        <parameter>XScript</parameter>
        <parameter>ExecScript</parameter>
        <parameter>zones.txt zone_den On</parameter>
      </command>
      <command>
        <type>xlobby</type>
        <execute>button set text</execute>
        <parameter>zone_den</parameter>
        <parameter>f</parameter>
      </command>
    </commands>
  </event>


The event for the On state is the following

Code: Select all
  <event>
    <name>zone den disable</name>
    <commands>
      <command>
        <type>plugin</type>
        <execute>command</execute>
        <parameter>XScript</parameter>
        <parameter>ExecScript</parameter>
        <parameter>zones.txt zone_den Off</parameter>
      </command>
      <command>
        <type>xlobby</type>
        <execute>button set text</execute>
        <parameter>zone_den</parameter>
        <parameter>e</parameter>
      </command>
    </commands>
  </event>


The zones.txt script is pretty straight forward. The only thing worth mentionning is the addition of the "all" zone. Basicly, I use this to close all instances of the Audio Repeaters. It's usefull to call when Xlobby shuts down for example or if Xlobby crashes and you start it up again and forgot to close the instances.


I think this pretty much covers it all, if I forgot something don't hesitate.
scalt
 
Posts: 75
Joined: Tue Dec 06, 2005 10:53 pm

Postby scottw on Sun Feb 04, 2007 1:46 am

Ok Scalt I now HATE YOU!!!!!! I have to redo my whole setup!!!!


Just kidding this thing ROCKS and I am forever grateful, it works perfectly. I have it setup on 1 source and 2 zones.

I feel bad that you had to type out all those instructions but they worked great and I am sure will help others. The only problem I had was figuring out toggle buttons, once I got use to it I had no problem.

I wil post back once everything is setup. Off to buy VAC, the "TRIAL" announcement every couple of seconds is getting old.

Again THANK YOU, THANK YOU,THANK YOU,THANK YOU.
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Postby scottw on Sun Feb 04, 2007 3:15 am

By the way the font needed is from Badabing found here:
http://www.xlobby.com/files/badabing/files/HTPC.zip

:D
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Postby scalt on Sun Feb 04, 2007 6:48 pm

It's no problem.

Happy I could help. If there's anything else, don't be afraid to ask.
scalt
 
Posts: 75
Joined: Tue Dec 06, 2005 10:53 pm

Postby scottw on Mon Feb 05, 2007 3:34 pm

Have you tried this on a thin client before??

I setup a test page similar to the one you have and it works fine thru the regular XL but not thru a thin client. On the thin client I can click a source and it changes the toggle button for the source but does not change the buttons for the zones, nor can I click on any of the zones and have it do anything because it did not change the state for the zone from NA to Off.
It also does not lock out the other sources when you click on a source.

I know you said you cannot support this and that is fine I was just wondering if you had any ideas or how you use yours.
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Postby scalt on Mon Feb 05, 2007 7:14 pm

No, I can't say I have. I had tried it quickly with the web interface, and it wasn't working. At the time, I thought it might be that multi-state buttons don't work properly with the web interface but I hadn't given it that much thought.

Sorry.

If you do figure this out, tell me :)
scalt
 
Posts: 75
Joined: Tue Dec 06, 2005 10:53 pm

Postby scottw on Tue Feb 06, 2007 12:17 am

The thin client seems to be able to handle toggle buttons but seems to be having a problem with the way the script is calling it. I setup the toggle buttons as a test by just using the Button Set State in XL and they work fine in the thin client.

So it must be the way the script calls them. I may not be much help on this since my programming skills are poor.
I may try to setup something with XL to do something similar to what is done in the script and will let you know if I get anywhere.
Thanks again for giving me the script!!!

If you figure anything out please let me know. :D

Thanks,
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Postby Marbles_00 on Tue Feb 06, 2007 12:33 am

I've never used this, but have you tried the Server Event check box? I'm not sure if it associates to the whole event or individual commands, but you could select the command that runs the Xscript plugin and check off the box next to Server Event above the Commands list.

If it does what I think, it should only run the commands on the server. You may loose the toggle effect on the client, but I figure that is a small price to pay for getting the system running.

I don't even know if the command works. I saw a thread once on someone inquiring about it, but I'm not sure of the resolution.

I hope this helps.
Marbles_00
 
Posts: 1867
Joined: Wed Apr 06, 2005 12:44 pm
Location: Canada

Postby scottw on Tue Feb 06, 2007 1:00 pm

Marbles_00 wrote:I've never used this, but have you tried the Server Event check box? I'm not sure if it associates to the whole event or individual commands, but you could select the command that runs the Xscript plugin and check off the box next to Server Event above the Commands list.

If it does what I think, it should only run the commands on the server. You may loose the toggle effect on the client, but I figure that is a small price to pay for getting the system running.

I don't even know if the command works. I saw a thread once on someone inquiring about it, but I'm not sure of the resolution.

I hope this helps.


Thanks for jumping in :D
Not really sure what this is supposed to do, can you explain a little more? I know it's my lack of knowledge but how was this supposed to help?
I tried it and it did not do anything differently.

Keep the suggestions coming, I really want to set this up 8)

Thanks,
scottw
 
Posts: 774
Joined: Mon Feb 06, 2006 4:21 pm
Location: Glen Burnie, Maryland

Next