long time no midi. Good to be back though. Anyway, straight to it…
Is there a way to get the current physical position of all pots, and then transmit them. I want to trigger this command from a midi message- CC127 on channel one-
Are you here talking about something like a “snapshot” function?
If so Is the same thing I’m searching for: I build up a custom midibox running an hard custom version of ain64_din128_dout128_v2_0.zip basically changing din messages from note_on-note_off to CC events and splitting the AIN into 2 “Potrows” some kind of “twins” sending the same CC messages (AIN from 0 to 31 send CC from CC1 to CC32, AIN from 32 to 63 send CC from CC 33 to CC64) this two potrow are activated with two din (din 1 activate potrow 1 and deactivate potrow 2, din 2 activate potrow 2 and deactivate potrow 1),
All is working good but I’m in searching of coding something like a snapshot function to send all pots position when changing from the two potrows…basically when press din 1 it must be (activate potrow 1 and deactivate potrow 2 + read potrow 1 potposition and send the relative CC values ), when press din 2 it must be (activate potrow 2 and deactivate potrow 1+ read potrow 2 potposition and send the relative CC values ).
Any suggestion for how to implement this function?
I’m not sure if I get your question right, 'cause “Snapshot” in this context normally means that it’s using motorized pots or faders;
anyway; as you can see from the code above it’s no problem to ask the analog pins for their current values by [tt]MIOS_AIN_Pin7bitGet(pinNumber)[/tt] and send these values all at once (or you can update a state-array in the [tt]AIN_Notify[/tt] function and then send the whole array or parts of it).
You surely know that [tt]MIOS_DIN_PinGet(pinNumber)[/tt] returns the current state of a button (down if FALSE, up if TRUE).
That means it does not matter where you send your stuff; it’s even thinkable that nothing happens when you turn a pot; just when you press a button, specific pot states are sent, depending on various button states. The best place for this would be the [tt]DIN_Notify[/tt] Function
Ok, done, just adding the code you suggested me in my existing switch cases, so when I push one button or another button, after all the job and routine for these buttons, we have the reading of all the pots and pin connected. So it works!
Just a suggestion from my part: It is a must to exclude from the pin_get function the two din that generate this function because there’s no value to read from them and also, if you have some din leftover, exclude also them!
(…)exclude from the pin_get function the two din that generate this function because there’s no value to read from them
yes, like I said that’s because the [tt]DIN_PinGet(pinNumber)[/tt] returns [tt]TRUE[/tt] (1) if the button is NOT pressed and returns [tt]FALSE[/tt] (0) when the button IS pressed. I see this is not very intuitive, but the effect you discovered is quite logic.