Signed-off-by: falkTX <falktx@falktx.com>tags/v2.1-rc1
| @@ -125,6 +125,8 @@ public: | |||||
| fPorts.usesTime = true; | fPorts.usesTime = true; | ||||
| fPorts.numAudioIns = fPlugin->getAudioInCount(); | fPorts.numAudioIns = fPlugin->getAudioInCount(); | ||||
| fPorts.numAudioOuts = fPlugin->getAudioOutCount(); | fPorts.numAudioOuts = fPlugin->getAudioOutCount(); | ||||
| fPorts.numCVIns = fPlugin->getCVInCount(); | |||||
| fPorts.numCVOuts = fPlugin->getCVOutCount(); | |||||
| fPorts.numMidiIns = fPlugin->getMidiInCount(); | fPorts.numMidiIns = fPlugin->getMidiInCount(); | ||||
| fPorts.numMidiOuts = fPlugin->getMidiOutCount(); | fPorts.numMidiOuts = fPlugin->getMidiOutCount(); | ||||
| fPorts.numParams = fPlugin->getParameterCount(); | fPorts.numParams = fPlugin->getParameterCount(); | ||||
| @@ -221,7 +223,11 @@ public: | |||||
| if (fPlugin->tryLock(fIsOffline)) | if (fPlugin->tryLock(fIsOffline)) | ||||
| { | { | ||||
| fPlugin->initBuffers(); | fPlugin->initBuffers(); | ||||
| fPlugin->process(fPorts.audioIns, fPorts.audioOuts, nullptr, nullptr, frames); | |||||
| fPlugin->process(fPorts.audioCVIns, | |||||
| fPorts.audioCVOuts, | |||||
| fPorts.audioCVIns + fPorts.numAudioIns, | |||||
| fPorts.audioCVOuts + fPorts.numAudioOuts, | |||||
| frames); | |||||
| fPlugin->unlock(); | fPlugin->unlock(); | ||||
| if (fPorts.numMidiOuts > 0) | if (fPorts.numMidiOuts > 0) | ||||
| @@ -285,7 +291,9 @@ public: | |||||
| else | else | ||||
| { | { | ||||
| for (uint32_t i=0; i<fPorts.numAudioOuts; ++i) | for (uint32_t i=0; i<fPorts.numAudioOuts; ++i) | ||||
| carla_zeroFloats(fPorts.audioOuts[i], frames); | |||||
| carla_zeroFloats(fPorts.audioCVOuts[i], frames); | |||||
| for (uint32_t i=0; i<fPorts.numCVOuts; ++i) | |||||
| carla_zeroFloats(fPorts.audioCVOuts[fPorts.numAudioOuts+i], frames); | |||||
| } | } | ||||
| lv2_post_run(frames); | lv2_post_run(frames); | ||||
| @@ -64,6 +64,7 @@ struct PluginListManager { | |||||
| std::strcmp(desc->label, "carlapatchbay16" ) == 0 || | std::strcmp(desc->label, "carlapatchbay16" ) == 0 || | ||||
| std::strcmp(desc->label, "carlapatchbay32" ) == 0 || | std::strcmp(desc->label, "carlapatchbay32" ) == 0 || | ||||
| std::strcmp(desc->label, "carlapatchbay64" ) == 0 || | std::strcmp(desc->label, "carlapatchbay64" ) == 0 || | ||||
| std::strcmp(desc->label, "carlapatchbaycv" ) == 0 || | |||||
| std::strcmp(desc->label, "bigmeter" ) == 0 | std::strcmp(desc->label, "bigmeter" ) == 0 | ||||
| /*std::strcmp(desc->label, "notes" ) == 0*/) | /*std::strcmp(desc->label, "notes" ) == 0*/) | ||||
| { | { | ||||
| @@ -542,6 +542,44 @@ static void writePluginFile(const NativePluginDescriptor* const pluginDesc) | |||||
| text += " ] , [\n"; | text += " ] , [\n"; | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // CV inputs | |||||
| for (uint32_t i=0; i < pluginDesc->cvIns; ++i) | |||||
| { | |||||
| if (i == 0) | |||||
| text += " lv2:port [\n"; | |||||
| text += " a lv2:InputPort, lv2:CVPort ;\n"; | |||||
| text += " lv2:index " + String(portIndex++) + " ;\n"; | |||||
| text += " lv2:symbol \"lv2_cv_in_" + String(i+1) + "\" ;\n"; | |||||
| text += " lv2:name \"CV Input " + String(i+1) + "\" ;\n"; | |||||
| if (i+1 == pluginDesc->cvIns) | |||||
| text += " ] ;\n\n"; | |||||
| else | |||||
| text += " ] , [\n"; | |||||
| } | |||||
| // ------------------------------------------------------------------- | |||||
| // CV outputs | |||||
| for (uint32_t i=0; i < pluginDesc->cvOuts; ++i) | |||||
| { | |||||
| if (i == 0) | |||||
| text += " lv2:port [\n"; | |||||
| text += " a lv2:OutputPort, lv2:CVPort ;\n"; | |||||
| text += " lv2:index " + String(portIndex++) + " ;\n"; | |||||
| text += " lv2:symbol \"lv2_cv_out_" + String(i+1) + "\" ;\n"; | |||||
| text += " lv2:name \"CV Output " + String(i+1) + "\" ;\n"; | |||||
| if (i+1 == pluginDesc->cvOuts) | |||||
| text += " ] ;\n\n"; | |||||
| else | |||||
| text += " ] , [\n"; | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Parameters | // Parameters | ||||
| @@ -141,6 +141,8 @@ public: | |||||
| fPorts.usesTime = fDescriptor->hints & NATIVE_PLUGIN_USES_TIME; | fPorts.usesTime = fDescriptor->hints & NATIVE_PLUGIN_USES_TIME; | ||||
| fPorts.numAudioIns = fDescriptor->audioIns; | fPorts.numAudioIns = fDescriptor->audioIns; | ||||
| fPorts.numAudioOuts = fDescriptor->audioOuts; | fPorts.numAudioOuts = fDescriptor->audioOuts; | ||||
| fPorts.numCVIns = fDescriptor->cvIns; | |||||
| fPorts.numCVOuts = fDescriptor->cvOuts; | |||||
| fPorts.numMidiIns = fDescriptor->midiIns; | fPorts.numMidiIns = fDescriptor->midiIns; | ||||
| fPorts.numMidiOuts = fDescriptor->midiOuts; | fPorts.numMidiOuts = fDescriptor->midiOuts; | ||||
| @@ -319,7 +321,7 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| fDescriptor->process(fHandle, fPorts.audioIns, fPorts.audioOuts, frames, fMidiEvents, fMidiEventCount); | |||||
| fDescriptor->process(fHandle, fPorts.audioCVIns, fPorts.audioCVOuts, frames, fMidiEvents, fMidiEventCount); | |||||
| if (fWorkerUISignal == -1 && fPorts.hasUI) | if (fWorkerUISignal == -1 && fPorts.hasUI) | ||||
| { | { | ||||
| @@ -1236,6 +1236,8 @@ protected: | |||||
| uint32_t indexOffset; | uint32_t indexOffset; | ||||
| uint32_t numAudioIns; | uint32_t numAudioIns; | ||||
| uint32_t numAudioOuts; | uint32_t numAudioOuts; | ||||
| uint32_t numCVIns; | |||||
| uint32_t numCVOuts; | |||||
| uint32_t numMidiIns; | uint32_t numMidiIns; | ||||
| uint32_t numMidiOuts; | uint32_t numMidiOuts; | ||||
| uint32_t numParams; | uint32_t numParams; | ||||
| @@ -1246,8 +1248,8 @@ protected: | |||||
| const LV2_Atom_Sequence** eventsIn; | const LV2_Atom_Sequence** eventsIn; | ||||
| /* */ LV2_Atom_Sequence** eventsOut; | /* */ LV2_Atom_Sequence** eventsOut; | ||||
| /* */ EventsOutData* eventsOutData; | /* */ EventsOutData* eventsOutData; | ||||
| const float** audioIns; | |||||
| /* */ float** audioOuts; | |||||
| const float** audioCVIns; | |||||
| /* */ float** audioCVOuts; | |||||
| /* */ float* freewheel; | /* */ float* freewheel; | ||||
| // cached parameter values | // cached parameter values | ||||
| @@ -1259,6 +1261,8 @@ protected: | |||||
| : indexOffset(0), | : indexOffset(0), | ||||
| numAudioIns(0), | numAudioIns(0), | ||||
| numAudioOuts(0), | numAudioOuts(0), | ||||
| numCVIns(0), | |||||
| numCVOuts(0), | |||||
| numMidiIns(0), | numMidiIns(0), | ||||
| numMidiOuts(0), | numMidiOuts(0), | ||||
| numParams(0), | numParams(0), | ||||
| @@ -1267,8 +1271,8 @@ protected: | |||||
| eventsIn(nullptr), | eventsIn(nullptr), | ||||
| eventsOut(nullptr), | eventsOut(nullptr), | ||||
| eventsOutData(nullptr), | eventsOutData(nullptr), | ||||
| audioIns(nullptr), | |||||
| audioOuts(nullptr), | |||||
| audioCVIns(nullptr), | |||||
| audioCVOuts(nullptr), | |||||
| freewheel(nullptr), | freewheel(nullptr), | ||||
| paramsLast(nullptr), | paramsLast(nullptr), | ||||
| paramsPtr(nullptr), | paramsPtr(nullptr), | ||||
| @@ -1294,16 +1298,16 @@ protected: | |||||
| eventsOutData = nullptr; | eventsOutData = nullptr; | ||||
| } | } | ||||
| if (audioIns != nullptr) | |||||
| if (audioCVIns != nullptr) | |||||
| { | { | ||||
| delete[] audioIns; | |||||
| audioIns = nullptr; | |||||
| delete[] audioCVIns; | |||||
| audioCVIns = nullptr; | |||||
| } | } | ||||
| if (audioOuts != nullptr) | |||||
| if (audioCVOuts != nullptr) | |||||
| { | { | ||||
| delete[] audioOuts; | |||||
| audioOuts = nullptr; | |||||
| delete[] audioCVOuts; | |||||
| audioCVOuts = nullptr; | |||||
| } | } | ||||
| if (paramsLast != nullptr) | if (paramsLast != nullptr) | ||||
| @@ -1355,20 +1359,16 @@ protected: | |||||
| eventsOut[0] = nullptr; | eventsOut[0] = nullptr; | ||||
| } | } | ||||
| if (numAudioIns > 0) | |||||
| if (const uint32_t numAudioCVIns = numAudioIns+numCVIns) | |||||
| { | { | ||||
| audioIns = new const float*[numAudioIns]; | |||||
| for (uint32_t i=0; i < numAudioIns; ++i) | |||||
| audioIns[i] = nullptr; | |||||
| audioCVIns = new const float*[numAudioCVIns]; | |||||
| carla_zeroPointers(audioCVIns, numAudioCVIns); | |||||
| } | } | ||||
| if (numAudioOuts > 0) | |||||
| if (const uint32_t numAudioCVOuts = numAudioOuts+numCVOuts) | |||||
| { | { | ||||
| audioOuts = new float*[numAudioOuts]; | |||||
| for (uint32_t i=0; i < numAudioOuts; ++i) | |||||
| audioOuts[i] = nullptr; | |||||
| audioCVOuts = new float*[numAudioCVOuts]; | |||||
| carla_zeroPointers(audioCVOuts, numAudioCVOuts); | |||||
| } | } | ||||
| if (numParams > 0) | if (numParams > 0) | ||||
| @@ -1384,7 +1384,7 @@ protected: | |||||
| // NOTE: need to be filled in by the parent class | // NOTE: need to be filled in by the parent class | ||||
| } | } | ||||
| indexOffset = numAudioIns + numAudioOuts; | |||||
| indexOffset = numAudioIns + numAudioOuts + numCVIns + numCVOuts; | |||||
| // 1 event port for time or ui if no midi input is used | // 1 event port for time or ui if no midi input is used | ||||
| indexOffset += numMidiIns > 0 ? numMidiIns : ((usesTime || hasUI) ? 1 : 0); | indexOffset += numMidiIns > 0 ? numMidiIns : ((usesTime || hasUI) ? 1 : 0); | ||||
| // 1 event port for ui if no midi output is used | // 1 event port for ui if no midi output is used | ||||
| @@ -1443,7 +1443,7 @@ protected: | |||||
| { | { | ||||
| if (port == index++) | if (port == index++) | ||||
| { | { | ||||
| audioIns[i] = (float*)dataLocation; | |||||
| audioCVIns[i] = (const float*)dataLocation; | |||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| @@ -1452,7 +1452,25 @@ protected: | |||||
| { | { | ||||
| if (port == index++) | if (port == index++) | ||||
| { | { | ||||
| audioOuts[i] = (float*)dataLocation; | |||||
| audioCVOuts[i] = (float*)dataLocation; | |||||
| return; | |||||
| } | |||||
| } | |||||
| for (uint32_t i=0; i < numCVIns; ++i) | |||||
| { | |||||
| if (port == index++) | |||||
| { | |||||
| audioCVIns[numAudioIns+i] = (const float*)dataLocation; | |||||
| return; | |||||
| } | |||||
| } | |||||
| for (uint32_t i=0; i < numCVOuts; ++i) | |||||
| { | |||||
| if (port == index++) | |||||
| { | |||||
| audioCVOuts[numAudioOuts+i] = (float*)dataLocation; | |||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||