summaryrefslogtreecommitdiff
path: root/libs/ardour/audio_diskstream.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-03-27 14:41:24 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-03-27 14:41:24 +0000
commit5e8b3f08328424299c264d70bba307dcea1f2b17 (patch)
tree488cc97ada729f0b4cf3d11f694aa00db7a87f69 /libs/ardour/audio_diskstream.cc
parent4be50fc81bf5db91113c4e87f867163e738a0919 (diff)
part one of hiding Diskstreams and making them a private object of a Track
git-svn-id: svn://localhost/ardour2/branches/3.0@6802 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/audio_diskstream.cc')
-rw-r--r--libs/ardour/audio_diskstream.cc52
1 files changed, 10 insertions, 42 deletions
diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc
index b9cc41d7c5..bf3ac58848 100644
--- a/libs/ardour/audio_diskstream.cc
+++ b/libs/ardour/audio_diskstream.cc
@@ -425,7 +425,7 @@ AudioDiskstream::prepare_record_status(nframes_t capture_start_frame)
}
int
-AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input)
+AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can_record, bool rec_monitors_input, bool& need_butler)
{
uint32_t n;
boost::shared_ptr<ChannelList> c = channels.reader();
@@ -437,22 +437,9 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can
bool re = record_enabled ();
bool collect_playback = false;
- /* if we've already processed the frames corresponding to this call,
- just return. this allows multiple routes that are taking input
- from this diskstream to call our ::process() method, but have
- this stuff only happen once. more commonly, it allows both
- the AudioTrack that is using this AudioDiskstream *and* the Session
- to call process() without problems.
- */
-
- if (_processed) {
- return 0;
- }
-
- commit_should_unlock = false;
+ playback_distance = 0;
if (!_io || !_io->active()) {
- _processed = true;
return 0;
}
@@ -461,20 +448,15 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can
nominally_recording = (can_record && re);
if (nframes == 0) {
- _processed = true;
return 0;
}
- /* This lock is held until the end of AudioDiskstream::commit, so these two functions
- must always be called as a pair. The only exception is if this function
- returns a non-zero value, in which case, ::commit should not be called.
- */
+ Glib::Mutex::Lock sm (state_lock, Glib::TRY_LOCK);
- // If we can't take the state lock return.
- if (!state_lock.trylock()) {
+ if (!sm.locked()) {
return 1;
}
- commit_should_unlock = true;
+
adjust_capture_position = 0;
for (chan = c->begin(); chan != c->end(); ++chan) {
@@ -669,19 +651,11 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, bool can
ret = 0;
- out:
- _processed = true;
-
- if (ret) {
-
- /* we're exiting with failure, so ::commit will not
- be called. unlock the state lock.
- */
-
- commit_should_unlock = false;
- state_lock.unlock();
- }
+ if (commit (nframes)) {
+ need_butler = true;
+ }
+ out:
return ret;
}
@@ -704,7 +678,7 @@ AudioDiskstream::process_varispeed_playback(nframes_t nframes, boost::shared_ptr
}
bool
-AudioDiskstream::commit (nframes_t /*nframes*/)
+AudioDiskstream::commit (nframes_t /* nframes */)
{
bool need_butler = false;
@@ -748,12 +722,6 @@ AudioDiskstream::commit (nframes_t /*nframes*/)
}
}
- if (commit_should_unlock) {
- state_lock.unlock();
- }
-
- _processed = false;
-
return need_butler;
}