diff options
-rw-r--r-- | gtk2_ardour/ardour_ui.cc | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/diskstream.h | 1 | ||||
-rw-r--r-- | libs/ardour/audio_diskstream.cc | 10 | ||||
-rw-r--r-- | libs/ardour/audioengine.cc | 4 | ||||
-rw-r--r-- | libs/ardour/diskstream.cc | 5 | ||||
-rw-r--r-- | libs/ardour/session_process.cc | 3 |
6 files changed, 21 insertions, 3 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 2fbe987a94..bf88630f98 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -527,6 +527,7 @@ If you still wish to quit, please use the\n\n\ if (session) { session->set_deletion_in_progress (); } + cerr << "Stopping engine\n"; engine->stop (true); Config->save_state(); quit (); diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h index c6371f180d..79fec98d6e 100644 --- a/libs/ardour/ardour/diskstream.h +++ b/libs/ardour/ardour/diskstream.h @@ -282,6 +282,7 @@ class Diskstream : public PBD::StatefulDestructible nframes_t file_frame; nframes_t playback_sample; nframes_t playback_distance; + bool commit_should_unlock; uint32_t _read_data_count; uint32_t _write_data_count; diff --git a/libs/ardour/audio_diskstream.cc b/libs/ardour/audio_diskstream.cc index 887838796b..48085d4922 100644 --- a/libs/ardour/audio_diskstream.cc +++ b/libs/ardour/audio_diskstream.cc @@ -524,6 +524,8 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_ return 0; } + commit_should_unlock = false; + check_record_status (transport_frame, nframes, can_record); nominally_recording = (can_record && re); @@ -542,7 +544,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_ if (!state_lock.trylock()) { return 1; } - + commit_should_unlock = true; adjust_capture_position = 0; for (chan = c->begin(); chan != c->end(); ++chan) { @@ -788,6 +790,7 @@ AudioDiskstream::process (nframes_t transport_frame, nframes_t nframes, nframes_ be called. unlock the state lock. */ + commit_should_unlock = false; state_lock.unlock(); } @@ -827,7 +830,10 @@ AudioDiskstream::commit (nframes_t nframes) || c->front()->capture_buf->read_space() >= disk_io_chunk_frames; } - state_lock.unlock(); + if (commit_should_unlock) { + state_lock.unlock(); + } + _processed = false; return need_butler; diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index 51251e1cba..d48b11df38 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -283,9 +283,11 @@ AudioEngine::process_callback (nframes_t nframes) } if (session_remove_pending) { + cerr << "engine notes session remove pending\n"; session = 0; session_remove_pending = false; session_removed.signal(); + cerr << "done, woken waiter\n"; _processed_frames = next_processed_frames; return 0; } @@ -451,8 +453,10 @@ AudioEngine::remove_session () if (_running) { if (session) { + cerr << "mark session for removal\n"; session_remove_pending = true; session_removed.wait(_process_lock); + cerr << "done\n"; } } else { diff --git a/libs/ardour/diskstream.cc b/libs/ardour/diskstream.cc index 135718bb52..c9c11cc92d 100644 --- a/libs/ardour/diskstream.cc +++ b/libs/ardour/diskstream.cc @@ -114,6 +114,7 @@ Diskstream::init (Flag f) playback_distance = 0; _read_data_count = 0; _write_data_count = 0; + commit_should_unlock = false; pending_overwrite = false; overwrite_frame = 0; @@ -214,7 +215,9 @@ Diskstream::prepare () void Diskstream::recover () { - state_lock.unlock(); + if (commit_should_unlock) { + state_lock.unlock(); + } _processed = false; } diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index bab9db928b..055cbcf82d 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -210,6 +210,9 @@ Session::commit_diskstreams (nframes_t nframes, bool &needs_butler) } /* force all diskstreams not handled by a Route to call do their stuff. + Note: the diskstreams that were handled by a route will just return zero + from this call, because they know they were processed. So in fact, this + also runs commit() for every diskstream. */ if ((dret = (*i)->process (_transport_frame, nframes, 0, actively_recording(), get_rec_monitors_input())) == 0) { |