henrygr Posted October 12, 2007 Report Share Posted October 12, 2007 Hello all,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-Git this far-void MPROC_NotifyReceivedEvnt(unsigned char evnt0, unsigned char evnt1, unsigned char evnt2) __wparam { if (evnt0 == 0xb0 && evnt1 == 0x7F)Okay. So that's the easy bit.Any help??Cheers.Mark Quote Link to comment Share on other sites More sharing options...
stryd_one Posted October 12, 2007 Report Share Posted October 12, 2007 unsigned char i; unsigned char MyArray[num_ains]; for (i = 0 ; i <= num_ains ; i++) { MyArray[(i)] = MIOS_AIN_Pin7bitGet(i); } It's 05:14. If that code actually works it's a miracle ;) It's just pseudocode, i hope you get the idea :) Quote Link to comment Share on other sites More sharing options...
henrygr Posted October 12, 2007 Author Report Share Posted October 12, 2007 Thanks. Didi the job. Go to bed. :o Quote Link to comment Share on other sites More sharing options...
anakin Posted November 5, 2007 Report Share Posted November 5, 2007 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?Thank you very much!Anakin Quote Link to comment Share on other sites More sharing options...
audiocommander Posted November 6, 2007 Report Share Posted November 6, 2007 Hi Anakin,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] FunctionBest,Michael Quote Link to comment Share on other sites More sharing options...
anakin Posted November 8, 2007 Report Share Posted November 8, 2007 Hi to allOk, 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!Thank you very much!!!Anakin Quote Link to comment Share on other sites More sharing options...
audiocommander Posted November 8, 2007 Report Share Posted November 8, 2007 Hi Anakin,nice to hear that :)(...)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.Best,Michael Quote Link to comment Share on other sites More sharing options...
dinama Posted May 17, 2012 Report Share Posted May 17, 2012 i read your post on read current pot position in c programming forum. my problem is to read the current pot position on startup and send to midi out. can you send me a solution? (maybe a text file of a new main.inc of midibox64) i'm not a programmer. Is there a similar solution for reading at startup the current position of din and send it to midi out? thank for answer. Quote Link to comment Share on other sites More sharing options...
TK. Posted May 17, 2012 Report Share Posted May 17, 2012 Duplicate: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.