you can create a meta event for such a behaviour, but this won’t work with the virtual midibox (which doesn’t support all features of the original MIDIbox)
I’m building a very simple pedalboard midi controller ( just built) using midio128 as app. It work good, only send note_on note_off messages depending on key pressed.
Obviously I change for my needings the ini files for range of notes.
Now I would like to expand it adding two addition buttons: one for increase program change and one for decrease it.
I think it is quite clear that I can’t use the ini file for do this because it is not implemented in the code, so I need to code something new.
I want to use Midio128 as it is so simple and direct, but I don’t know how to do this in the code ( and where…) Any suggestions?
I’m considering also to use other applications maybe in C ( maybe easier for me to code in) but using something like ain64_din128_dout128_v2_0 I need to make also modification in the hardware ( put all analogs to ground).
I look also this post ( yes, I used the search!!!) that is exactly what I need but I can’t understand how to do…
Just for contribute to the forum, I was able to code something for this with a help from a friend of mine
something like this:
/////////////////////////////////////////////////////////////////////////////
// Local variables
/////////////////////////////////////////////////////////////////////////////
// Store Program Change Number
int CurrentPC = 0;
// Define higher program change number
#define MAXPCNUM 63
/////////////////////////////////////////////////////////////////////////////
// This function is called by MIOS when an button has been toggled
// pin_value is 1 when button released, and 0 when button pressed
/////////////////////////////////////////////////////////////////////////////
if (pin == 13 && pin_value == 1)
{
CurrentPC++;
if (CurrentPC > MAXPCNUM ) CurrentPC = MAXPCNUM;
MIOS_MIDI_BeginStream();
MIOS_MIDI_TxBufferPut(0xC0); // Program Change Event
MIOS_MIDI_TxBufferPut(CurrentPC); // Program Change Number
MIOS_MIDI_EndStream();
}
if (pin == 14 && pin_value == 1)
{
CurrentPC--;
if (CurrentPC < 0 ) CurrentPC = 0;
MIOS_MIDI_BeginStream();
MIOS_MIDI_TxBufferPut(0xC0); // Program Change Event
MIOS_MIDI_TxBufferPut(CurrentPC); // Program Change Number
MIOS_MIDI_EndStream();
}
Looks good, anakin. I made some tiny changes which make it look a bit nicer to me
#define MAXPCNUM 63 // Define higher program change number
unsigned char CurrentPC = 0; // Store Program Change Number
/////////////////////////////////////////////////////////////////////////////
// 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 {
if (!pin_value) return;
if (pin == 13) {
CurrentPC = (CurrentPC < MAXPCNUM) ? CurrentPC++ : MAXPCNUM;
MIOS_MIDI_BeginStream();
MIOS_MIDI_TxBufferPut(0xC0); // Program Change Event
MIOS_MIDI_TxBufferPut(CurrentPC); // Program Change Number
MIOS_MIDI_EndStream();
}
if (pin == 14) {
CurrentPC = (CurrentPC > 0) ? CurrentPC-- : 0;
MIOS_MIDI_BeginStream();
MIOS_MIDI_TxBufferPut(0xC0); // Program Change Event
MIOS_MIDI_TxBufferPut(CurrentPC); // Program Change Number
MIOS_MIDI_EndStream();
}
}[/code]