Accessing Zone Variables

Got an idea, post it here

Accessing Zone Variables

Postby scalt on Sat Feb 04, 2006 8:25 pm

I would like to be able to access variables from different zones without have to switch to the zone.

For example, be able to play/stop/next/pause a zone without using "zone set" or be able to change the volume or mute a zone.
scalt
 
Posts: 75
Joined: Tue Dec 06, 2005 10:53 pm

Workaround

Postby scalt on Mon Feb 13, 2006 5:52 am

Well, I found a little workaround for this since I haven't gotten any updates.

Basicly, I decided to use the XScript plug-in and then use the SendMessage command to the correct WinAmp instance. I might have been able to use the SendMEssage included in XLobby, but i couldn't get it to work properly.

For my multi-zone set-up, i chose to use VAC (Virtual Audio Cables), so all the zones could pull their date from 1 stream, and so I could use WinAmp with the line-in plug-in to source from different programs.

Even though I use VAC, sometimes the zones go a bit out of synch when i start them, so I wrote this little script to synch. Notice the use of the SendMessage Command

Code: Select all
'*************************************************************************
'
' To call this example you have to set the Xlobby Variable Syntaxe to :
'
'                   synch_zones.txt
'
'*************************************************************************
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Integer
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As Object) As Integer


Public Sub Main()


    'Start Script'
    dim Zones(6) as string
    dim i as integer
    dim j as integer
    Dim hwndWinamp(6) as integer
    Dim Res as integer

    ' Populate Zones array '
    Zones(0) = "Den"
    Zones(1) = "Kitchen"
    Zones(2) = "Dinning"
    Zones(3) = "Living"
    Zones(4) = "Outside"
    Zones(5) = "Extra"
   
    ' Get handles '
    For i = 0 To 5
   hwndWinamp(i) = FindWindow(Zones(i),vbNullString)
    Next i
   

    ' Send Stop Command '
    For j = 0 To 5
        Res = SendMessage(hwndWinamp(j), 273, 40047, 0)
    Next j
   
    ' Send Play Command '
    For j = 0 To 5
        Res = SendMessage(hwndWinamp(j), 273, 40045, 0)
    Next j


 
End Sub

End Module


As for volume control, I'm basicly going to write a script that uses the sendmessage command to tell winamp instance to move the volume up or down.
scalt
 
Posts: 75
Joined: Tue Dec 06, 2005 10:53 pm