diff options
author | David Robillard <d@drobilla.net> | 2007-06-26 04:16:17 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-06-26 04:16:17 +0000 |
commit | 72b0e4399c2008cd507a339df04ac94ef859c8e8 (patch) | |
tree | e41f65f6778b952400260d921f404bb586c1d0aa /libs | |
parent | e9b1b7110ba49103af8e99547c3a165526a80b14 (diff) |
(Untested) loop recording support in MIDI Diskstream (fix compilation broken by loop recording changes).
git-svn-id: svn://localhost/ardour2/trunk@2036 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/midi_diskstream.h | 3 | ||||
-rw-r--r-- | libs/ardour/midi_diskstream.cc | 29 |
2 files changed, 32 insertions, 0 deletions
diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index cf78d0d05b..be329b4704 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -127,6 +127,7 @@ class MidiDiskstream : public Diskstream void finish_capture (bool rec_monitors_input); void transport_stopped (struct tm&, time_t, bool abort); + void transport_looped (nframes_t transport_frame); void init (Diskstream::Flag); @@ -145,6 +146,8 @@ class MidiDiskstream : public Diskstream void engage_record_enable (); void disengage_record_enable (); + /* FIXME: too much code duplication in this class because of lack of ChannelInfo */ + MidiRingBuffer* _playback_buf; MidiRingBuffer* _capture_buf; MidiPort* _source_port; diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 0626f6d423..9114f689b2 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -1107,6 +1107,35 @@ MidiDiskstream::transport_stopped (struct tm& when, time_t twhen, bool abort_cap } void +MidiDiskstream::transport_looped (nframes_t transport_frame) +{ + if (was_recording) { + + // adjust the capture length knowing that the data will be recorded to disk + // only necessary after the first loop where we're recording + if (capture_info.size() == 0) { + capture_captured += _capture_offset; + + if (_alignment_style == ExistingMaterial) { + capture_captured += _session.worst_output_latency(); + } else { + capture_captured += _roll_delay; + } + } + + finish_capture (true); + + // the next region will start recording via the normal mechanism + // we'll set the start position to the current transport pos + // no latency adjustment or capture offset needs to be made, as that already happened the first time + capture_start_frame = transport_frame; + first_recordable_frame = transport_frame; // mild lie + last_recordable_frame = max_frames; + was_recording = true; + } +} + +void MidiDiskstream::finish_capture (bool rec_monitors_input) { was_recording = false; |