track changes to config parameters for MMC device id's correctly (from roy vegard)

git-svn-id: svn://localhost/ardour2/branches/3.0@9985 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-08-13 16:27:29 +00:00
parent 77f3fa0943
commit f75bbfd8ac
9 changed files with 40 additions and 9 deletions

View File

@ -3273,6 +3273,14 @@ Editor::freeze_thread ()
void
Editor::freeze_route ()
{
if (!_session) {
return;
}
/* stop transport before we start. this is important */
_session->request_transport_speed (0.0);
if (clicked_routeview == 0 || !clicked_routeview->is_audio_track()) {
return;
}

View File

@ -3453,11 +3453,11 @@ Session::config_changed (std::string p, bool ours)
//poke_midi_thread ();
} else if (p == "mmc-device-id" || p == "mmc-receive-id") {
} else if (p == "mmc-device-id" || p == "mmc-receive-id" || p == "mmc-receive-device-id") {
MIDI::Manager::instance()->mmc()->set_receive_device_id (Config->get_mmc_receive_device_id());
} else if (p == "mmc-send-id") {
} else if (p == "mmc-send-id" || p == "mmc-send-device-id") {
MIDI::Manager::instance()->mmc()->set_send_device_id (Config->get_mmc_send_device_id());

View File

@ -36,6 +36,7 @@ Signal0<void> ControlProtocol::ZoomOut;
Signal0<void> ControlProtocol::ZoomIn;
Signal0<void> ControlProtocol::Enter;
Signal1<void,float> ControlProtocol::ScrollTimeline;
Signal1<void,uint32_t> ControlProtocol::SelectByRID;
ControlProtocol::ControlProtocol (Session& s, string str, EventLoop* evloop)
: BasicUI (s),

View File

@ -61,6 +61,7 @@ class ControlProtocol : virtual public sigc::trackable, public PBD::Stateful, pu
static PBD::Signal0<void> ZoomOut;
static PBD::Signal0<void> Enter;
static PBD::Signal1<void,float> ScrollTimeline;
static PBD::Signal1<void,uint32_t> SelectByRID;
/* the model here is as follows:

View File

@ -772,6 +772,7 @@ GenericMidiControlProtocol::create_function (const XMLNode& node)
MIDI::eventType ev;
MIDI::byte* data = 0;
uint32_t data_size = 0;
string argument;
if ((prop = node.property (X_("ctl"))) != 0) {
ev = MIDI::controller;
@ -843,11 +844,15 @@ GenericMidiControlProtocol::create_function (const XMLNode& node)
}
}
if ((prop = node.property (X_("arg"))) != 0) {
argument = prop->value ();
}
prop = node.property (X_("function"));
MIDIFunction* mf = new MIDIFunction (*_input_port);
if (mf->init (*this, prop->value(), data, data_size)) {
if (mf->setup (*this, prop->value(), argument, data, data_size)) {
delete mf;
return 0;
}

View File

@ -351,7 +351,7 @@ MIDIControllable::send_feedback ()
{
byte msg[3];
if (!_learned || setting || !feedback || control_type == none) {
if (!_learned || setting || !feedback || control_type == none || !controllable) {
return;
}
@ -370,7 +370,7 @@ MIDIControllable::send_feedback ()
MIDI::byte*
MIDIControllable::write_feedback (MIDI::byte* buf, int32_t& bufsize, bool /*force*/)
{
if (control_type != none && feedback && bufsize > 2) {
if (controllable && control_type != none && feedback && bufsize > 2) {
MIDI::byte gm;

View File

@ -35,10 +35,12 @@ MIDIFunction::~MIDIFunction ()
}
int
MIDIFunction::init (GenericMidiControlProtocol& ui, const std::string& invokable_name, MIDI::byte* msg_data, size_t data_sz)
MIDIFunction::setup (GenericMidiControlProtocol& ui, const std::string& invokable_name, const std::string& arg, MIDI::byte* msg_data, size_t data_sz)
{
MIDIInvokable::init (ui, invokable_name, msg_data, data_sz);
_argument = arg;
if (strcasecmp (_invokable_name.c_str(), "transport-stop") == 0) {
_function = TransportStop;
} else if (strcasecmp (_invokable_name.c_str(), "transport-roll") == 0) {
@ -59,6 +61,11 @@ MIDIFunction::init (GenericMidiControlProtocol& ui, const std::string& invokable
_function = NextBank;
} else if (strcasecmp (_invokable_name.c_str(), "prev-bank") == 0) {
_function = PrevBank;
} else if (strcasecmp (_invokable_name.c_str(), "select") == 0) {
if (_argument.empty()) {
return -1;
}
_function = Select;
} else {
return -1;
}
@ -109,6 +116,13 @@ MIDIFunction::execute ()
case TransportRecordDisable:
_ui->set_record_enable (false);
break;
case Select:
if (!_argument.empty()) {
uint32_t rid;
sscanf (_argument.c_str(), "%d", &rid);
_ui->SelectByRID (rid);
}
}
}

View File

@ -52,13 +52,14 @@ class MIDIFunction : public MIDIInvokable
TransportEnd,
TransportLoopToggle,
TransportRecordEnable,
TransportRecordDisable
TransportRecordDisable,
Select,
};
MIDIFunction (MIDI::Port&);
virtual ~MIDIFunction ();
int init (GenericMidiControlProtocol&, const std::string& function_name, MIDI::byte* sysex = 0, size_t ssize = 0);
int setup (GenericMidiControlProtocol&, const std::string& function_name, const std::string& argument, MIDI::byte* sysex = 0, size_t ssize = 0);
const std::string& function_name() const { return _invokable_name; }
@ -67,6 +68,7 @@ class MIDIFunction : public MIDIInvokable
private:
Function _function;
std::string _argument;
void execute ();
};

View File

@ -62,7 +62,7 @@ class MIDIInvokable : public PBD::Stateful
MIDI::channel_t control_channel;
MIDI::byte* data;
size_t data_size;
void midi_sense_note (MIDI::Parser &, MIDI::EventTwoBytes *, bool is_on);
void midi_sense_note_on (MIDI::Parser &p, MIDI::EventTwoBytes *tb);
void midi_sense_note_off (MIDI::Parser &p, MIDI::EventTwoBytes *tb);