_clear_event_type (Event::RangeStop);
_clear_event_type (Event::RangeLocate);
- disable_record ();
+ disable_record (true);
reset_slave_state ();
-
+
_transport_speed = 0;
+
transport_sub_state = (auto_return ? AutoReturning : 0);
}
void
Session::butler_transport_work ()
{
+ RWLockMonitor rm (route_lock, false, __LINE__, __FILE__);
+ RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+
if (post_transport_work & PostTransportCurveRealloc) {
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
(*i)->curve_reallocate();
void
Session::non_realtime_set_speed ()
{
- LockMonitor lm (diskstream_lock, __LINE__, __FILE__);
+ RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
(*i)->non_realtime_set_speed ();
void
Session::non_realtime_overwrite ()
{
- LockMonitor lm (diskstream_lock, __LINE__, __FILE__);
+ RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->pending_overwrite) {
struct tm* now;
time_t xnow;
bool did_record;
-
+
did_record = false;
-
+
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->get_captured_frames () != 0) {
did_record = true;
deliver_mmc (MIDI::MachineControl::cmdLocate, _transport_frame);
if (did_record) {
- atomic_set (&_record_status, Disabled);
- RecordDisabled (); /* EMIT SIGNAL */
+
+ /* XXX its a little odd that we're doing this here
+ when realtime_stop(), which has already executed,
+ will have done this.
+ */
+
+ if (!Config->get_latched_record_enable()) {
+ atomic_set (&_record_status, Disabled);
+ } else {
+ atomic_set (&_record_status, Enabled);
+ }
+ RecordStateChanged (); /* emit signal */
}
if ((post_transport_work & PostTransportLocate) && get_record_enabled()) {
save_state ("", true);
}
- /* save the current state of things if appropriate */
+ /* always try to get rid of this */
+
+ remove_pending_capture_state ();
+ /* save the current state of things if appropriate */
+
if (did_record) {
save_state (_current_snapshot_name);
}
{
/* Called from event-handling context */
- if (actively_recording() || _locations.auto_loop_location() == 0) {
+ if ((actively_recording() && yn) || _locations.auto_loop_location() == 0) {
return;
}
} else {
- /* XXX i don't know where else to put this. something has to clear the
- current clicks, and without deadlocking. clear_clicks() takes
- the route lock which would deadlock in this context.
- */
+ /* this is functionally what clear_clicks() does but with a tentative lock */
- for (Clicks::iterator i = clicks.begin(); i != clicks.end(); ++i) {
- delete *i;
- }
+ TentativeRWLockMonitor clickm (click_lock, true, __LINE__, __FILE__);
+
+ if (clickm.locked()) {
+
+ for (Clicks::iterator i = clicks.begin(); i != clicks.end(); ++i) {
+ delete *i;
+ }
- clicks.clear ();
+ clicks.clear ();
+ }
}
+ if (with_roll) {
+ /* switch from input if we're going to roll */
+ if (Config->get_use_hardware_monitoring()) {
+ /* Even though this is called from RT context we are using
+ a non-tentative rwlock here, because the action must occur.
+ The rarity and short potential lock duration makes this "OK"
+ */
+ RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
+ if ((*i)->record_enabled ()) {
+ //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
+ (*i)->monitor_input (!auto_input);
+ }
+ }
+ }
+ } else {
+ /* otherwise we're going to stop, so do the opposite */
+ if (Config->get_use_hardware_monitoring()) {
+ /* Even though this is called from RT context we are using
+ a non-tentative rwlock here, because the action must occur.
+ The rarity and short potential lock duration makes this "OK"
+ */
+ RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
+ if ((*i)->record_enabled ()) {
+ //cerr << "switching to input" << __FILE__ << __LINE__ << endl << endl;
+ (*i)->monitor_input (true);
+ }
+ }
+ }
+ }
/* cancel autoloop if transport pos outside of loop range */
if (auto_loop) {
if (transport_rolling() && speed == 0.0) {
+ if (Config->get_use_hardware_monitoring())
+ {
+ /* Even though this is called from RT context we are using
+ a non-tentative rwlock here, because the action must occur.
+ The rarity and short potential lock duration makes this "OK"
+ */
+ RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
+ if ((*i)->record_enabled ()) {
+ //cerr << "switching to input" << __FILE__ << __LINE__ << endl << endl;
+ (*i)->monitor_input (true);
+ }
+ }
+ }
+
if (synced_to_jack ()) {
_engine.transport_stop ();
} else {
} else if (transport_stopped() && speed == 1.0) {
+ if (Config->get_use_hardware_monitoring()) {
+ /* Even though this is called from RT context we are using
+ a non-tentative rwlock here, because the action must occur.
+ The rarity and short potential lock duration makes this "OK"
+ */
+ RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
+ for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
+ if (auto_input && (*i)->record_enabled ()) {
+ //cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
+ (*i)->monitor_input (false);
+ }
+ }
+ }
+
if (synced_to_jack()) {
_engine.transport_start ();
} else {
_last_transport_speed = _transport_speed;
_transport_speed = speed;
-
+
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
if ((*i)->realtime_set_speed ((*i)->speed(), true)) {
post_transport_work = PostTransportWork (post_transport_work | PostTransportSpeed);
break;
case Recording:
- disable_record ();
+ disable_record (false);
break;
default:
return;
}
- LockMonitor lm (route_lock, __LINE__, __FILE__);
- LockMonitor lm2 (diskstream_lock, __LINE__, __FILE__);
+ RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
+ RWLockMonitor lm2 (diskstream_lock, false, __LINE__, __FILE__);
_worst_track_latency = 0;
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {