From 0006f4d8cd65eeaaf66517c02f987b0c40282c65 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 3 Jun 2023 19:08:20 +0200 Subject: [PATCH] Dummy: add MMC test sequence --- libs/backends/dummy/dummy_audiobackend.cc | 40 ++++++++++++++++++++++- libs/backends/dummy/dummy_midi_seq.h | 10 ++++-- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/libs/backends/dummy/dummy_audiobackend.cc b/libs/backends/dummy/dummy_audiobackend.cc index ffae6273ae..9c757d95ab 100644 --- a/libs/backends/dummy/dummy_audiobackend.cc +++ b/libs/backends/dummy/dummy_audiobackend.cc @@ -1738,7 +1738,45 @@ void DummyMidiPort::midi_generate (const pframes_t n_samples) return; } - if (_midi_seq_dat[0].beat_time < -1) { + if (_midi_seq_dat[0].beat_time < -2) { + static const uint8_t mmc_seq[][14] = { + {13, 0xf0, 0x7f, 0x7f, 0x06, 0x44, 0x06, 0x01, // Locate to 00:01:02:03 + /*H*/ 0x00, /*M*/ 0x01, /*S*/ 0x02, /*F*/ 0x03, /*SF*/ 0x00, 0xf7}, + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x01, 0xf7}, // Stop + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x02, 0xf7}, // Play + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x01, 0xf7}, // Stop + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x04, 0xf7}, // Fast Foward + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x02, 0xf7}, // Roll + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x05, 0xf7}, // Rewind + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x01, 0xf7}, // Stop + {13, 0xf0, 0x7f, 0x7f, 0x06, 0x44, 0x06, 0x01, // Locate to 00:00:00:00 + /*H*/ 0x00, /*M*/ 0x00, /*S*/ 0x00, /*F*/ 0x00, /*SF*/ 0x00, 0xf7}, + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x03, 0xf7}, // Deferred Play + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x09, 0xf7}, // Pause + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x06, 0xf7}, // Record Strobe (implies play) + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x07, 0xf7}, // Record Exit (keeps rolling) + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x08, 0xf7}, // Record Pause (rec again) + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x09, 0xf7}, // Pause + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x01, 0xf7}, // Stop + {10, 0xf0, 0x7f, 0x7f, 0x06, 0x47, 0x03, // Shuttle (set speed) + /*SH*/ 0x02, /*SM*/ 0x40, /*SL*/ 0x00, 0xf7}, // 2 + 8192 / 16384 + { 6, 0xf0, 0x7f, 0x7f, 0x06, 0x02, 0xf7}, // Play + // TODO cmdStep(0x48), cmdWrite(0x40/0x41)+recArm(0x4f), cmdWrite(0x40/0x41)+mute(0x62) + }; + /* MMC */ + pframes_t pp = pulse_position (); + if (pp < n_samples - 1) { + static const int dly_sec = 3; + int n_cmds = sizeof (mmc_seq) / sizeof (mmc_seq[0]); + if (0 == (_midi_seq_time % dly_sec)) { + int seq = _midi_seq_time / dly_sec; + _buffer.push_back (std::shared_ptr(new DummyMidiEvent (pp, &mmc_seq[seq][1], mmc_seq[seq][0]))); + } + _midi_seq_time = (_midi_seq_time + 1) % (dly_sec * n_cmds); + } + return; + + } else if (_midi_seq_dat[0].beat_time < -1) { /* MTC generator */ const int audio_samples_per_video_frame = _midi_seq_spb; // sample-rate / 25 const int audio_samples_per_qf = audio_samples_per_video_frame / 4; diff --git a/libs/backends/dummy/dummy_midi_seq.h b/libs/backends/dummy/dummy_midi_seq.h index 94a5b9cda7..69b348238c 100644 --- a/libs/backends/dummy/dummy_midi_seq.h +++ b/libs/backends/dummy/dummy_midi_seq.h @@ -787,8 +787,13 @@ static const MIDISequence s9[] = { {-1.0, 0, {0} }, // MClk Generator }; +static const MIDISequence s10[] = { + {-3.0, 0, {0} }, // MMC Generator +}; + + static const MIDISequence *sequences[] = { - s0, s1, s2, s3, s4, s5, s6, s7, s8, s9 + s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10 }; static const char *sequence_names[] = { @@ -801,7 +806,8 @@ static const char *sequence_names[] = { "Aftertouch", "Nonsense, Dups", "MTC 25fps", - "MClk 120 BPM" + "MClk 120 BPM", + "MMC SysEx" }; }} // namespace