write-event ( prev-status event -- status )


Vocabulary
midi.private

Inputs
prev-statusan object
eventan object


Outputs
statusan object


Definition

GENERIC: write-event ( prev-status event -- status )


Methods

M: meta-event write-event
[ delta>> write-number 255 write1 ] [ value>> ] [ name>> ]
tri {
{ "sequence-number" [ B{ 0 2 } write 2 >be write ] }
{ "text" [ 1 write1 write-string ] }
{ "copyright" [ 2 write1 write-string ] }
{ "track-name" [ 3 write1 write-string ] }
{ "instrument-name" [ 4 write1 write-string ] }
{ "lyrics" [ 5 write1 write-string ] }
{ "marker" [ 6 write1 write-string ] }
{ "cue-point" [ 7 write1 write-string ] }
{ "device-name" [ 9 write1 write-string ] }
{ "channel-prefix" [ B{ 32 1 } write write1 ] }
{ "midi-port" [ B{ 33 1 } write write1 ] }
{ "end-of-track" [ B{ 47 0 } write drop ] }
{ "set-tempo" [ B{ 81 3 } write 3 >be write ] }
{
"smpte-offset"
[
B{ 84 5 } write {
[ "frame-rate" of 6 shift ]
[ "hours" of + write1 ]
[ "minutes" of write1 ]
[ "seconds" of write1 ]
[ "frames" of write1 ]
[ "subframes" of write1 ]
} cleave
]
}
{
"time-signature"
[
B{ 88 4 } write {
[ "numerator" of write1 ]
[ "denominator" of 2 /i write1 ]
[ "clocks-per-tick" of write1 ]
[ "notated-32nd-notes-per-beat" of write1 ]
} cleave
]
}
{
"key-signature"
[ B{ 89 2 } write key-signatures value-at write ]
}
{
"sequencer-specific"
[ 127 write1 [ length write-number ] [ write ] bi ]
}
} case drop f ;



M: midi-event write-event
[ delta>> write-number ] [ value>> ] [ name>> ] tri {
{
"note-off"
[
128 [
[ "note" of write1 ]
[ "velocity" of write1 ] bi
] write-channel
]
}
{
"note-on"
[
144 [
[ "note" of write1 ]
[ "velocity" of write1 ] bi
] write-channel
]
}
{
"polytouch"
[
160 [
[ "note" of write1 ] [ "value" of write1 ]
bi
] write-channel
]
}
{
"control-change"
[
176 [
[ "control" of write1 ]
[ "value" of write1 ] bi
] write-channel
]
}
{
"program-change"
[ 192 [ "program" of write1 ] write-channel ]
}
{
"aftertouch"
[ 208 [ "value" of write1 ] write-channel ]
}
{
"pitchwheel"
[
224 [
"pitch" of min-pitchwheel -
[ 127 bitand write1 ] [ -7 shift write1 ] bi
] write-channel
]
}
{
"sysex"
[ [ drop 240 dup write1 ] dip write 247 write1 ]
}
{
"quarter-made"
[
[ drop 241 dup write1 ] dip
[ "frame-type" of 4 shift ]
[ "frame-value" of + ] bi write1
]
}
{
"songpos"
[
[ drop 242 dup write1 ] dip
[ 127 bitand write1 ] [ -7 shift write1 ] bi
]
}
{ "song-select" [ [ drop 243 dup write1 ] dip write1 ] }
{ "tune-request" [ 2drop 246 dup write1 ] }
{ "clock" [ 2drop 248 dup write1 ] }
{ "start" [ 2drop 250 dup write1 ] }
{ "continue" [ 2drop 251 dup write1 ] }
{ "stop" [ 2drop 252 dup write1 ] }
{ "active-sensing" [ 2drop 254 dup write1 ] }
{ "reset" [ 2drop 255 dup write1 ] }
} case ;