Skip to content

Instantly share code, notes, and snippets.

@Simon-L
Created April 24, 2023 02:31
Show Gist options
  • Save Simon-L/0a97db3eff7dacf9437e7752943dbcde to your computer and use it in GitHub Desktop.
Save Simon-L/0a97db3eff7dacf9437e7752943dbcde to your computer and use it in GitHub Desktop.
diff --git a/src/surge-xt/osc/OSCListener.cpp b/src/surge-xt/osc/OSCListener.cpp
index a209970f..8ed102ce 100644
--- a/src/surge-xt/osc/OSCListener.cpp
+++ b/src/surge-xt/osc/OSCListener.cpp
@@ -128,6 +128,24 @@ void OSCListener::oscMessageReceived(const juce::OSCMessage &message)
#ifdef DEBUG_VERBOSE
std::cout << "Parameter OSC name:" << p->get_osc_name() << " ";
std::cout << "Parameter full name:" << p->get_full_name() << std::endl;
+#endif
+ }
+ else if (tokens[1] == "loadpatchid")
+ {
+ // Not a valid data value
+ if (!message[0].isInt32())
+ {
+ return;
+ }
+ auto requested_id = message[0].getInt32();
+ // 1-indexed and less than total of patches in user library
+ if (requested_id < 1 || (requested_id >= surgePtr->storage.patchOrdering.size()))
+ return;
+
+ surgePtr->patchid_queue = requested_id - 1;
+
+#ifdef DEBUG_VERBOSE
+ std::cout << "Requested patch id: " << requested_id << std::endl;
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment