- // FIXME: waaay too much code to duplicate (AudioDiskstream)
-
- int possibly_recording;
- int rolling;
- int change;
- const int transport_rolling = 0x4;
- const int track_rec_enabled = 0x2;
- const int global_rec_enabled = 0x1;
-
- /* merge together the 3 factors that affect record status, and compute
- what has changed.
- */
-
- rolling = _session.transport_speed() != 0.0f;
- possibly_recording = (rolling << 2) | (record_enabled() << 1) | can_record;
- change = possibly_recording ^ last_possibly_recording;
-
- if (possibly_recording == last_possibly_recording) {
- return;
- }
-
- /* change state */
-
- /* if per-track or global rec-enable turned on while the other was already on, we've started recording */
-
- if (((change & track_rec_enabled) && record_enabled() && (!(change & global_rec_enabled) && can_record)) ||
- ((change & global_rec_enabled) && can_record && (!(change & track_rec_enabled) && record_enabled()))) {
-
- /* starting to record: compute first+last frames */
-
- first_recordable_frame = transport_frame + _capture_offset;
- last_recordable_frame = max_frames;
- capture_start_frame = transport_frame;
-
- if (!(last_possibly_recording & transport_rolling) && (possibly_recording & transport_rolling)) {
-
- /* was stopped, now rolling (and recording) */
-
- if (_alignment_style == ExistingMaterial) {
- first_recordable_frame += _session.worst_output_latency();
- } else {
- first_recordable_frame += _roll_delay;
- }
-
+ using namespace MIDI;
+ eventType type;
+ const char trace_prefix = ':';
+
+ type = (eventType) (msg[0]&0xF0);
+
+ switch (type) {
+ case off:
+ o << trace_prefix
+ << "Channel "
+ << (msg[0]&0xF)+1
+ << " NoteOff NoteNum "
+ << (int) msg[1]
+ << " Vel "
+ << (int) msg[2]
+ << endl;
+ break;
+
+ case on:
+ o << trace_prefix
+ << "Channel "
+ << (msg[0]&0xF)+1
+ << " NoteOn NoteNum "
+ << (int) msg[1]
+ << " Vel "
+ << (int) msg[2]
+ << endl;
+ break;
+
+ case polypress:
+ o << trace_prefix
+ << "Channel "
+ << (msg[0]&0xF)+1
+ << " PolyPressure"
+ << (int) msg[1]
+ << endl;
+ break;
+
+ case MIDI::controller:
+ o << trace_prefix
+ << "Channel "
+ << (msg[0]&0xF)+1
+ << " Controller "
+ << (int) msg[1]
+ << " Value "
+ << (int) msg[2]
+ << endl;
+ break;
+
+ case program:
+ o << trace_prefix
+ << "Channel "
+ << (msg[0]&0xF)+1
+ << " Program Change ProgNum "
+ << (int) msg[1]
+ << endl;
+ break;
+
+ case chanpress:
+ o << trace_prefix
+ << "Channel "
+ << (msg[0]&0xF)+1
+ << " Channel Pressure "
+ << (int) msg[1]
+ << endl;
+ break;
+
+ case MIDI::pitchbend:
+ o << trace_prefix
+ << "Channel "
+ << (msg[0]&0xF)+1
+ << " Pitch Bend "
+ << ((msg[2]<<7)|msg[1])
+ << endl;
+ break;
+
+ case MIDI::sysex:
+ if (len == 1) {
+ switch (msg[0]) {
+ case 0xf8:
+ o << trace_prefix
+ << "Clock"
+ << endl;
+ break;
+ case 0xfa:
+ o << trace_prefix
+ << "Start"
+ << endl;
+ break;
+ case 0xfb:
+ o << trace_prefix
+ << "Continue"
+ << endl;
+ break;
+ case 0xfc:
+ o << trace_prefix
+ << "Stop"
+ << endl;
+ break;
+ case 0xfe:
+ o << trace_prefix
+ << "Active Sense"
+ << endl;
+ break;
+ case 0xff:
+ o << trace_prefix
+ << "System Reset"
+ << endl;
+ break;
+ default:
+ o << trace_prefix
+ << "System Exclusive (1 byte : " << hex << (int) *msg << dec << ')'
+ << endl;
+ break;
+ }