diff options
author | Robin Gareus <robin@gareus.org> | 2015-03-10 19:33:05 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-03-10 22:15:44 +0100 |
commit | 3139b7e9804496395beb787622d5de90266b8e4a (patch) | |
tree | bda4376a562f77819b1ae66f3d4042a19931bb30 /libs/ardour/midi_diskstream.cc | |
parent | f214488d0f05af736427cf82868fee4e05e1febb (diff) |
prototype basic midi varispeed
Diffstat (limited to 'libs/ardour/midi_diskstream.cc')
-rw-r--r-- | libs/ardour/midi_diskstream.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 7b196e1fd0..ae0828a3a4 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -528,18 +528,38 @@ MidiDiskstream::process (BufferSet& bufs, framepos_t transport_frame, pframes_t playback_distance = nframes; +#ifndef NO_SIMPLE_MIDI_VARISPEED + if (_target_speed > 0) { + playback_distance = nframes * _target_speed; + } +#endif + } if (need_disk_signal) { /* copy the diskstream data to all output buffers */ MidiBuffer& mbuf (bufs.get_midi (0)); +#ifndef NO_SIMPLE_MIDI_VARISPEED + get_playback (mbuf, nframes * _target_speed); +#else get_playback (mbuf, nframes); - +#endif + /* leave the audio count alone */ ChanCount cnt (DataType::MIDI, 1); cnt.set (DataType::AUDIO, bufs.count().n_audio()); bufs.set_count (cnt); + +#ifndef NO_SIMPLE_MIDI_VARISPEED + if (_target_speed > 0 && playback_distance != nframes) { + MidiBuffer& mbuf (bufs.get_midi (0)); + for (MidiBuffer::iterator i = mbuf.begin(); i != mbuf.end(); ++i) { + MidiBuffer::TimeType *tme = i.timeptr(); + *tme = (*tme) / _target_speed; + } + } +#endif } return 0; @@ -548,10 +568,14 @@ MidiDiskstream::process (BufferSet& bufs, framepos_t transport_frame, pframes_t frameoffset_t MidiDiskstream::calculate_playback_distance (pframes_t nframes) { +#ifndef NO_SIMPLE_MIDI_VARISPEED + frameoffset_t playback_distance = nframes * _target_speed; +#else frameoffset_t playback_distance = nframes; /* XXX: should be doing varispeed stuff once it's implemented in ::process() above */ +#endif if (_actual_speed < 0.0) { return -playback_distance; } else { |