diff --git a/readme.md b/readme.md index a824679..9eae5a5 100644 --- a/readme.md +++ b/readme.md @@ -58,14 +58,26 @@ The resulting dll can be found in the `build/bin/Release` directory (Windows) Note: If you are still building for Reaper x86 32bit specify -A x86 as target architecture above. ### How to build on OSX +#### Intel x86 based Mac To build ReaKontrol, from a command prompt, change to the ReaKontrol checkout directory and run the following commands: ``` cd build cmake .. cmake --build . --config Release ``` -The resulting dll can be found in the `build/lib` directory (OSX). +The resulting dylib can be found in the `build/lib` directory (OSX). +#### ARM based Mac +First, comment out 'set(CMAKE_OSX_ARCHITECTURES x86_64)' in 'CMakeLists.txt'. Then build as described above. + +Both ARM and x86 binaries can reside in parallel and load depending on Rosetta settings by naming them like this: + +``` +ls ~/Library/Application\ Support/REAPER/UserPlugins + +reaper_kontrol-x86_64.dylib +reaper_kontrol.dylib +``` ### How to Install If you have followed the build steps, you can attach the last command: ``` diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bf8442e..9ae4b74 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,6 +23,7 @@ elseif(APPLE) include(FetchContent) FetchContent_Declare(WDL GIT_REPOSITORY https://github.com/justinfrankel/WDL.git + GIT_TAG main SOURCE_DIR "${CMAKE_SOURCE_DIR}/WDL" ) FetchContent_MakeAvailable(WDL) diff --git a/src/main.cpp b/src/main.cpp index 1661a06..65e5777 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,7 +39,7 @@ DWORD GetTickCount() using namespace std; const char KK_VST_PREFIX[] = "VSTi: Komplete Kontrol"; -const char KK_VST3_PREFIX[] = "VST3i: Komplete Kontrol"; +const char KK_VST3_PREFIX[] = "VST3i: Komplete Kontro"; // lazy cheat to make it the same length as VST2 const char KK_INSTANCE_PARAM_PREFIX[] = "NIKB"; @@ -47,7 +47,7 @@ const string getKkInstanceName(MediaTrack* track, bool stripPrefix) { int fxCount = TrackFX_GetCount(track); for (int fx = 0; fx < fxCount; ++fx) { // Find the Komplete Kontrol FX. - char fxName[sizeof(KK_VST3_PREFIX)]; + char fxName[sizeof(KK_VST_PREFIX)]; TrackFX_GetFXName(track, fx, fxName, sizeof(fxName)); if (strcmp(fxName, KK_VST_PREFIX) != 0 && strcmp(fxName, KK_VST3_PREFIX) != 0) { diff --git a/src/niMidi.cpp b/src/niMidi.cpp index 5454fc7..82be60e 100644 --- a/src/niMidi.cpp +++ b/src/niMidi.cpp @@ -160,6 +160,17 @@ void loadActionList() { s_filename += REAKONTROL_INI; s_filename.push_back('\0'); pathname = &s_filename[0]; + if (!file_exists(pathname)) { + WritePrivateProfileString("reakontrol_actions", "action_0_id", "40001", pathname); // Windows only. Mac OSX via Swell version of this + if (!WritePrivateProfileString("reakontrol_actions", "action_0_name", "Insert Default Track", pathname)) { + ostringstream s; + s << "Unable to write configuration file! Please read manual, subfolder must exist for the configuration file:" + << endl << endl + << s_filename; + ShowMessageBox(s.str().c_str(), "ReaKontrol", 0); + g_actionList.ID[0] = -1; + } + } if (file_exists(pathname)) { std::string s_keyName; char* key; @@ -170,14 +181,14 @@ void loadActionList() { s_keyName = "action_" + std::to_string(i) + "_ID"; s_keyName.push_back('\0'); key = &s_keyName[0]; - GetPrivateProfileString("reakontrol_actions", key, nullptr, &stringOut[0], stringOut_sz, pathname); // Windows only. Mac OSX via Swell version of this? + GetPrivateProfileString("reakontrol_actions", key, nullptr, &stringOut[0], stringOut_sz, pathname); // Windows only. Mac OSX via Swell version of this if (stringOut[0] != '\0') { g_actionList.ID[i] = NamedCommandLookup(&stringOut[0]); if (g_actionList.ID[i]) { s_keyName = "action_" + std::to_string(i) + "_name"; s_keyName.push_back('\0'); key = &s_keyName[0]; - GetPrivateProfileString("reakontrol_actions", key, nullptr, &stringOut[0], stringOut_sz, pathname); // Windows only. Mac OSX via Swell version of this? + GetPrivateProfileString("reakontrol_actions", key, nullptr, &stringOut[0], stringOut_sz, pathname); // Windows only. Mac OSX via Swell version of this if (stringOut[0] != '\0') { strcpy_s(&g_actionList.name[i][0], A_NAME_MAX, &stringOut[0]); }