Skip to content

Instantly share code, notes, and snippets.

@kfigiela
Created April 1, 2014 13:21
Show Gist options
  • Save kfigiela/9913871 to your computer and use it in GitHub Desktop.
Save kfigiela/9913871 to your computer and use it in GitHub Desktop.
Denon hc4500 mbed midi parser
void track_name(char lcd_col, char lcd_row, char lcd_data);
char tn_byteA, tn_byteB;
void show_message(MIDIMessage msg) {
char tn_output, tn_byte2;
if(msg.type() == MIDIMessage::ControlChangeType && msg.channel() == 0) {
if(msg.controller() >= 0x00 && msg.controller() <= 0x0D) {
tn_byteA = (msg.value() << 4);
} else if(msg.controller() >= 0x0E && msg.controller() <= 0x19) {
tn_byteB = (msg.value() << 4);
} else if(msg.controller() >= 0x21 && msg.controller() <= 0x2d) {
tn_byte2 = msg.value();
tn_output = tn_byteA | tn_byte2;
track_name( msg.controller() - 0x21 , 0 , tn_output);
} else if(msg.controller() >= 0x2e && msg.controller() <= 0x39) {
tn_byte2 = msg.value();
tn_output = tn_byteB | tn_byte2;
track_name( msg.controller()-0x2e , 1 , tn_output);
}
}
}
void track_name(char lcd_col, char lcd_row, char lcd_data){
lcd.locate(lcd_col , lcd_row);
lcd.printf("%c", lcd_data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment