Jump to content

Current pot position


henrygr
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
Share on other sites

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] Function

Best,

Michael

Link to comment
Share on other sites

Hi to all

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!

Thank you very much!!!

Anakin

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 4 years later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...