Multi-Zone Volume Page/Control ?help?
vegastech
Posts: 369
I have created a zones page to quickly adjust volume up, down, or mute for my 3 zones. I am, however, having a problem determining the best structure for programming this. I was considering creating an array for all 3 volume up buttons, another for all 3 volume down buttons, and another for all 3 mute buttons. I am trying to get away from creating button events for each button, but I can't seem to get the variables down. here is what I have so far:
NON_VOLATILE INTEGER nZoneUp[] = {1,2,3} //Vol Up Commands for 3 Zones NON_VOLATILE INTEGER nZoneDn[] = {4,5,6} //Vol Dn Commands for 3 Zones NON_VOLATILE INTEGER nZoneMute[] = {7,8,9} //Mute Commands for 3 Zones NON_VOLATILE INTEGER nVol //current volume level BUTTON_EVENT[dvCV7Tp,nZoneUp] //Zone VOL3 Up Commands { PUSH: { nVol ++ SEND_COMMAND dvVOL1, "'P0L',itoa(nVol),'%'" //vol3 box SEND_LEVEL dvCV7Tp, 10,nVol } } BUTTON_EVENT[dvCV7Tp,nZoneDn] //Zone Vol3 Dn Commands { PUSH: { nVol -- SEND_COMMAND dvVOL1, "'P0L',itoa(nVol),'%'" //vol3 box SEND_LEVEL dvCV7Tp, 10,nVol } }I know there is a better way to organize several arrays so that I can use multi-zone functions like this, but I can't seem to find the post I saw it on. Something where I can do a single event for all zones volume up, another for down...etc. Help?
0
Comments
I don't if you would like to make al zones with the same volume, is this what you really want?
Because I could see you only use one variable to storage the volume level you are sending on the send_string. Depending on the device, you could use the level value to storage the volume, but be careful when using more than one touchpanel, here is what I should do in your case
That will make it more scalable (if more zones are added later, you can just expand the button array, and they don't need to have contiguous channel numbers). You may also want to bounds-check nVol before incrementing or decrementing it, so it doesn't roll into weird numbers if you get less than zero, or over you max volume level.
You say like this, if touch kitchen goes to kitchen, if all, both rooms
If you wanna do this, you should make this
For the rooms buttons:
then in the vol up button
Sorry I could code it better, but today is friday, and the happy hour is aproaching...
I finally got back around to reviewing the suggestions you guys posted - I'm having an issue when I compile:
It is referencing this line of code:
Here is what I have so far: It just freaks out when I try to use the nZoneUp variable to reference which numbered array in nZoneLevel I wish to increment. Frustrated...
Your button event could be along the lines of:
However, I'd insert a STACK_VAR INTEGER nIND in the start of the event, and then an nIND = GET_LAST(nZoneUp) right after it, then replace all the instances of GET_LAST in the modified code with nIND. So instead of nZoneLevel[GET_LAST(nZoneUp)], it'd be nZoneLevel[nIND].
Hope that helps!