summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-07-24 16:40:56 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-07-24 16:40:56 +0000
commitc685724c8067fc9308c5f66f1b91d445509159e9 (patch)
tree5261c9d9c168f4f8351e1855f080d0688889e751 /libs
parente3241a03cf3d3d4cc09c125340444c6f72e0346b (diff)
step editing now accessed via a context menu on MIDI track rec-enable buttons. along the way, fixed up confusion between set_rec_enable() and set_rec_enabled() methods in Route/Track/Diskstream
git-svn-id: svn://localhost/ardour2/branches/3.0@7482 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/midi_track.h5
-rwxr-xr-xlibs/ardour/ardour/public_diskstream.h1
-rw-r--r--libs/ardour/ardour/route.h2
-rw-r--r--libs/ardour/ardour/session.h12
-rw-r--r--libs/ardour/ardour/track.h3
-rw-r--r--libs/ardour/midi_track.cc24
-rw-r--r--libs/ardour/session.cc41
-rw-r--r--libs/ardour/session_midi.cc4
-rw-r--r--libs/ardour/session_rtevents.cc8
-rw-r--r--libs/ardour/session_state.cc1
-rw-r--r--libs/ardour/track.cc12
-rw-r--r--libs/evoral/src/ControlList.cpp5
-rw-r--r--libs/surfaces/control_protocol/control_protocol.cc2
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc2
-rw-r--r--libs/surfaces/osc/osc.cc2
15 files changed, 94 insertions, 30 deletions
diff --git a/libs/ardour/ardour/midi_track.h b/libs/ardour/ardour/midi_track.h
index 42446da70d..df1d2e11df 100644
--- a/libs/ardour/ardour/midi_track.h
+++ b/libs/ardour/ardour/midi_track.h
@@ -46,6 +46,7 @@ public:
void use_new_diskstream ();
void set_diskstream (boost::shared_ptr<Diskstream>);
+ void set_record_enabled (bool yn, void *src);
void set_latency_delay (nframes_t);
@@ -83,6 +84,8 @@ public:
void set_step_editing (bool yn);
MidiRingBuffer<nframes_t>& step_edit_ring_buffer() { return _step_edit_ring_buffer; }
+ static PBD::Signal1<void,bool> StepEditStatusChange;
+
uint8_t default_channel() const { return _default_channel; }
void set_default_channel (uint8_t chn);
@@ -94,7 +97,7 @@ public:
ChannelMode get_channel_mode ();
uint16_t get_channel_mask ();
boost::shared_ptr<MidiPlaylist> midi_playlist ();
-
+
protected:
XMLNode& state (bool full);
diff --git a/libs/ardour/ardour/public_diskstream.h b/libs/ardour/ardour/public_diskstream.h
index a33c43f0cd..5c2c6d9fc6 100755
--- a/libs/ardour/ardour/public_diskstream.h
+++ b/libs/ardour/ardour/public_diskstream.h
@@ -65,7 +65,6 @@ public:
virtual ChanCount n_channels () = 0;
virtual nframes_t get_capture_start_frame (uint32_t n = 0) = 0;
virtual AlignStyle alignment_style () const = 0;
- virtual void set_record_enabled (bool) = 0;
virtual nframes_t current_capture_start () const = 0;
virtual nframes_t current_capture_end () const = 0;
virtual void playlist_modified () = 0;
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 7692583feb..54eb41f97b 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -112,7 +112,7 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember,
virtual void toggle_monitor_input ();
virtual bool can_record() { return false; }
- virtual void set_record_enable (bool /*yn*/, void * /*src*/) {}
+ virtual void set_record_enabled (bool /*yn*/, void * /*src*/) {}
virtual bool record_enabled() const { return false; }
virtual void handle_transport_stopped (bool abort, bool did_locate, bool flush_processors);
virtual void set_pending_declick (int);
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 18ef620a89..4627204888 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -282,6 +282,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
/** Emitted when anything about any of our route groups changes */
PBD::Signal0<void> RouteGroupChanged;
+ /* Step Editing status changed */
+ PBD::Signal1<void,bool> StepEditStatusChange;
+
void queue_event (SessionEvent*);
void request_roll_at_and_return (nframes_t start, nframes_t return_to);
@@ -591,7 +594,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void set_just_one_solo (boost::shared_ptr<Route>, bool, SessionEvent::RTeventCallback after = rt_cleanup);
void set_mute (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
void set_listen (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
- void set_record_enable (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
+ void set_record_enabled (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
void set_solo_isolated (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false);
PBD::Signal1<void,bool> SoloActive;
@@ -776,6 +779,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
PBD::Signal0<void> RouteOrderKeyChanged;
+ bool step_editing() const { return (_step_editors > 0); }
+
protected:
friend class AudioEngine;
void set_block_size (nframes_t nframes);
@@ -1409,7 +1414,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void rt_set_mute (boost::shared_ptr<RouteList>, bool yn, bool group_override);
void rt_set_listen (boost::shared_ptr<RouteList>, bool yn, bool group_override);
void rt_set_solo_isolated (boost::shared_ptr<RouteList>, bool yn, bool group_override);
- void rt_set_record_enable (boost::shared_ptr<RouteList>, bool yn, bool group_override);
+ void rt_set_record_enabled (boost::shared_ptr<RouteList>, bool yn, bool group_override);
/** temporary list of Diskstreams used only during load of 2.X sessions */
std::list<boost::shared_ptr<Diskstream> > _diskstreams_2X;
@@ -1420,6 +1425,9 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
void cleanup_stubfiles ();
void route_order_key_changed ();
+
+ void step_edit_status_change (bool);
+ uint32_t _step_editors;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h
index 60e628af79..b3d69e4403 100644
--- a/libs/ardour/ardour/track.h
+++ b/libs/ardour/ardour/track.h
@@ -90,7 +90,7 @@ class Track : public Route, public PublicDiskstream
boost::shared_ptr<PBD::Controllable> rec_enable_control() { return _rec_enable_control; }
bool record_enabled() const;
- void set_record_enable (bool yn, void *src);
+ void set_record_enabled (bool yn, void *src);
/* XXX: unfortunate that this is exposed */
PBD::ID const & diskstream_id () const;
@@ -132,7 +132,6 @@ class Track : public Route, public PublicDiskstream
ChanCount n_channels ();
nframes_t get_capture_start_frame (uint32_t n = 0);
AlignStyle alignment_style () const;
- void set_record_enabled (bool);
nframes_t current_capture_start () const;
nframes_t current_capture_end () const;
void playlist_modified ();
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 3c43266219..9dced1e0b9 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -49,6 +49,8 @@ using namespace std;
using namespace ARDOUR;
using namespace PBD;
+PBD::Signal1<void,bool> MidiTrack::StepEditStatusChange;
+
MidiTrack::MidiTrack (Session& sess, string name, Route::Flag flag, TrackMode mode)
: Track (sess, name, flag, mode, DataType::MIDI)
, _immediate_events(1024) // FIXME: size?
@@ -85,6 +87,16 @@ MidiTrack::use_new_diskstream ()
}
void
+MidiTrack::set_record_enabled (bool yn, void *src)
+{
+ if (_step_editing) {
+ return;
+ }
+
+ Track::set_record_enabled (yn, src);
+}
+
+void
MidiTrack::set_diskstream (boost::shared_ptr<Diskstream> ds)
{
Track::set_diskstream (ds);
@@ -376,7 +388,7 @@ MidiTrack::no_roll (nframes_t nframes, sframes_t start_frame, sframes_t end_fram
{
int ret = Track::no_roll (nframes, start_frame, end_frame, state_changing, can_record, rec_monitors_input);
- if (ret == 0 && _diskstream->record_enabled() && _step_editing) {
+ if (ret == 0 && _step_editing) {
push_midi_input_to_step_edit_ringbuffer (nframes);
}
@@ -570,8 +582,14 @@ MidiTrack::MidiControl::set_value(float val)
void
MidiTrack::set_step_editing (bool yn)
{
- cerr << name() << " IS NOW STEP EDITING\n";
- _step_editing = yn;
+ if (_session.record_status() != Session::Disabled) {
+ return;
+ }
+
+ if (yn != _step_editing) {
+ _step_editing = yn;
+ StepEditStatusChange (yn);
+ }
}
void
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 45de1db1f5..71277fa3cf 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -1041,6 +1041,10 @@ Session::step_back_from_record ()
void
Session::maybe_enable_record ()
{
+ if (_step_editors > 0) {
+ return;
+ }
+
g_atomic_int_set (&_record_status, Enabled);
/* this function is currently called from somewhere other than an RT thread.
@@ -1926,6 +1930,11 @@ Session::add_routes (RouteList& new_routes, bool save)
tr->PlaylistChanged.connect_same_thread (*this, boost::bind (&Session::track_playlist_changed, this, boost::weak_ptr<Track> (tr)));
track_playlist_changed (boost::weak_ptr<Track> (tr));
tr->RecordEnableChanged.connect_same_thread (*this, boost::bind (&Session::update_have_rec_enabled_track, this));
+
+ boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (tr);
+ if (mt) {
+ mt->StepEditStatusChange.connect_same_thread (*this, boost::bind (&Session::step_edit_status_change, this, _1));
+ }
}
}
@@ -2103,6 +2112,13 @@ Session::remove_route (shared_ptr<Route> route)
}
}
+ boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (route);
+ if (mt && mt->step_editing()) {
+ if (_step_editors > 0) {
+ _step_editors--;
+ }
+ }
+
update_latency_compensation (false, false);
set_dirty();
@@ -3922,3 +3938,28 @@ Session::route_order_key_changed ()
{
RouteOrderKeyChanged (); /* EMIT SIGNAL */
}
+
+void
+Session::step_edit_status_change (bool yn)
+{
+ bool send = false;
+
+ bool val = false;
+ if (yn) {
+ send = (_step_editors == 0);
+ val = true;
+
+ _step_editors++;
+ } else {
+ send = (_step_editors == 1);
+ val = false;
+
+ if (_step_editors > 0) {
+ _step_editors--;
+ }
+ }
+
+ if (send) {
+ StepEditStatusChange (val);
+ }
+}
diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc
index 3939b544b4..2ce3310f47 100644
--- a/libs/ardour/session_midi.cc
+++ b/libs/ardour/session_midi.cc
@@ -130,7 +130,7 @@ Session::mmc_record_pause (MIDI::MachineControl &/*mmc*/)
void
Session::mmc_record_strobe (MIDI::MachineControl &/*mmc*/)
{
- if (!Config->get_mmc_control()) {
+ if (!Config->get_mmc_control() || (_step_editors > 0)) {
return;
}
@@ -335,7 +335,7 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled)
if ((at = dynamic_cast<AudioTrack*>((*i).get())) != 0) {
if (trk == at->remote_control_id()) {
- at->set_record_enable (enabled, &mmc);
+ at->set_record_enabled (enabled, &mmc);
break;
}
}
diff --git a/libs/ardour/session_rtevents.cc b/libs/ardour/session_rtevents.cc
index 921a6348eb..ff452137d9 100644
--- a/libs/ardour/session_rtevents.cc
+++ b/libs/ardour/session_rtevents.cc
@@ -148,17 +148,17 @@ Session::rt_set_solo_isolated (boost::shared_ptr<RouteList> rl, bool yn, bool /*
}
void
-Session::set_record_enable (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
+Session::set_record_enabled (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override)
{
if (!writable()) {
return;
}
- queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_record_enable));
+ queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_record_enabled));
}
void
-Session::rt_set_record_enable (boost::shared_ptr<RouteList> rl, bool yn, bool group_override)
+Session::rt_set_record_enabled (boost::shared_ptr<RouteList> rl, bool yn, bool group_override)
{
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
if ((*i)->is_hidden()) {
@@ -168,7 +168,7 @@ Session::rt_set_record_enable (boost::shared_ptr<RouteList> rl, bool yn, bool gr
boost::shared_ptr<Track> t;
if ((t = boost::dynamic_pointer_cast<Track>(*i)) != 0) {
- t->set_record_enable (yn, (group_override ? (void*) t->route_group() : (void *) this));
+ t->set_record_enabled (yn, (group_override ? (void*) t->route_group() : (void *) this));
}
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 6c6da8702d..94ea4bb2a1 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -216,6 +216,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
first_file_header_format_reset = true;
post_export_sync = false;
midi_control_ui = 0;
+ _step_editors = 0;
AudioDiskstream::allocate_working_buffers();
diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc
index 23afe6dea2..145251a021 100644
--- a/libs/ardour/track.cc
+++ b/libs/ardour/track.cc
@@ -132,7 +132,7 @@ void
Track::RecEnableControllable::set_value (float val)
{
bool bval = ((val >= 0.5f) ? true: false);
- track.set_record_enable (bval, this);
+ track.set_record_enabled (bval, this);
}
float
@@ -161,7 +161,7 @@ Track::can_record()
}
void
-Track::set_record_enable (bool yn, void *src)
+Track::set_record_enabled (bool yn, void *src)
{
if (!_session.writable()) {
return;
@@ -172,7 +172,7 @@ Track::set_record_enable (bool yn, void *src)
}
if (_route_group && src != _route_group && _route_group->is_active() && _route_group->is_recenable()) {
- _route_group->apply (&Track::set_record_enable, yn, _route_group);
+ _route_group->apply (&Track::set_record_enabled, yn, _route_group);
return;
}
@@ -599,12 +599,6 @@ Track::alignment_style () const
return _diskstream->alignment_style ();
}
-void
-Track::set_record_enabled (bool r)
-{
- _diskstream->set_record_enabled (r);
-}
-
nframes_t
Track::current_capture_start () const
{
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp
index bfe4c95365..4a710cfbb0 100644
--- a/libs/evoral/src/ControlList.cpp
+++ b/libs/evoral/src/ControlList.cpp
@@ -1020,10 +1020,11 @@ ControlList::rt_safe_earliest_event_linear_unlocked (double start, double end, d
//<< ", x: " << x << ", y: " << y << ", inclusive: " << inclusive << ")" << endl;
const_iterator length_check_iter = _events.begin();
- if (_events.empty()) // 0 events
+ if (_events.empty()) { // 0 events
return false;
- else if (_events.end() == ++length_check_iter) // 1 event
+ } else if (_events.end() == ++length_check_iter) { // 1 event
return rt_safe_earliest_event_discrete_unlocked(start, end, x, y, inclusive);
+ }
// Hack to avoid infinitely repeating the same event
build_search_cache_if_necessary(start, end);
diff --git a/libs/surfaces/control_protocol/control_protocol.cc b/libs/surfaces/control_protocol/control_protocol.cc
index 62214e6429..cf98b66b5e 100644
--- a/libs/surfaces/control_protocol/control_protocol.cc
+++ b/libs/surfaces/control_protocol/control_protocol.cc
@@ -190,7 +190,7 @@ ControlProtocol::route_set_rec_enable (uint32_t table_index, bool yn)
boost::shared_ptr<AudioTrack> at = boost::dynamic_pointer_cast<AudioTrack>(r);
if (at) {
- at->set_record_enable (yn, this);
+ at->set_record_enabled (yn, this);
}
}
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 073d0c475f..5802e80b1a 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -403,7 +403,7 @@ MackieControlProtocol::handle_strip_button (Control & control, ButtonState bs, b
if (control.name() == "recenable")
{
state = !route->record_enabled();
- route->set_record_enable (state, this);
+ route->set_record_enabled (state, this);
}
else if (control.name() == "mute")
{
diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc
index 937cf6ae29..d52348ef5c 100644
--- a/libs/surfaces/osc/osc.cc
+++ b/libs/surfaces/osc/osc.cc
@@ -748,7 +748,7 @@ OSC::route_recenable (int rid, int yn)
boost::shared_ptr<Route> r = session->route_by_remote_id (rid);
if (r) {
- r->set_record_enable (yn, this);
+ r->set_record_enabled (yn, this);
}
return 0;
}