summaryrefslogtreecommitdiff
path: root/libs/ardour/session_process.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-07-27 16:52:14 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-07-27 16:52:14 +0000
commitcc2767caf32486365a33814149e75c6e588e8603 (patch)
tree9d41c606a20ba2e2bb43be653e42050d38293a2e /libs/ardour/session_process.cc
parentd23fec7b9a0f076256dbd71faae254a78efbe37a (diff)
added RCU handling of Session route list, and major use of shared_ptr<T> everywhere else. plus a few bug fixes for issues discovered with -Wextra
git-svn-id: svn://localhost/ardour2/trunk@707 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_process.cc')
-rw-r--r--libs/ardour/session_process.cc43
1 files changed, 23 insertions, 20 deletions
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 5568b2a16c..2024730292 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -77,23 +77,20 @@ Session::no_roll (jack_nframes_t nframes, jack_nframes_t offset)
jack_nframes_t end_frame = _transport_frame + nframes;
int ret = 0;
bool declick = get_transport_declick_required();
+ boost::shared_ptr<RouteList> r = routes.reader ();
if (_click_io) {
_click_io->silence (nframes, offset);
}
- /* XXX we're supposed to have the route_lock while doing this.
- this is really bad ...
- */
-
if (g_atomic_int_get (&processing_prohibited)) {
- for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
(*i)->silence (nframes, offset);
}
return 0;
}
- for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if ((*i)->hidden()) {
continue;
@@ -118,6 +115,7 @@ Session::process_routes (jack_nframes_t nframes, jack_nframes_t offset)
bool record_active;
int declick = get_transport_declick_required();
bool rec_monitors = get_rec_monitors_input();
+ boost::shared_ptr<RouteList> r = routes.reader ();
if (transport_sub_state & StopPendingCapture) {
/* force a declick out */
@@ -126,7 +124,7 @@ Session::process_routes (jack_nframes_t nframes, jack_nframes_t offset)
record_active = actively_recording(); // || (get_record_enabled() && get_punch_in());
- for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
int ret;
@@ -161,13 +159,14 @@ Session::silent_process_routes (jack_nframes_t nframes, jack_nframes_t offset)
bool record_active = actively_recording();
int declick = get_transport_declick_required();
bool rec_monitors = get_rec_monitors_input();
+ boost::shared_ptr<RouteList> r = routes.reader ();
if (transport_sub_state & StopPendingCapture) {
/* force a declick out */
declick = -1;
}
- for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
int ret;
@@ -249,10 +248,14 @@ Session::process_with_events (jack_nframes_t nframes)
jack_nframes_t stop_limit;
long frames_moved;
+ /* make sure the auditioner is silent */
+
if (auditioner) {
auditioner->silence (nframes, 0);
}
+ /* handle any pending events */
+
while (pending_events.read (&ev, 1) == 1) {
merge_event (ev);
}
@@ -281,13 +284,12 @@ Session::process_with_events (jack_nframes_t nframes)
end_frame = _transport_frame + nframes;
{
- Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK);
Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK);
Event* this_event;
Events::iterator the_next_one;
-
- if (!rm.locked() || !dsm.locked() || (post_transport_work & (PostTransportLocate|PostTransportStop))) {
+
+ if (!dsm.locked() || (post_transport_work & (PostTransportLocate|PostTransportStop))) {
no_roll (nframes, 0);
return;
}
@@ -694,7 +696,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
summon_butler ();
}
- jack_nframes_t frames_moved = (long) floor (_transport_speed * nframes);
+ int32_t frames_moved = (int32_t) floor (_transport_speed * nframes);
if (frames_moved < 0) {
decrement_transport_position (-frames_moved);
@@ -731,10 +733,9 @@ Session::process_without_events (jack_nframes_t nframes)
long frames_moved;
{
- Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK);
Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK);
- if (!rm.locked() || !dsm.locked() || (post_transport_work & (PostTransportLocate|PostTransportStop))) {
+ if (!dsm.locked() || (post_transport_work & (PostTransportLocate|PostTransportStop))) {
no_roll (nframes, 0);
return;
}
@@ -803,21 +804,23 @@ Session::process_without_events (jack_nframes_t nframes)
void
Session::process_audition (jack_nframes_t nframes)
{
- Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK);
Event* ev;
+ boost::shared_ptr<RouteList> r = routes.reader ();
- if (rm.locked()) {
- for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
- if (!(*i)->hidden()) {
- (*i)->silence (nframes, 0);
- }
+ for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
+ if (!(*i)->hidden()) {
+ (*i)->silence (nframes, 0);
}
}
+
+ /* run the auditioner, and if it says we need butler service, ask for it */
if (auditioner->play_audition (nframes) > 0) {
summon_butler ();
}
+ /* handle pending events */
+
while (pending_events.read (&ev, 1) == 1) {
merge_event (ev);
}