13
0

prototype basic midi varispeed

This commit is contained in:
Robin Gareus 2015-03-10 19:33:05 +01:00
parent f214488d0f
commit 3139b7e980

View File

@ -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 {