Patch from royvegard to add a set-bank midi function
[ardour.git] / libs / surfaces / generic_midi / midifunction.cc
index 302ed0b5528f8545f02522b5fecd6655231e9160..70e9337861e5d4b0601cbd1a14794e920eeeb570 100644 (file)
@@ -61,6 +61,11 @@ MIDIFunction::setup (GenericMidiControlProtocol& ui, const std::string& invokabl
                _function = NextBank;
        } else if (strcasecmp (_invokable_name.c_str(), "prev-bank") == 0) {
                _function = PrevBank;
+       } else if (strcasecmp (_invokable_name.c_str(), "set-bank") == 0) {
+               if (_argument.empty()) {
+                       return -1;
+               }
+               _function = SetBank;
        } else if (strcasecmp (_invokable_name.c_str(), "select") == 0) {
                if (_argument.empty()) {
                        return -1;
@@ -95,6 +100,14 @@ MIDIFunction::execute ()
                _ui->prev_bank();
                break;
 
+       case SetBank:
+               if (!_argument.empty()) {
+                       uint32_t bank;
+                       sscanf (_argument.c_str(), "%d", &bank);
+                       _ui->set_current_bank (bank);
+               }
+               break;
+
        case TransportStop:
                _ui->transport_stop ();
                break;