#include <climits>
#include "pbd/error.h"
+#include "pbd/controllable_descriptor.h"
#include "pbd/xml++.h"
#include "midi++/port.h"
MIDIControllable::MIDIControllable (Port& p, bool is_bistate)
: controllable (0)
+ , _descriptor (0)
, _port (p)
, bistate (is_bistate)
{
MIDIControllable::MIDIControllable (Port& p, Controllable& c, bool is_bistate)
: controllable (&c)
+ , _descriptor (0)
, _port (p)
, bistate (is_bistate)
+
{
_learned = true; /* from controllable */
setting = false;
MIDIControllable::init (const std::string& s)
{
_current_uri = s;
-
- if (!_current_uri.empty()) {
-
- /* parse URI to get remote control ID and "what" is to be controlled */
-
- string::size_type last_slash;
- string useful_part;
-
- if ((last_slash = _current_uri.find_last_of ('/')) == string::npos) {
- return -1;
- }
-
- useful_part = _current_uri.substr (last_slash+1);
-
- char ridstr[64];
- char what[64];
-
- if (sscanf (useful_part.c_str(), "rid=%63[^?]?%63s", ridstr, what) != 2) {
- return -1;
- }
-
- _what = what;
-
- /* now parse RID string and determine if its a bank-driven ID */
-
- if (strncmp (ridstr, "B-", 2) == 0) {
-
- if (sscanf (&ridstr[2], "%" PRIu32, &_rid) != 1) {
- return -1;
- }
-
- _bank_relative = true;
-
- } else {
- if (sscanf (&ridstr[2], "%" PRIu32, &_rid) != 1) {
- return -1;
- }
- _bank_relative = false;
- }
- }
-
- return 0;
+ delete _descriptor;
+ _descriptor = new ControllableDescriptor;
+ return _descriptor->set (s);
}
void