Skip to content

Commit ea1f819

Browse files
committed
Implementing the Korg MS2000, hopefully this device finally works now. Also, add a guard in that the implementation of the method renamtePatch() is optional, and it will be ignored if the method is not implemented.
1 parent c9540c1 commit ea1f819

File tree

3 files changed

+250
-0
lines changed

3 files changed

+250
-0
lines changed

adaptions/BundledAdaptation.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace knobkraft {
1919
{ "DSI Prophet 12", "DSI_Prophet_12", std::string(DSI_Prophet_12_py, DSI_Prophet_12_py + DSI_Prophet_12_py_size) },
2020
//{ "Korg DW-8000 Adaption", "Korg_DW_8000_Adaption", std::string(KorgDW8000_py, KorgDW8000_py + KorgDW8000_py_size ) },
2121
{ "Korg DW-6000", "Korg_DW_6000", std::string(KorgDW6000_py, KorgDW6000_py + KorgDW6000_py_size) },
22+
{ "Korg MS2000", "Korg_MS2000", std::string(KorgMS2000_py, KorgMS2000_py + KorgMS2000_py_size) },
2223
{ "Matrix 6", "Matrix_6", std::string(Matrix_6_py, Matrix_6_py + Matrix_6_py_size) },
2324
{ "Matrix 1000 Adaption", "Matrix_1000", std::string(Matrix1000_py, Matrix1000_py + Matrix1000_py_size) },
2425
{ "Pioneer Toraiz AS1", "Pioneer_Toraiz_AS1", std::string(PioneerToraiz_AS1_py, PioneerToraiz_AS1_py + PioneerToraiz_AS1_py_size) },

adaptions/GenericAdaptation.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ namespace knobkraft {
6161
patchNumber_ = std::make_shared<GenericPatchNumber>(MidiProgramNumber::fromZeroBase(0));
6262
}
6363

64+
bool pythonModuleHasFunction(std::string const &functionName) {
65+
ScopedLock lock(GenericAdaptation::multiThreadGuard);
66+
if (!adaptation_) {
67+
return false;
68+
}
69+
return py::hasattr(*adaptation_, functionName.c_str());
70+
}
71+
6472
template <typename ... Args>
6573
py::object callMethod(std::string const &methodName, Args& ... args) const {
6674
ScopedLock lock(GenericAdaptation::multiThreadGuard);
@@ -119,6 +127,10 @@ namespace knobkraft {
119127
}
120128

121129
void setName(std::string const &name) override {
130+
// set name is an optional method - if it is not implemented, the name in the patch is never changed, the name displayed in the Librarian is
131+
if (!pythonModuleHasFunction("renamePatch")) return;
132+
133+
// Very well, then try to change the name in the patch data
122134
try {
123135
ScopedLock lock(GenericAdaptation::multiThreadGuard);
124136
std::vector<int> v(data().data(), data().data() + data().size());

adaptions/KorgMS2000.py

+237
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)