prototype basic midi varispeed
This commit is contained in:
parent
f214488d0f
commit
3139b7e980
@ -528,18 +528,38 @@ MidiDiskstream::process (BufferSet& bufs, framepos_t transport_frame, pframes_t
|
|||||||
|
|
||||||
playback_distance = nframes;
|
playback_distance = nframes;
|
||||||
|
|
||||||
|
#ifndef NO_SIMPLE_MIDI_VARISPEED
|
||||||
|
if (_target_speed > 0) {
|
||||||
|
playback_distance = nframes * _target_speed;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_disk_signal) {
|
if (need_disk_signal) {
|
||||||
/* copy the diskstream data to all output buffers */
|
/* copy the diskstream data to all output buffers */
|
||||||
|
|
||||||
MidiBuffer& mbuf (bufs.get_midi (0));
|
MidiBuffer& mbuf (bufs.get_midi (0));
|
||||||
|
#ifndef NO_SIMPLE_MIDI_VARISPEED
|
||||||
|
get_playback (mbuf, nframes * _target_speed);
|
||||||
|
#else
|
||||||
get_playback (mbuf, nframes);
|
get_playback (mbuf, nframes);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* leave the audio count alone */
|
/* leave the audio count alone */
|
||||||
ChanCount cnt (DataType::MIDI, 1);
|
ChanCount cnt (DataType::MIDI, 1);
|
||||||
cnt.set (DataType::AUDIO, bufs.count().n_audio());
|
cnt.set (DataType::AUDIO, bufs.count().n_audio());
|
||||||
bufs.set_count (cnt);
|
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;
|
return 0;
|
||||||
@ -548,10 +568,14 @@ MidiDiskstream::process (BufferSet& bufs, framepos_t transport_frame, pframes_t
|
|||||||
frameoffset_t
|
frameoffset_t
|
||||||
MidiDiskstream::calculate_playback_distance (pframes_t nframes)
|
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;
|
frameoffset_t playback_distance = nframes;
|
||||||
|
|
||||||
/* XXX: should be doing varispeed stuff once it's implemented in ::process() above */
|
/* XXX: should be doing varispeed stuff once it's implemented in ::process() above */
|
||||||
|
|
||||||
|
#endif
|
||||||
if (_actual_speed < 0.0) {
|
if (_actual_speed < 0.0) {
|
||||||
return -playback_distance;
|
return -playback_distance;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user