Put Mackie surface ports into the Ardour tab of the port matrix.

git-svn-id: svn://localhost/ardour2/branches/3.0@7522 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-07-30 02:09:39 +00:00
parent 66760a574a
commit 1f07948972
8 changed files with 71 additions and 3 deletions

View file

@ -29,6 +29,8 @@
#include "ardour/port.h"
#include "ardour/session.h"
#include "ardour/auditioner.h"
#include "ardour/control_protocol_manager.h"
#include "control_protocol/control_protocol.h"
#include "gui_thread.h"
#include "port_group.h"
@ -422,6 +424,20 @@ PortGroupList::gather (ARDOUR::Session* session, ARDOUR::DataType type, bool inp
}
}
/* Ardour's surfaces */
ControlProtocolManager& m = ControlProtocolManager::instance ();
for (list<ControlProtocolInfo*>::iterator i = m.control_protocol_info.begin(); i != m.control_protocol_info.end(); ++i) {
if ((*i)->protocol) {
list<boost::shared_ptr<Bundle> > b = (*i)->protocol->bundles ();
for (list<boost::shared_ptr<Bundle> >::iterator j = b.begin(); j != b.end(); ++j) {
if ((*j)->ports_are_inputs() == inputs) {
ardour->add_bundle (*j);
}
}
}
}
/* Now find all other ports that we haven't thought of yet */
std::vector<std::string> extra_system[DataType::num_types];

View file

@ -52,6 +52,9 @@ class Bundle : public PBD::ScopedConnectionList
struct Channel {
Channel (std::string n, DataType t) : name (n), type (t) {}
Channel (std::string n, DataType t, PortList p) : name (n), type (t), ports (p) {}
Channel (std::string n, DataType t, std::string const & p) : name (n), type (t) {
ports.push_back (p);
}
bool operator== (Channel const &o) const {
return name == o.name && type == o.type && ports == o.ports;
@ -77,6 +80,7 @@ class Bundle : public PBD::ScopedConnectionList
PortList const & channel_ports (uint32_t) const;
void add_channel (std::string const &, DataType);
void add_channel (std::string const &, DataType, std::string const &);
void add_channel (std::string const &, DataType, PortList);
std::string channel_name (uint32_t) const;
DataType channel_type (uint32_t) const;
@ -87,7 +91,7 @@ class Bundle : public PBD::ScopedConnectionList
void remove_ports_from_channel (uint32_t);
void remove_ports_from_channels ();
bool port_attached_to_channel (uint32_t, std::string);
bool uses_port (std::string) const;
bool offers_port (std::string) const;
bool offers_port_alone (std::string) const;
void remove_channel (uint32_t);
void remove_channels ();

View file

@ -89,7 +89,6 @@ class AuxInput;
class BufferSet;
class Bundle;
class Butler;
class ControlProtocolInfo;
class Diskstream;
class ExportHandler;
class ExportStatus;

View file

@ -177,6 +177,18 @@ Bundle::add_channel (std::string const & n, DataType t, PortList p)
emit_changed (ConfigurationChanged);
}
/** @param n Channel name */
void
Bundle::add_channel (std::string const & n, DataType t, std::string const & p)
{
{
Glib::Mutex::Lock lm (_channel_mutex);
_channel.push_back (Channel (n, t, p));
}
emit_changed (ConfigurationChanged);
}
bool
Bundle::port_attached_to_channel (uint32_t ch, std::string portname)
{
@ -211,7 +223,7 @@ Bundle::remove_channels ()
* @return true if any channel is associated with p.
*/
bool
Bundle::uses_port (std::string p) const
Bundle::offers_port (std::string p) const
{
Glib::Mutex::Lock lm (_channel_mutex);

View file

@ -354,3 +354,8 @@ ControlProtocol:: route_get_name (uint32_t table_index)
return r->name();
}
list<boost::shared_ptr<Bundle> >
ControlProtocol::bundles ()
{
return list<boost::shared_ptr<Bundle> > ();
}

View file

@ -33,6 +33,7 @@ namespace ARDOUR {
class Route;
class Session;
class Bundle;
class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI {
public:
@ -98,6 +99,8 @@ class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, pu
std::string route_get_name (uint32_t table_index);
virtual std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
virtual bool has_editor () const { return false; }
virtual void* get_gui() const { return 0; }
virtual void tear_down_gui() { }

View file

@ -83,6 +83,8 @@ MackieControlProtocol::MackieControlProtocol (Session& session)
, _surface (0)
, _jog_wheel (*this)
, _timecode_type (ARDOUR::AnyTime::BBT)
, _input_bundle (new ARDOUR::Bundle (_("Mackie Control In"), true))
, _output_bundle (new ARDOUR::Bundle (_("Mackie Control Out"), false))
{
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::MackieControlProtocol\n");
}
@ -575,6 +577,18 @@ MackieControlProtocol::add_port (MIDI::Port & midi_input_port, MIDI::Port & midi
sport->init_event.connect_same_thread (port_connections, boost::bind (&MackieControlProtocol::handle_port_init, this, sport));
sport->active_event.connect_same_thread (port_connections, boost::bind (&MackieControlProtocol::handle_port_active, this, sport));
sport->inactive_event.connect_same_thread (port_connections, boost::bind (&MackieControlProtocol::handle_port_inactive, this, sport));
_input_bundle->add_channel (
midi_input_port.name(),
ARDOUR::DataType::MIDI,
session->engine().make_port_name_non_relative (midi_input_port.name())
);
_output_bundle->add_channel (
midi_output_port.name(),
ARDOUR::DataType::MIDI,
session->engine().make_port_name_non_relative (midi_output_port.name())
);
}
void
@ -1707,3 +1721,11 @@ MackieControlProtocol::timecode_beats_release (Button &)
return off;
}
list<boost::shared_ptr<ARDOUR::Bundle> >
MackieControlProtocol::bundles ()
{
list<boost::shared_ptr<ARDOUR::Bundle> > b;
b.push_back (_input_bundle);
b.push_back (_output_bundle);
return b;
}

View file

@ -85,6 +85,8 @@ class MackieControlProtocol
Mackie::Surface & surface();
std::list<boost::shared_ptr<ARDOUR::Bundle> > bundles ();
// control events
void handle_control_event(Mackie::SurfacePort & port, Mackie::Control & control, const Mackie::ControlState & state);
@ -337,6 +339,11 @@ class MackieControlProtocol
// Which timecode are we displaying? BBT or Timecode
ARDOUR::AnyTime::Type _timecode_type;
// Bundle to represent our input ports
boost::shared_ptr<ARDOUR::Bundle> _input_bundle;
// Bundle to represent our output ports
boost::shared_ptr<ARDOUR::Bundle> _output_bundle;
};
#endif // ardour_mackie_control_protocol_h