Kindergarten level programming
scottyp100
Junior Member
Hi,
Anyone willing to help?
I'm trying to make an AMX TP button ramp an amp channel up whilst it's pressed.
If I send the string once, it increments the volume 1db at a time. So I've tried to create a TO Command to repeat the sending.
DEFINE_CALL 'Surround Amp Up'
{
IF(SURROUND_AMP_UP)
WAIT 2
SEND_STRING dvSURROUND, "$50, $43, $53, $45, $4E, $44, $02, $04, $80, $70, $C7, $38, $47, $48"
}
BUTTON_EVENT[dvTP1,11]
{
PUSH:
{
TO[dvTP1,11]
TO[SURROUND_AMP_UP]}
}
I'm a novice, playing at home, so be nice please
Anyone willing to help?
I'm trying to make an AMX TP button ramp an amp channel up whilst it's pressed.
If I send the string once, it increments the volume 1db at a time. So I've tried to create a TO Command to repeat the sending.
DEFINE_CALL 'Surround Amp Up'
{
IF(SURROUND_AMP_UP)
WAIT 2
SEND_STRING dvSURROUND, "$50, $43, $53, $45, $4E, $44, $02, $04, $80, $70, $C7, $38, $47, $48"
}
BUTTON_EVENT[dvTP1,11]
{
PUSH:
{
TO[dvTP1,11]
TO[SURROUND_AMP_UP]}
}
I'm a novice, playing at home, so be nice please
Comments
-
This code has not been tested, but in general this is what I do with Volume Ramping.
DEFINE_VARIABLE Integer dvTP1_ButtonHold; Define_Function SurroundAmpUp(Dev Device) { //Should be putting this into a Queue and firing out in a Timeline //@ a predetermined interval SEND_STRING Device, "$50, $43, $53, $45, $4E, $44, $02, $04, $80, $70, $C7, $38, $47, $48"; } DEFINE_EVENT BUTTON_EVENT[dvTP1, 11] { PUSH: { dvTP1_ButtonHold = False; } RELEASE: { if ( !dvTP1_ButtonHold ) { TO[Button.Input]; SurroundAmpUp(dvSURROUND); } dvTP1_ButtonHold = False; } HOLD[2, REPEAT]: { dvTP1_ButtonHold = True; TO[Button.Input]; SurroundAmpUp(dvSURROUND); } } -
Another method
When needing to ramp volume like this I use timelines.DEFINE_VARIABLE LONG lVolumeDelay[]={150} INTERGER nVolRamping DEFINE_EVENT BUTTON_EVENT[vdvTP_Vol,nVolBtn] { PUSH: { IF(!nVolRamping) { nVolRamping=1 // send the ramp volume command TIMELINE_CREATE(tlVolRamp,lVolumeDelay,1,TIMELINE_ABSOLUTE,TIMELINE_REPEAT) } } RELEASE: { nVolRamping=0 TIMELINE_KILL(tlVolRamp) } } TIMELINE_EVENT[tlVolRamp] { // send the ramp volume command } -
TonyAngelo wrote: »When needing to ramp volume like this I use timelines.
DEFINE_VARIABLE LONG lVolumeDelay[]={150} INTERGER nVolRampingTimeOut = 30 DEFINE_EVENT BUTTON_EVENT[vdvTP_Vol,nVolBtn] { PUSH: { IF(!timeline_active(tlVolRamp)) { // send the ramp volume command TIMELINE_CREATE(tlVolRamp,lVolumeDelay,1,TIMELINE_ABSOLUTE,TIMELINE_REPEAT) } } RELEASE: { TIMELINE_KILL(tlVolRamp) } } TIMELINE_EVENT[tlVolRamp] { if (timeline.repetition < nVolRampingTimeOut) // send the ramp volume command else timeline_kill(tlVolRamp) }
I made couple small changes. I got rid of the integer variable because it is redundant, and I added a guard against runaway volume if a button release is missed (habit from R4 days). -
Not saying it's wring, because it's a perfectly valid approach, but I've personally always felt timelines were overkill. I use the HOLD [REPEAT, n] method. You can adjust the repeat value if the serial port overruns or keeps going too long; if you buffer your commands, you can also clear the queue on a RELEASE. My problem with serial devices has always been, however, that unless there is a built-in ramp command, it's really fussy to get the ramping to go smoothly without overruns.
-
I am with Dave, try this
BUTTON_EVENT [dvKP,9] // SELECT Volume Up KEYPAD BUTTON (#9)
{
HOLD[2,REPEAT]:
{
IF (nVol_Lvl < 100)
{
PUT YOUR STRING HERE
nVol_Lvl = nVol_Lvl + 1
ON [dvKP,9]
}
}
RELEASE:
{
OFF [dvKP,9]
}
}
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums
