summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2009-03-17 15:10:53 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2009-03-17 15:10:53 +0000
commit22b3c2de96e561471fe615241f0d2f6d2774abc0 (patch)
treee6474599a1db0ec11f0ec9b9270805bb0f46e473
parent94d0bad82f230efe333061412dec55e8d04b3446 (diff)
more rational handling of silence when (a) running freeze/export/bounce (b) during sync start
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4864 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/ardour/ardour/session.h6
-rw-r--r--libs/ardour/session.cc6
-rw-r--r--libs/ardour/session_process.cc18
3 files changed, 16 insertions, 14 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 8ca3714666..cba51e2ce3 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1065,7 +1065,11 @@ class Session : public PBD::StatefulDestructible
void process_with_events (nframes_t);
void process_audition (nframes_t);
int process_export (nframes_t, ARDOUR::AudioExportSpecification*);
-
+
+ void block_processing() { g_atomic_int_set (&processing_prohibited, 1); }
+ void unblock_processing() { g_atomic_int_set (&processing_prohibited, 0); }
+ bool processing_blocked() const { return g_atomic_int_get (&processing_prohibited); }
+
/* slave tracking */
static const int delta_accumulator_size = 25;
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index e0221b53cc..567c16d142 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -4135,7 +4135,9 @@ Session::write_one_audio_track (AudioTrack& track, nframes_t start, nframes_t en
// any bigger than this seems to cause stack overflows in called functions
const nframes_t chunk_size = (128 * 1024)/4;
- g_atomic_int_set (&processing_prohibited, 1);
+ // block all process callback handling
+
+ block_processing ();
/* call tree *MUST* hold route_lock */
@@ -4270,7 +4272,7 @@ Session::write_one_audio_track (AudioTrack& track, nframes_t start, nframes_t en
free (*i);
}
- g_atomic_int_set (&processing_prohibited, 0);
+ unblock_processing ();
itt.done = true;
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 99615a08b3..31cf3a930d 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -47,12 +47,17 @@ Session::process (nframes_t nframes)
{
_silent = false;
+ if (processing_blocked()) {
+ _silent = true;
+ return;
+ }
+
if (non_realtime_work_pending()) {
if (!transport_work_requested ()) {
post_transport ();
}
}
-
+
(this->*process_function) (nframes);
{
@@ -82,13 +87,6 @@ Session::no_roll (nframes_t nframes, nframes_t offset)
_click_io->silence (nframes, offset);
}
- if (g_atomic_int_get (&processing_prohibited)) {
- for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
- (*i)->silence (nframes, offset);
- }
- return 0;
- }
-
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
if ((*i)->hidden()) {
@@ -866,9 +864,7 @@ Session::maybe_sync_start (nframes_t& nframes, nframes_t& offset)
with any fancy stuff here, just the minimal silence.
*/
- g_atomic_int_inc (&processing_prohibited);
- no_roll (nframes, 0);
- g_atomic_int_dec_and_test (&processing_prohibited);
+ _silent = true;
if (Config->get_locate_while_waiting_for_sync()) {
if (micro_locate (nframes)) {