MidiThru object


#1

I use this quite frequently, very useful. Too bad it doesn't handle realtime messages, is it because the code to send the messages through isn't quick enough?

I've using several objects in the same project to turn my Axo into a one in three out-box, works great if all the three connections are used but makes the axo crash (!) when one or more aren't. I believe the error messages that showed up in the log were something like ring buffer error but I can't confirm right now.


#2

I have diagnosed and resolved the issue that comes from sending data to the usb host port with no usb-midi device connected. Preparing a new release now...

edit: version 1.0.12 released

@thetechnobear do you know why realtime midi messages are not included in your midithru object?


#3

 
   if(attr_input) {
        uint8_t status_type = status & 0xF0;
            if ((status_type == MIDI_CONTROL_CHANGE) ||
                (status_type == MIDI_NOTE_OFF) ||
                (status_type == MIDI_NOTE_ON) ||
                (status_type == MIDI_POLY_PRESSURE) ||
                (status_type == MIDI_PITCH_BEND)) {
                    MidiSend3((midi_device_t) attr_output,status,data1,data2);
                    flash_cnt = FLASH_LEN;
            } else if ( (status_type == MIDI_PROGRAM_CHANGE) ||
                        (status_type == MIDI_CHANNEL_PRESSURE)) {
                MidiSend2((midi_device_t) attr_output,status,data1);
                flash_cnt = FLASH_LEN;
            }
        }

it is not handled in the code


#4

I made that conclusion too, i just assumed there must be a another reason than a missing 'else' case. ;D


#5

well it is not just a missing else case. since he is comparing status_type, after masking the channels this will not work. so there needs to be a bigger if else case comparing status or even attr_input, i'm not sure what values "status" can hold or if realtime messages are handled there at all...


#6

@johannes

Sounds great :slight_smile:


#7

Here you go:

if(attr_input) 
{
    uint8_t status_type = status & 0xF0;

    switch (status)
    { 
    case MIDI_TIMING_CLOCK: 
    case MIDI_MEASURE_END:
    case MIDI_START:
    case MIDI_CONTINUE:
    case MIDI_STOP: 
        {
            MidiSend1((midi_device_t) attr_output,status);
        }
    break;
    }

    switch (status_type)
    {
    case MIDI_CONTROL_CHANGE:
    case MIDI_NOTE_OFF:
    case MIDI_NOTE_ON:
    case MIDI_POLY_PRESSURE:
    case MIDI_PITCH_BEND: 
        {
            MidiSend3((midi_device_t) attr_output,status,data1,data2);
            flash_cnt = FLASH_LEN;
        }
    break;

    case MIDI_PROGRAM_CHANGE:
    case MIDI_CHANNEL_PRESSURE: 
        {
            MidiSend2((midi_device_t) attr_output,status,data1);
            flash_cnt = FLASH_LEN;
        }
    break;
    }
}

#8

great! makes me wonder, should a midi thru object not be much simpler? as in just copy whatever comes in to the output?