along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id$
*/
-#include <ardour/session.h>
-#include <ardour/route.h>
-#include <ardour/audio_track.h>
+#include "pbd/error.h"
-#include <control_protocol/control_protocol.h>
+#include "ardour/session.h"
+#include "ardour/route.h"
+#include "ardour/audio_track.h"
+#include "ardour/meter.h"
+#include "ardour/amp.h"
+#include "control_protocol/control_protocol.h"
using namespace ARDOUR;
using namespace std;
-
-sigc::signal<void> ControlProtocol::ZoomToSession;
-sigc::signal<void> ControlProtocol::ZoomOut;
-sigc::signal<void> ControlProtocol::ZoomIn;
-sigc::signal<void> ControlProtocol::Enter;
-sigc::signal<void,float> ControlProtocol::ScrollTimeline;
+using namespace PBD;
+
+Signal0<void> ControlProtocol::ZoomToSession;
+Signal0<void> ControlProtocol::ZoomOut;
+Signal0<void> ControlProtocol::ZoomIn;
+Signal0<void> ControlProtocol::Enter;
+Signal0<void> ControlProtocol::Undo;
+Signal0<void> ControlProtocol::Redo;
+Signal1<void,float> ControlProtocol::ScrollTimeline;
+Signal1<void,uint32_t> ControlProtocol::GotoView;
+Signal0<void> ControlProtocol::CloseDialog;
+PBD::Signal0<void> ControlProtocol::VerticalZoomInAll;
+PBD::Signal0<void> ControlProtocol::VerticalZoomOutAll;
+PBD::Signal0<void> ControlProtocol::VerticalZoomInSelected;
+PBD::Signal0<void> ControlProtocol::VerticalZoomOutSelected;
+PBD::Signal1<void,RouteNotificationListPtr> ControlProtocol::TrackSelectionChanged;
+PBD::Signal1<void,uint32_t> ControlProtocol::AddRouteToSelection;
+PBD::Signal1<void,uint32_t> ControlProtocol::SetRouteSelection;
+PBD::Signal1<void,uint32_t> ControlProtocol::ToggleRouteSelection;
+PBD::Signal1<void,uint32_t> ControlProtocol::RemoveRouteFromSelection;
+PBD::Signal0<void> ControlProtocol::ClearRouteSelection;
+PBD::Signal0<void> ControlProtocol::StepTracksDown;
+PBD::Signal0<void> ControlProtocol::StepTracksUp;
ControlProtocol::ControlProtocol (Session& s, string str)
- : BasicUI (s),
- _name (str)
+ : BasicUI (s)
+ , _name (str)
+ , _active (false)
{
- _active = false;
}
ControlProtocol::~ControlProtocol ()
ControlProtocol::next_track (uint32_t initial_id)
{
uint32_t limit = session->nroutes();
- Route* cr = route_table[0];
+ boost::shared_ptr<Route> cr = route_table[0];
uint32_t id;
if (cr) {
id++;
}
- while (id < limit) {
+ while (id <= limit) {
if ((cr = session->route_by_remote_id (id)) != 0) {
break;
}
id++;
}
- if (id == limit) {
+ if (id >= limit) {
id = 0;
while (id != initial_id) {
if ((cr = session->route_by_remote_id (id)) != 0) {
void
ControlProtocol::prev_track (uint32_t initial_id)
{
- uint32_t limit = session->nroutes() - 1;
- Route* cr = route_table[0];
- uint32_t id;
+ uint32_t limit = session->nroutes();
+ boost::shared_ptr<Route> cr = route_table[0];
+ int32_t id;
if (cr) {
id = cr->remote_control_id ();
}
if (id == 0) {
- id = session->nroutes() - 1;
+ id = limit;
} else {
id--;
}
}
if (id < 0) {
- id = limit;
- while (id > initial_id) {
- if ((cr = session->route_by_remote_id (id)) != 0) {
+ uint32_t i = limit;
+ while (i > initial_id) {
+ if ((cr = session->route_by_remote_id (i)) != 0) {
break;
}
- id--;
+ i--;
}
}
ControlProtocol::set_route_table_size (uint32_t size)
{
while (route_table.size() < size) {
- route_table.push_back (0);
+ route_table.push_back (boost::shared_ptr<Route> ((Route*) 0));
}
}
void
-ControlProtocol::set_route_table (uint32_t table_index, ARDOUR::Route*)
+ControlProtocol::set_route_table (uint32_t table_index, boost::shared_ptr<ARDOUR::Route> r)
{
+ if (table_index >= route_table.size()) {
+ return;
+ }
+
+ route_table[table_index] = r;
+
+ // XXX SHAREDPTR need to handle r->GoingAway
}
bool
ControlProtocol::set_route_table (uint32_t table_index, uint32_t remote_control_id)
{
- if (table_index >= route_table.size()) {
- return false;
- }
-
- Route* r = session->route_by_remote_id (remote_control_id);
+ boost::shared_ptr<Route> r = session->route_by_remote_id (remote_control_id);
if (!r) {
return false;
}
-
- route_table[table_index] = r;
+
+ set_route_table (table_index, r);
return true;
}
return;
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
- AudioTrack* at = dynamic_cast<AudioTrack*>(r);
+ 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);
}
}
return false;
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
- AudioTrack* at = dynamic_cast<AudioTrack*>(r);
+ boost::shared_ptr<AudioTrack> at = boost::dynamic_pointer_cast<AudioTrack>(r);
if (at) {
return at->record_enabled ();
return 0.0f;
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return 0.0f;
}
- return r->gain ();
+ return r->amp()->gain ();
}
void
return;
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
if (r != 0) {
r->set_gain (gain, this);
return 0.0f;
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return 0.0f;
}
- return r->effective_gain ();
+ return r->amp()->gain_control()->get_value();
}
return 0.0f;
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return 0.0f;
}
- return r->peak_input_power (which_input);
+ return r->peak_meter().peak_power (which_input);
}
return false;
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return false;
return;
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
if (r != 0) {
r->set_mute (yn, this);
return false;
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return false;
return;
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
if (r != 0) {
r->set_solo (yn, this);
return "";
}
- Route* r = route_table[table_index];
+ boost::shared_ptr<Route> r = route_table[table_index];
if (r == 0) {
return "";
return r->name();
}
+list<boost::shared_ptr<Bundle> >
+ControlProtocol::bundles ()
+{
+ return list<boost::shared_ptr<Bundle> > ();
+}