void pressAndHold(uint buttonNumber, bool status) { UIButtonNumberCalc UICalc = new UIButtonNumberCalc(); uint UINumber = UICalc.UINum(buttonNumber); int zoneNumber = Convert.ToInt32(UICalc.zoneNumber);//calculate UIZone number ushort output = UItoZone.zoneNumbersInGroups[currentZone[UINumber - 1].currentGroupNumber - 1, zoneNumber - 1];//calculate SwampZone number pressHold.presetNum = output; if (status) { pressHold.InitializeTimer(2000); pressHold.TimerHasFinished += new EventHandler(pressHold_TimerHasFinished); } else { pressHold.StopTimer(); } }
void sendOff(uint buttonNum) { UIButtonNumberCalc UICalc = new UIButtonNumberCalc(); uint UINumber = UICalc.UINum(buttonNum); uint zoneNumber = UICalc.zoneNumber; ushort output = UItoZone.zoneNumbersInGroups[currentZone[UINumber - 1].currentGroupNumber - 1, zoneNumber - 1]; sourcer(output, 0); }
void mute(uint buttonNum) { UIButtonNumberCalc UICalc = new UIButtonNumberCalc(); uint UINumber = UICalc.UINum(buttonNum); uint zoneNumber = UICalc.zoneNumber; bool master = UICalc.MASTER; if (master) { for (int i = 0; i < (currentZone[UINumber - 1].currentGroupSize); i++)//test all zones in group { if ((currentZone[UINumber - 1].zoneSelectButtons & (1 << (i + 1))) != 0)//if zone is selected { ushort output = UItoZone.zoneNumbersInGroups[currentZone[UINumber - 1].currentGroupNumber - 1, i];//select zone number to send source to muter(output); } } } else { ushort output = UItoZone.zoneNumbersInGroups[currentZone[UINumber - 1].currentGroupNumber - 1, zoneNumber - 1];//select zone number to send source to muter(output); } for (ushort i = 1; i < 9; i++) { swampA.Zones[i].Name.StringValue = zoneNameArray[i - 1]; //swampA.Expanders[i].Zones[i].Name.StringValue = zoneNameArray[i - 1]; } }
void singleVolUpDown(uint buttonNum, bool pressRelease) { double VolumeRampSeconds = 700;//X10ms double rampTime; ushort exp = 1; UIButtonNumberCalc UICalc = new UIButtonNumberCalc(); uint UINumber = UICalc.UINum(buttonNum); bool volUp = UICalc.VOLUP;//up or down ushort rampValue = UICalc.ramp;//0 or 65535 uint zoneNumber = UICalc.zoneNumber;//calculate zone number ushort output = UItoZone.zoneNumbersInGroups[currentZone[UINumber - 1].currentGroupNumber - 1, zoneNumber - 1]; if (volUp) { rampTime = (65535 - (double)UItoZone.zoneCurrentVolumes[output]) * VolumeRampSeconds / 65535;//set relative ramping time } else { rampTime = ((double)UItoZone.zoneCurrentVolumes[output]) * VolumeRampSeconds / 65535; } if (output > 0 && output < 9)//SWAMP24X8 { if (pressRelease) { if (swampA.Zones[output].SourceFeedback.UShortValue != 0)//if not off { swampA.Zones[output].MuteOff(); swampA.Zones[output].Volume.UShortValue = UItoZone.zoneCurrentVolumes[output]; swampA.Zones[output].Volume.CreateRamp(rampValue, (uint)rampTime);//SEND RAMP COMMAND } } else { swampA.Zones[output].Volume.StopRamp(); } } else if (output >= 11)//send to expander { ushort expOutput = calculateExpanderOutput(output); if (pressRelease) { if (swampA.Expanders[exp].Zones[expOutput].SourceFeedback.UShortValue != 0) { swampA.Expanders[exp].Zones[expOutput].MuteOff(); swampA.Expanders[exp].Zones[expOutput].Volume.UShortValue = UItoZone.zoneCurrentVolumes[output]; swampA.Expanders[exp].Zones[expOutput].Volume.CreateRamp(rampValue, (uint)rampTime); } } else { swampA.Expanders[exp].Zones[expOutput].Volume.StopRamp(); } } }
void masterVolume(uint buttonNum, bool pressRelease) { double VolumeRampSeconds = 700;//X10ms double rampTime; ushort exp = 1; UIButtonNumberCalc UICalc = new UIButtonNumberCalc(); uint UINumber = UICalc.UINum(buttonNum); bool volUp = UICalc.VOLUP; ushort rampValue = UICalc.ramp; for (int i = 0; i < (currentZone[UINumber - 1].currentGroupSize); i++)//test all zones in group { if ((currentZone[UINumber - 1].zoneSelectButtons & (1 << (i + 1))) != 0)//if zone is selected { ushort output = UItoZone.zoneNumbersInGroups[currentZone[UINumber - 1].currentGroupNumber - 1, i];//select zone number to change vol if (volUp) { rampTime = (65535 - (double)UItoZone.zoneCurrentVolumes[output]) * VolumeRampSeconds / 65535;//set relative ramping time } else { rampTime = ((double)UItoZone.zoneCurrentVolumes[output]) * VolumeRampSeconds / 65535; } if (output > 0 && output < 9)//SWAMP24X8 { if (pressRelease) { if (swampA.Zones[output].SourceFeedback.UShortValue != 0) { swampA.Zones[output].MuteOff(); swampA.Zones[output].Volume.UShortValue = UItoZone.zoneCurrentVolumes[output]; swampA.Zones[output].Volume.CreateRamp(rampValue, (uint)rampTime);//SEND RAMP COMMAND } } else { swampA.Zones[output].Volume.StopRamp(); } } else if (output >= 11) { ushort expOutput = (ushort)(output + 1);//calculate expander zone for (int j = 0; j < numberOfExpanders; j++) { if (output <= expanderLastZone[j]) { exp = (ushort)(j + 1);//expander number expOutput -= (ushort)expanderFirstZone[j]; break; } } if (pressRelease) { if (swampA.Expanders[exp].Zones[expOutput].SourceFeedback.UShortValue != 0) { swampA.Expanders[exp].Zones[expOutput].MuteOff(); swampA.Expanders[exp].Zones[expOutput].Volume.UShortValue = UItoZone.zoneCurrentVolumes[output]; swampA.Expanders[exp].Zones[expOutput].Volume.CreateRamp(rampValue, (uint)rampTime); } } else { swampA.Expanders[exp].Zones[expOutput].Volume.StopRamp(); } } } } }
void zoneSelect(uint buttonNumber) { bool bit; UIButtonNumberCalc UICalc = new UIButtonNumberCalc(); uint UINumber = UICalc.UINum(buttonNumber); int zoneNumber = Convert.ToInt32(UICalc.zoneNumber);//calculate zone number if (groupUngroupArray[UINumber])//multizone mode { currentZone[UINumber - 1].zoneSelectButtons ^= 1 << zoneNumber;//toggle bit bit = (currentZone[UINumber - 1].zoneSelectButtons & (1 << zoneNumber)) != 0;//check bit myEISC.BooleanInput[Convert.ToUInt16((UINumber - 1) * 20) + (uint)zoneNumber].BoolValue = bit;//update button fb } else //singlezone mode { currentZone[UINumber - 1].zoneSelectButtons = (2 << (zoneNumber - 1));//set bit for (int i = 0; i < currentZone[UINumber - 1].currentGroupSize; i++) { bit = (currentZone[UINumber - 1].zoneSelectButtons & (1 << (i + 1))) != 0;//check bit myEISC.BooleanInput[Convert.ToUInt16((UINumber - 1) * 20 + (i + 1))].BoolValue = bit; } } }