mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
Fix MIDI monitoring while recording.
git-svn-id: svn://localhost/ardour2/branches/3.0@5043 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
c892bc35c8
commit
cefbb08c40
4 changed files with 23 additions and 22 deletions
|
|
@ -81,6 +81,8 @@ class MidiDiskstream : public Diskstream
|
||||||
|
|
||||||
void monitor_input (bool);
|
void monitor_input (bool);
|
||||||
|
|
||||||
|
MidiRingBuffer<nframes_t>* playback_buffer () { return _playback_buf; }
|
||||||
|
MidiRingBuffer<nframes_t>* capture_buffer () { return _capture_buf; }
|
||||||
boost::shared_ptr<SMFSource> write_source () { return _write_source; }
|
boost::shared_ptr<SMFSource> write_source () { return _write_source; }
|
||||||
|
|
||||||
int set_destructive (bool yn); // doom!
|
int set_destructive (bool yn); // doom!
|
||||||
|
|
|
||||||
|
|
@ -772,10 +772,13 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
memcpy ((char *) chaninfo->playback_wrap_buffer, chaninfo->playback_vector.buf[0],
|
memcpy ((char *) chaninfo->playback_wrap_buffer,
|
||||||
|
chaninfo->playback_vector.buf[0],
|
||||||
chaninfo->playback_vector.len[0] * sizeof (Sample));
|
chaninfo->playback_vector.len[0] * sizeof (Sample));
|
||||||
memcpy (chaninfo->playback_wrap_buffer + chaninfo->playback_vector.len[0], chaninfo->playback_vector.buf[1],
|
memcpy (chaninfo->playback_wrap_buffer + chaninfo->playback_vector.len[0],
|
||||||
(necessary_samples - chaninfo->playback_vector.len[0]) * sizeof (Sample));
|
chaninfo->playback_vector.buf[1],
|
||||||
|
(necessary_samples - chaninfo->playback_vector.len[0])
|
||||||
|
* sizeof (Sample));
|
||||||
|
|
||||||
chaninfo->current_playback_buffer = chaninfo->playback_wrap_buffer;
|
chaninfo->current_playback_buffer = chaninfo->playback_wrap_buffer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -424,7 +424,7 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_
|
||||||
nframes_t rec_nframes = 0;
|
nframes_t rec_nframes = 0;
|
||||||
bool nominally_recording;
|
bool nominally_recording;
|
||||||
bool re = record_enabled ();
|
bool re = record_enabled ();
|
||||||
bool collect_playback = false;
|
bool collect_playback = true;
|
||||||
|
|
||||||
/* if we've already processed the frames corresponding to this call,
|
/* if we've already processed the frames corresponding to this call,
|
||||||
just return. this allows multiple routes that are taking input
|
just return. this allows multiple routes that are taking input
|
||||||
|
|
@ -537,27 +537,23 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_
|
||||||
|
|
||||||
if (rec_nframes) {
|
if (rec_nframes) {
|
||||||
|
|
||||||
/* XXX XXX XXX XXX XXX XXX XXX XXX */
|
|
||||||
|
|
||||||
/* data will be written to disk */
|
/* data will be written to disk */
|
||||||
|
|
||||||
if (rec_nframes == nframes && rec_offset == 0) {
|
if (rec_nframes == nframes && rec_offset == 0) {
|
||||||
playback_distance = nframes;
|
playback_distance = nframes;
|
||||||
} else {
|
|
||||||
collect_playback = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
adjust_capture_position = rec_nframes;
|
adjust_capture_position = rec_nframes;
|
||||||
|
|
||||||
} else if (nominally_recording) {
|
} else if (nominally_recording) {
|
||||||
|
|
||||||
|
cerr << "B" << endl;
|
||||||
|
|
||||||
/* can't do actual capture yet - waiting for latency effects to finish before we start*/
|
/* can't do actual capture yet - waiting for latency effects to finish before we start*/
|
||||||
|
|
||||||
playback_distance = nframes;
|
playback_distance = nframes;
|
||||||
|
collect_playback = false;
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
collect_playback = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collect_playback) {
|
if (collect_playback) {
|
||||||
|
|
@ -574,10 +570,13 @@ MidiDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_
|
||||||
necessary_samples = nframes;
|
necessary_samples = nframes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX
|
// Pump entire port buffer into playback buffer (FIXME: split cycles?)
|
||||||
// Write into playback buffer here, and whatnot?
|
MidiBuffer& buf = _source_port->get_midi_buffer(nframes);
|
||||||
//cerr << "MDS FIXME: collect playback" << endl;
|
for (MidiBuffer::iterator i = buf.begin(); i != buf.end(); ++i) {
|
||||||
|
const Evoral::MIDIEvent<MidiBuffer::TimeType> ev(*i, false);
|
||||||
|
assert(ev.buffer());
|
||||||
|
_playback_buf->write(ev.time() + transport_frame, ev.type(), ev.size(), ev.buffer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
@ -1416,9 +1415,7 @@ void
|
||||||
MidiDiskstream::monitor_input (bool yn)
|
MidiDiskstream::monitor_input (bool yn)
|
||||||
{
|
{
|
||||||
if (_source_port)
|
if (_source_port)
|
||||||
_source_port->request_monitor_input (yn);
|
_source_port->ensure_monitor_input (yn);
|
||||||
else
|
|
||||||
cerr << "MidiDiskstream NO SOURCE PORT TO MONITOR\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -494,7 +494,6 @@ MidiTrack::roll (nframes_t nframes, nframes_t start_frame, nframes_t end_frame,
|
||||||
if ((dret = diskstream->process (transport_frame, nframes, can_record, rec_monitors_input)) != 0) {
|
if ((dret = diskstream->process (transport_frame, nframes, can_record, rec_monitors_input)) != 0) {
|
||||||
|
|
||||||
silence (nframes);
|
silence (nframes);
|
||||||
|
|
||||||
return dret;
|
return dret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue