pub fn next_message_given_status(stat: u8, reader: &mut dyn Read) -> Result<MidiMessage, MidiError> {
        let mut ret:Vec<u8> = Vec::with_capacity(3);
        ret.push(stat);
        match MidiMessage::data_bytes(stat) {
            0 => {}
            1 => { ret.push(read_byte(reader)?); }
            2 => { ret.push(read_byte(reader)?);
                   ret.push(read_byte(reader)?); }
            -1 => { return Err(MidiError::OtherErr("Don't handle variable sized yet")); }
            -2 => {
                // skip SysEx message
                while {
                    let byte = read_byte(reader)?;
                    ret.push(byte);
                    byte != Status::SysExEnd as u8
                } {}
            }
            _ =>  { return Err(MidiError::InvalidStatus(stat)); }
        }
        Ok(MidiMessage{data: ret})
    }
/// Get the next midi message from the reader given that the
/// status `stat` has just been read
Get the next midi message from the reader given that the
status `stat` has just been read
Get the next midi message from the reader given that the status ` stat ` has just been read
pub fn next_message_given_status(stat: u8, reader: &mut dyn Read) -> Result<MidiMessage, MidiError> {
        let mut ret:Vec<u8> = Vec::with_capacity(3);
        ret.push(stat);
        match MidiMessage::data_bytes(stat) {
            0 => {}
            1 => { ret.push(read_byte(reader)?); }
            2 => { ret.push(read_byte(reader)?);
                   ret.push(read_byte(reader)?); }
            -1 => { return Err(MidiError::OtherErr("Don't handle variable sized yet")); }
            -2 => {
                // skip SysEx message
                while {
                    let byte = read_byte(reader)?;
                    ret.push(byte);
                    byte != Status::SysExEnd as u8
                } {}
            }
            _ =>  { return Err(MidiError::InvalidStatus(stat)); }
        }
        Ok(MidiMessage{data: ret})
    }
pub fn next_message_given_status ( stat : u8 , reader : & mut dyn Read ) -> Result < MidiMessage , MidiError > { let mut ret : Vec < u8 > = Vec :: with_capacity ( 3 ) ; ret . push ( stat ) ; match MidiMessage :: data_bytes ( stat ) { 0 => { } 1 => { ret . push ( read_byte ( reader ) ? ) ; } 2 => { ret . push ( read_byte ( reader ) ? ) ; ret . push ( read_byte ( reader ) ? ) ; } - 1 => { return Err ( MidiError :: OtherErr ( " " ) ) ; } - 2 => { // skip SysEx message while { let byte = read_byte ( reader ) ? ; ret . push ( byte ) ; byte != Status :: SysExEnd as u8 } { } } _ => { return Err ( MidiError :: InvalidStatus ( stat ) ) ; } } Ok ( MidiMessage { data : ret } ) }
Get the next midi message from the reader given that the
status `stat` has just been read
Get the next midi message from the reader given that the status ` stat ` has just been read
stat
u8
reader
&mut dyn Read
stat
u8
reader
&mut dyn Read