Skip to content

Commit

Permalink
Merge pull request #38 from brummbrum/master
Browse files Browse the repository at this point in the history
Release v0.95
  • Loading branch information
brummbrum authored Jan 3, 2020
2 parents 52c6f06 + 83a8778 commit 4390ebb
Show file tree
Hide file tree
Showing 6 changed files with 333 additions and 363 deletions.
10 changes: 4 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
![alt text](ReaKontrol_v093pp.png?raw=true)

# ReaKontrol
- Fork of the excellent ReaKontrol repository published by James Teh: https://github.com/jcsteh/reaKontrol
- Fork of the excellent ReaKontrol repository originally published by James Teh: https://github.com/jcsteh/reaKontrol
- Fork Author: brumbear@pacificpeaks
- Fork Copyright: 2019 Pacific Peaks Studio, see individual copyrights in source code
- Fork Copyright: 2019-2020 Pacific Peaks Studio, see individual copyrights in source code
- License: GNU General Public License version 2.0.
- License Notes: As the original work is published under GPLv2 the modified programs are also licensed under GPLv2. May be updated to GPLv3 if copyright holder of original work agrees to update too.

## Feature Integration & Releases
This fork is mainly a bleeding edge development branch aiming to continuously add functionality to ReaKontrol.
- New features will be merged continously into this fork's master @ https://github.com/brummbrum/reaKontrol
- Testing and calibration is done with NI S-Series Mk2 Komplete Kontrol Keyboard.
- When a critcial amount of functionality has been reached there will be stable releases in a dedicated release branch.
- Binaries are available for releases (Windows only): https://github.com/brummbrum/reaKontrol/releases
- Stable releases are published together with binaries (Windows only) in a dedicated release branch: https://github.com/brummbrum/reaKontrol/releases

## Manual
- Can be found under releases: https://github.com/brummbrum/reaKontrol/releases

## Upstream Integration into Parent Repository
- New features are also offered to the upstream repository @ https://github.com/jcsteh/reaKontrol
- New features may also be offered to the upstream repository @ https://github.com/jcsteh/reaKontrol
- Some updated features may or may not be merged with the upstream master due to possibly different priorities
- The sequence in which new features are published may be different between this fork and the upstream repository due to possibly different priorities
- The parent repository also takes into account dependencies to OSARA relevant for users using screen readers.
Expand Down
78 changes: 13 additions & 65 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/*
* ReaKontrol
* Main plug-in code
* Author: James Teh <jamie@jantrid.net>
* Copyright 2018-2019 James Teh
* Author: brumbear@pacificpeaks
* Copyright 2019-2020 Pacific Peaks Studio
* Previous Authors: James Teh <jamie@jantrid.net>, Leonard de Ruijter, brumbear@pacificpeaks, Copyright 2018-2019 James Teh
* License: GNU General Public License version 2.0
*/

Expand All @@ -19,14 +20,13 @@

using namespace std;

const char KK_FX_PREFIX[] = "VSTi: Komplete Kontrol";
const char KK_INSTANCE_PARAM_PREFIX[] = "NIKB";

/*
const char KKS_DEVICE_NAME[] = "Komplete Kontrol DAW - 1";
const char KKA_DEVICE_NAME[] = "Komplete Kontrol A DAW";
const char KKM_DEVICE_NAME[] = "Komplete Kontrol M DAW";
const char KKMK1_HWID_PREFIX[] = "USB\\VID_17CC&PID_";
const size_t USB_PID_LEN = 4;
const char* KKMK1_USB_PIDS[] = {"1340", "1350", "1360", "1410"};
const char KK_FX_PREFIX[] = "VSTi: Komplete Kontrol";
const char KK_INSTANCE_PARAM_PREFIX[] = "NIKB";
int getKkMidiInput() {
int count = GetNumMIDIInputs();
Expand Down Expand Up @@ -61,45 +61,7 @@ int getKkMidiOutput() {
}
return -1;
}

bool isMk1Connected() {
#ifdef _WIN32
HDEVINFO infoSet = SetupDiGetClassDevsA(&GUID_DEVINTERFACE_USB_DEVICE,
nullptr, nullptr, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT);
for (DWORD i = 0; i < 256; ++i) {
SP_DEVICE_INTERFACE_DATA intData;
intData.cbSize = sizeof(intData);
if (!SetupDiEnumDeviceInterfaces(infoSet, nullptr,
&GUID_DEVINTERFACE_USB_DEVICE, i, &intData)) {
break;
}
SP_DEVINFO_DATA devInfo;
devInfo.cbSize = sizeof(devInfo);
if (!SetupDiGetDeviceInterfaceDetailA(infoSet, &intData, nullptr, 0,
nullptr, &devInfo)) {
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
break;
}
}
char hwId[200];
if (!SetupDiGetDeviceRegistryPropertyA(infoSet, &devInfo,
SPDRP_HARDWAREID, nullptr, (PBYTE)&hwId, sizeof(hwId), nullptr)) {
break;
}
if (strncmp(hwId, KKMK1_HWID_PREFIX, sizeof(KKMK1_HWID_PREFIX) - 1) == 0) {
char* devPid = hwId + sizeof(KKMK1_HWID_PREFIX) - 1;
for (int pidIndex = 0; pidIndex < ARRAYSIZE(KKMK1_USB_PIDS); ++pidIndex) {
if (strncmp(devPid, KKMK1_USB_PIDS[pidIndex], USB_PID_LEN) == 0) {
SetupDiDestroyDeviceInfoList(infoSet);
return true;
}
}
}
}
SetupDiDestroyDeviceInfoList(infoSet);
#endif
return false;
}
*/

const string getKkInstanceName(MediaTrack* track, bool stripPrefix) {
int fxCount = TrackFX_GetCount(track);
Expand All @@ -126,12 +88,8 @@ const string getKkInstanceName(MediaTrack* track, bool stripPrefix) {
return "";
}

BaseSurface::BaseSurface(int inDev, int outDev) {
this->_midiIn = CreateMIDIInput(inDev);
this->_midiOut = CreateMIDIOutput(outDev, false, nullptr);
if (this->_midiOut) {
this->_midiIn->start();
}
BaseSurface::BaseSurface() {
// ToDo: ???
}

BaseSurface::~BaseSurface() {
Expand Down Expand Up @@ -167,21 +125,11 @@ REAPER_PLUGIN_DLL_EXPORT int REAPER_PLUGIN_ENTRYPOINT(REAPER_PLUGIN_HINSTANCE hI
if (rec->caller_version != REAPER_PLUGIN_VERSION || !rec->GetFunc || REAPERAPI_LoadAPI(rec->GetFunc) != 0) {
return 0; // Incompatible.
}

int inDev = getKkMidiInput();
if (inDev != -1) {
int outDev = getKkMidiOutput();
if (outDev != -1) {
if (isMk1Connected()) {
surface = createMcuSurface(inDev, outDev);
} else {
surface = createNiMidiSurface(inDev, outDev);
}
}
}
surface = createNiMidiSurface();
rec->Register("csurf_inst", (void*)surface);
return 1;
} else {
}
else {
// Unload.
if (surface) {
delete surface;
Expand Down
129 changes: 0 additions & 129 deletions src/mcu.cpp

This file was deleted.

Loading

0 comments on commit 4390ebb

Please sign in to comment.