Combining Channels..
cma
Posts: 94
OK the help section in studio says you can combine dev_chans.. here is their example:
DEVCHAN dcMSP1 =
{{MSP1,PRESET1},{MSP1,PRESET2},{MSP1,PRESET3},{MSP1,PRESET4},{MSP1,PRESET5}}
DEVCHAN dcMSP2 =
{{MSP2,PRESET1},{MSP2,PRESET2},{MSP2,PRESET3},{MSP2,PRESET4},{MSP2,PRESET5}}
DEVCHAN dcMSP3 =
{{MSP3,PRESET1},{MSP3,PRESET2},{MSP3,PRESET3},{MSP3,PRESET4},{MSP3,PRESET5}}
DEVCHAN dcVDEV =
{{VDEV,PRESET1},{VDEV,PRESET2},{VDEV,PRESET3},{VDEV,PRESET4},{VDEV,PRESET5}}
COMBINE_CHANNELS (dcVDEV, dcMSP1, dcMSP2, dcMSP3)
I am trying to combine multiple dev_chan sets and am doing it the same way as above in my program, however it doesn't seem to work. I am basically trying to take an R2 (which has a different set of channel numbers for all of the buttons depending on which source button you press or page you are on) and combine them all to one virtual dev_chan group to make all of the buttons output the same channel number no matter which source button you press or what page you are on.
DEVCHAN dcMSP1 =
{{MSP1,PRESET1},{MSP1,PRESET2},{MSP1,PRESET3},{MSP1,PRESET4},{MSP1,PRESET5}}
DEVCHAN dcMSP2 =
{{MSP2,PRESET1},{MSP2,PRESET2},{MSP2,PRESET3},{MSP2,PRESET4},{MSP2,PRESET5}}
DEVCHAN dcMSP3 =
{{MSP3,PRESET1},{MSP3,PRESET2},{MSP3,PRESET3},{MSP3,PRESET4},{MSP3,PRESET5}}
DEVCHAN dcVDEV =
{{VDEV,PRESET1},{VDEV,PRESET2},{VDEV,PRESET3},{VDEV,PRESET4},{VDEV,PRESET5}}
COMBINE_CHANNELS (dcVDEV, dcMSP1, dcMSP2, dcMSP3)
I am trying to combine multiple dev_chan sets and am doing it the same way as above in my program, however it doesn't seem to work. I am basically trying to take an R2 (which has a different set of channel numbers for all of the buttons depending on which source button you press or page you are on) and combine them all to one virtual dev_chan group to make all of the buttons output the same channel number no matter which source button you press or what page you are on.
0
Comments
Since the buttons are separated by a factor of 40 from one page to the next, it's simple algebra to get the number. I've put in the example from the R2 manual below.
So a push on any one of these Power Buttons will yield a push on channel 9 on the virtual device.
You can do that as well with this example. Just put whatever button numbers you wish to address in the button array. You don't have to go from 1-255 consecutively.
Perhaps I'm not understanding. Just out of curiosity - why would you have a different set of buttons for different sources? You could do a simple SWITCH/CASE or SELECT/ACTIVE on the source variable and then do whatever you need to do. Something like this might help.
The R2 buttons are hard numbered so depending on what Source button you push at the top of the remote all of the button channel numbers change. I am trying to get the remote to act just like a touchpanel where you would use the same channel numbers for multiple devices.
The R2 would be great if you could just pick a range of channels just like the older RF remotes but you are stuck with the page by page set of channel numbers they give you.
may I ask you, if there is a reason not to do just BUTTON_EVENT[MIO_R2,0] ?
No, you may ask No, zero is a great way to do it. The only reason not to do it is if he intends to leave some of the buttons out of the equation. But what you suggest works fine and takes fewer lines of code.
I see it the other way round. Do everything in one place, the ButtonPushHandler routine, using a switch / case, and that seems cleaner to me. When adding a button you need only add the definition of the constant holding its number and a case in your routine. The traditional approach requires adding it to the array as well. That's very easy to miss, and I got it wrong so often that I now avoid doing it that way.
Let's also put to rest this idea that we need to worry about performance issues.
(a) The code is only run when a button is pushed. That's never going to overload the system.
(b) Any additional processor load is miniscule*, and need not be considered.
(c) The traditional approach filters buttons too - the same process occurs - although perhaps in a more efficient manner.
Performance is the last thing we should worry about - clarity and simplicity is almost always more important.
*or minuscule if you like
I've just implemented the ,0 in a button event and it is generating some odd information regarding the HOLD: portion of my button event.
BUTTON_EVENT[dvRemote, 0]
{
PUSH:
{
STACK_VAR char mCmd[10]
mCmd = FindFireballCmd(BUTTON.INPUT.CHANNEL, FALSE);
IF (mCmd != '') SEND_FB_CMD(mCmd);
}
HOLD[4, REPEAT]:
{
STACK_VAR char mCmd[10]
mCmd = FindFireballCmd(BUTTON.INPUT.CHANNEL, TRUE);
IF (mCmd != '') SEND_FB_CMD(mCmd);
}
}
The processor shows: "CIpHold:AddHold - Duplicate" and my code within my FindFireballCmd seems to be executing non-stop event though I only pressed the button once.
Any thoughts on this behavior?
I'm working with a MIO R-2 and was originally trying to pass in the mode offset and create a generic module that would allow the device to be assigned to different mode buttons on a job by job basis. My button event looked like
BUTTON_EVENT [dvRemote, RemoteOffset+ButtonConstantPlay] where RemoteOffset is a variable passed in during the module declaration. The system ignored this event which led me to changing to the 0 as suggested above.
Thanks for any advice that may come along.
That's sort of explained here:
http://amxforums.com/showthread.php?t=2590
But basically any time you don't have a push or release of some channel number you have a hold of 0. If tyou think about it long enough it makes sense.
Go back the begining of the thread as it went off on another tangent.