Sign in to follow this  
Followers 0
CatOrg

Modifying the DIN-Program

3 posts in this topic

Hello,

I would like to avoid MIDIOX for mapping the output of the Midibox-cores, so I think of modifying the program "Sending MIDI events on button movements" (/Ucapps/Programming/MIOS 8 C Interface). I understand that modifying this way would do the trick for configuring the channel:

MIOS_MIDI_TxBufferPut(0x90); // Note Event at channel #1

MIOS_MIDI_TxBufferPut(0x91); // Note Event at channel #2

MIOS_MIDI_TxBufferPut(0x92); // Note Event at channel #3

etc

But I need also to set first note number to 36, and thats my question. I suppose it is from general interest, since many musician use anyway 5-octaves-keyboard.

If I modify

MIOS_SRIO_NumberSet(16); // for 128 pins

this way, I suppose I'll get the notes 0-63

MIOS_SRIO_NumberSet(8); // for 64 pins

So I understand I must set the value of 36 as first note number in the DIN_NotifyToggle part of the program, is it the right way to write:

void DIN_NotifyToggle(unsigned char pin, 24) __wparam ; // 24 ist hex for 36

or must it be:

void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) __wparam

{

MIOS_MIDI_TxBufferPut(0x90); // Note Event at channel #1

MIOS_MIDI_TxBufferPut(0x24); // begin with pin #36

MIOS_MIDI_TxBufferPut(pin); // just forward the pin number (36..96)

MIOS_MIDI_TxBufferPut(pin_value ? 0x00 : 0x7f); // Velocity = 0x7f when

// button pressed, else 0x00

}

?

Or something else? Excuse me, but my notions of programation are very basical...

Thanks in advance,

Francois

Share this post


Link to post
Share on other sites

/////////////////////////////////////////////////////////////////////////////

// This function is called by MIOS when an button has been toggled

// pin_value is 1 when button released, and 0 when button pressed

/////////////////////////////////////////////////////////////////////////////

void DIN_NotifyToggle(unsigned char pin, unsigned char pin_value) __wparam

{

  MIOS_MIDI_TxBufferPut(0x90); // Note Event at channel #1

  MIOS_MIDI_TxBufferPut(pin+offset);  // just forward the pin number (0..127)

  MIOS_MIDI_TxBufferPut(pin_value ? 0x00 : 0x7f); // Velocity = 0x7f when 

                                                  // button pressed, else 0x00

}
in which
offset

is the transposition you want to apply. E.g., if you want your notes to be played one octave higher, then offset = 12.

Hope that helps, ilmenator

Share this post


Link to post
Share on other sites

Hi Ilmenator, best thanks to you,

This is what I was searching!

:-)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0