diff options
author | Carl Hetherington <carl@carlh.net> | 2011-10-31 21:17:08 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-10-31 21:17:08 +0000 |
commit | 5dba72c874def27bef3ba3fe7a5cf2414e77aadb (patch) | |
tree | d4a41d2aca384122422d72a850b19ef46627488e /libs/ardour | |
parent | d47e9247dfba27d198b8a0c43cef5553fc40745d (diff) |
Take commit() out of process() in both types of
diskstream, and call commit() where appropriate.
git-svn-id: svn://localhost/ardour2/branches/3.0@10361 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/audio_diskstream.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/diskstream.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/midi_diskstream.h | 2 | ||||
-rw-r--r-- | libs/ardour/audio_diskstream.cc | 18 | ||||
-rw-r--r-- | libs/ardour/audio_track.cc | 14 | ||||
-rw-r--r-- | libs/ardour/midi_diskstream.cc | 14 | ||||
-rw-r--r-- | libs/ardour/midi_track.cc | 15 | ||||
-rw-r--r-- | libs/ardour/track.cc | 5 |
8 files changed, 38 insertions, 34 deletions
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h index a1b16b394c..ab7c27c4f3 100644 --- a/libs/ardour/ardour/audio_diskstream.h +++ b/libs/ardour/ardour/audio_diskstream.h @@ -151,7 +151,7 @@ class AudioDiskstream : public Diskstream protected: friend class AudioTrack; - int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler); + int process (framepos_t transport_frame, pframes_t nframes, framecnt_t &); bool commit (framecnt_t); private: diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index cfccd48e1f..cd7af80f9e 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -182,7 +182,7 @@ class Diskstream : public SessionObject, public PublicDiskstream protected: friend class Track; - virtual int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler) = 0; + virtual int process (framepos_t transport_frame, pframes_t nframes, framecnt_t &) = 0; virtual bool commit (framecnt_t) = 0; //private: diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h index 9ce1ee0eb1..1bb9746d6b 100644 --- a/libs/ardour/ardour/midi_diskstream.h +++ b/libs/ardour/ardour/midi_diskstream.h @@ -142,7 +142,7 @@ class MidiDiskstream : public Diskstream protected: friend class MidiTrack; - int process (framepos_t transport_frame, pframes_t nframes, bool& need_butler); + int process (framepos_t transport_frame, pframes_t nframes, framecnt_t &); bool commit (framecnt_t nframes); static framecnt_t midi_readahead; diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index e5ae9a1506..51a3b72bf6 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -415,18 +415,17 @@ AudioDiskstream::prepare_record_status(framepos_t capture_start_frame) * that someone can read playback_distance worth of data from. */ int -AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& need_butler) +AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, framecnt_t& playback_distance) { uint32_t n; boost::shared_ptr<ChannelList> c = channels.reader(); ChannelList::iterator chan; - int ret = -1; framecnt_t rec_offset = 0; framecnt_t rec_nframes = 0; bool collect_playback = false; bool can_record = _session.actively_recording (); - framecnt_t playback_distance = 0; + playback_distance = 0; if (!_io || !_io->active()) { return 0; @@ -511,7 +510,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n if (rec_nframes > total) { DiskOverrun (); - goto out; + return -1; } boost::shared_ptr<AudioPort> const ap = _io->audio (n); @@ -617,7 +616,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n cerr << _name << " Need " << necessary_samples << " total = " << total << endl; cerr << "underrun for " << _name << endl; DiskUnderrun (); - goto out; + return -1; } else { @@ -663,14 +662,7 @@ AudioDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& n _speed = _target_speed; } - ret = 0; - - if (commit (playback_distance)) { - need_butler = true; - } - - out: - return ret; + return 0; } /** Update various things including playback_sample, read pointer on each channel's playback_buf diff --git a/libs/ardour/audio_track.cc b/libs/ardour/audio_track.cc index 304c6af25c..1dc1ba3a6a 100644 --- a/libs/ardour/audio_track.cc +++ b/libs/ardour/audio_track.cc @@ -329,7 +329,6 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram return 0; } - int dret; Sample* b; Sample* tmpb; framepos_t transport_frame; @@ -348,19 +347,26 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram transport_frame = _session.transport_frame(); + int dret; + framecnt_t playback_distance; + if ((nframes = check_initial_delay (nframes, transport_frame)) == 0) { /* need to do this so that the diskstream sets its playback distance to zero, thus causing diskstream::commit to do nothing. */ - return diskstream->process (transport_frame, 0, need_butler); + + dret = diskstream->process (transport_frame, 0, playback_distance); + need_butler = diskstream->commit (playback_distance); + return dret; } _silent = false; _amp->apply_gain_automation(false); - if ((dret = diskstream->process (transport_frame, nframes, need_butler)) != 0) { + if ((dret = diskstream->process (transport_frame, nframes, playback_distance)) != 0) { + need_butler = diskstream->commit (playback_distance); silence (nframes); return dret; } @@ -479,6 +485,8 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram silence (nframes); } + need_butler = diskstream->commit (playback_distance); + return 0; } diff --git a/libs/ardour/midi_diskstream.cc b/libs/ardour/midi_diskstream.cc index 15cfb9f1c9..79b59eef50 100644 --- a/libs/ardour/midi_diskstream.cc +++ b/libs/ardour/midi_diskstream.cc @@ -475,15 +475,15 @@ trace_midi (ostream& o, MIDI::byte *msg, size_t len) #endif int -MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& need_butler) +MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, framecnt_t& playback_distance) { - int ret = -1; framecnt_t rec_offset = 0; framecnt_t rec_nframes = 0; bool nominally_recording; bool re = record_enabled (); bool can_record = _session.actively_recording (); - framecnt_t playback_distance = 0; + + playback_distance = 0; check_record_status (transport_frame, can_record); @@ -596,13 +596,7 @@ MidiDiskstream::process (framepos_t transport_frame, pframes_t nframes, bool& ne } - ret = 0; - - if (commit (playback_distance)) { - need_butler = true; - } - - return ret; + return 0; } bool diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc index dcea38521b..238e616a4f 100644 --- a/libs/ardour/midi_track.cc +++ b/libs/ardour/midi_track.cc @@ -279,14 +279,13 @@ MidiTrack::set_state_part_two () } int -MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& needs_butler) +MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame, int declick, bool& need_butler) { Glib::RWLock::ReaderLock lm (_processor_lock, Glib::TRY_LOCK); if (!lm.locked()) { return 0; } - int dret; boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream(); automation_snapshot (start_frame); @@ -302,17 +301,23 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame framepos_t transport_frame = _session.transport_frame(); + int dret; + framecnt_t playback_distance; + if ((nframes = check_initial_delay (nframes, transport_frame)) == 0) { /* need to do this so that the diskstream sets its playback distance to zero, thus causing diskstream::commit to do nothing. */ - return diskstream->process (transport_frame, 0, needs_butler); + dret = diskstream->process (transport_frame, 0, playback_distance); + need_butler = diskstream->commit (playback_distance); + return dret; } _silent = false; - if ((dret = diskstream->process (transport_frame, nframes, needs_butler)) != 0) { + if ((dret = diskstream->process (transport_frame, nframes, playback_distance)) != 0) { + need_butler = diskstream->commit (playback_distance); silence (nframes); return dret; } @@ -373,6 +378,8 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame } } + need_butler = diskstream->commit (playback_distance); + return 0; } diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 5370d8197c..c140baaed6 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -378,7 +378,10 @@ Track::silent_roll (pframes_t nframes, framepos_t /*start_frame*/, framepos_t /* silence (nframes); - return _diskstream->process (_session.transport_frame(), nframes, need_butler); + framecnt_t playback_distance; + int const dret = _diskstream->process (_session.transport_frame(), nframes, playback_distance); + need_butler = _diskstream->commit (playback_distance); + return dret; } void |