read-message ( delta type -- message )


Vocabulary
midi.private

Inputs
deltaan object
typean object


Outputs
messagean object


Definition


: read-message ( delta type -- message )
dup 240 < [
[
[ 15 bitand "channel" ,, ] [ 240 bitand ] bi {
{
128
[
"note-off" read1 "note" ,,
read1 "velocity" ,,
]
}
{
144
[
"note-on" read1 "note" ,,
read1 "velocity" ,,
]
}
{
160
[
"polytouch" read1 "note" ,,
read1 "value" ,,
]
}
{
176
[
"control-change" read1 "control" ,,
read1 "value" ,,
]
}
{ 192 [ "program-change" read1 "program" ,, ] }
{ 208 [ "aftertouch" read1 "value" ,, ] }
{
224
[
"pitchwheel" read1 read1 7 shift +
min-pitchwheel + "pitch" ,,
]
}
} case
] H{ } make
] [
{
{ 240 [ "sysex" { 247 } read-until drop ] }
{
241
[
"quarter-made"
[ read1 ~quotation~ ~quotation~ bi ] H{ }
make
]
}
{ 242 [ "songpos" read1 read1 7 shift + ] }
{ 243 [ "song-select" read1 ] }
{ 246 [ "tune-request" f ] }
{ 248 [ "clock" f ] }
{ 250 [ "start" f ] }
{ 251 [ "continue" f ] }
{ 252 [ "stop" f ] }
{ 254 [ "active-sensing" f ] }
{ 255 [ "reset" f ] }
} case
] if <midi-event> ;