Closes #262tags/1.9.7
| @@ -711,11 +711,13 @@ public: | |||||
| uint getMaxClientNameSize() const noexcept override | uint getMaxClientNameSize() const noexcept override | ||||
| { | { | ||||
| #ifndef BUILD_BRIDGE | |||||
| if (pData->options.processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT || pData->options.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | if (pData->options.processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT || pData->options.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | ||||
| #endif | |||||
| { | { | ||||
| try { | try { | ||||
| return static_cast<uint>(jackbridge_client_name_size()); | |||||
| } CARLA_SAFE_EXCEPTION_RETURN("jack_client_name_size", 0); | |||||
| return static_cast<uint>(jackbridge_client_name_size()-1); | |||||
| } CARLA_SAFE_EXCEPTION_RETURN("jack_client_name_size", 32); | |||||
| } | } | ||||
| return CarlaEngine::getMaxClientNameSize(); | return CarlaEngine::getMaxClientNameSize(); | ||||
| @@ -726,8 +728,8 @@ public: | |||||
| if (pData->options.processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT || pData->options.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | if (pData->options.processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT || pData->options.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | ||||
| { | { | ||||
| try { | try { | ||||
| return static_cast<uint>(jackbridge_port_name_size()); | |||||
| } CARLA_SAFE_EXCEPTION_RETURN("jack_port_name_size", 0); | |||||
| return static_cast<uint>(jackbridge_port_name_size()-1); | |||||
| } CARLA_SAFE_EXCEPTION_RETURN("jack_port_name_size", 255); | |||||
| } | } | ||||
| return CarlaEngine::getMaxPortNameSize(); | return CarlaEngine::getMaxPortNameSize(); | ||||
| @@ -749,10 +751,13 @@ public: | |||||
| carla_zeroStruct<jack_position_t>(fTransportPos); | carla_zeroStruct<jack_position_t>(fTransportPos); | ||||
| CarlaString truncatedClientName(clientName); | |||||
| truncatedClientName.truncate(getMaxClientNameSize()); | |||||
| #ifdef BUILD_BRIDGE | #ifdef BUILD_BRIDGE | ||||
| fIsRunning = true; | fIsRunning = true; | ||||
| if (! pData->init(clientName)) | |||||
| if (! pData->init(truncatedClientName)) | |||||
| { | { | ||||
| close(); | close(); | ||||
| setLastError("Failed to init internal data"); | setLastError("Failed to init internal data"); | ||||
| @@ -762,7 +767,7 @@ public: | |||||
| if (pData->bufferSize == 0 || carla_compareFloats(pData->sampleRate, 0.0)) | if (pData->bufferSize == 0 || carla_compareFloats(pData->sampleRate, 0.0)) | ||||
| { | { | ||||
| // open temp client to get initial buffer-size and sample-rate values | // open temp client to get initial buffer-size and sample-rate values | ||||
| if (jack_client_t* const tmpClient = jackbridge_client_open(clientName, JackNoStartServer, nullptr)) | |||||
| if (jack_client_t* const tmpClient = jackbridge_client_open(truncatedClientName, JackNoStartServer, nullptr)) | |||||
| { | { | ||||
| pData->bufferSize = jackbridge_get_buffer_size(tmpClient); | pData->bufferSize = jackbridge_get_buffer_size(tmpClient); | ||||
| pData->sampleRate = jackbridge_get_sample_rate(tmpClient); | pData->sampleRate = jackbridge_get_sample_rate(tmpClient); | ||||
| @@ -779,7 +784,7 @@ public: | |||||
| return true; | return true; | ||||
| #else | #else | ||||
| fClient = jackbridge_client_open(clientName, JackNullOption, nullptr); | |||||
| fClient = jackbridge_client_open(truncatedClientName, JackNullOption, nullptr); | |||||
| if (fClient == nullptr) | if (fClient == nullptr) | ||||
| { | { | ||||
| @@ -1167,8 +1167,6 @@ protected: | |||||
| hints |= NATIVE_PARAMETER_USES_SAMPLE_RATE; | hints |= NATIVE_PARAMETER_USES_SAMPLE_RATE; | ||||
| if (paramData.hints & PARAMETER_USES_SCALEPOINTS) | if (paramData.hints & PARAMETER_USES_SCALEPOINTS) | ||||
| hints |= NATIVE_PARAMETER_USES_SCALEPOINTS; | hints |= NATIVE_PARAMETER_USES_SCALEPOINTS; | ||||
| if (paramData.hints & PARAMETER_USES_CUSTOM_TEXT) | |||||
| hints |= NATIVE_PARAMETER_USES_CUSTOM_TEXT; | |||||
| if (paramData.type == PARAMETER_INPUT || paramData.type == PARAMETER_OUTPUT) | if (paramData.type == PARAMETER_INPUT || paramData.type == PARAMETER_OUTPUT) | ||||
| { | { | ||||
| @@ -1208,24 +1206,6 @@ protected: | |||||
| return 0.0f; | return 0.0f; | ||||
| } | } | ||||
| const char* getParameterText(const uint32_t index /*, const float value*/) const | |||||
| { | |||||
| if (CarlaPlugin* const plugin = _getFirstPlugin()) | |||||
| { | |||||
| if (index < plugin->getParameterCount()) | |||||
| { | |||||
| static char strBuf[STR_MAX+1]; | |||||
| carla_zeroChar(strBuf, STR_MAX+1); | |||||
| plugin->getParameterText(index, /*value,*/ strBuf); | |||||
| return strBuf; | |||||
| } | |||||
| } | |||||
| return nullptr; | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| @@ -1691,11 +1671,6 @@ public: | |||||
| return handlePtr->getParameterValue(index); | return handlePtr->getParameterValue(index); | ||||
| } | } | ||||
| static const char* _get_parameter_text(NativePluginHandle handle, uint32_t index /*, float value*/) | |||||
| { | |||||
| return handlePtr->getParameterText(index /*, value*/); | |||||
| } | |||||
| static uint32_t _get_midi_program_count(NativePluginHandle handle) | static uint32_t _get_midi_program_count(NativePluginHandle handle) | ||||
| { | { | ||||
| return handlePtr->getMidiProgramCount(); | return handlePtr->getMidiProgramCount(); | ||||
| @@ -1843,7 +1818,6 @@ static const NativePluginDescriptor carlaRackDesc = { | |||||
| CarlaEngineNative::_get_parameter_count, | CarlaEngineNative::_get_parameter_count, | ||||
| CarlaEngineNative::_get_parameter_info, | CarlaEngineNative::_get_parameter_info, | ||||
| CarlaEngineNative::_get_parameter_value, | CarlaEngineNative::_get_parameter_value, | ||||
| CarlaEngineNative::_get_parameter_text, | |||||
| CarlaEngineNative::_get_midi_program_count, | CarlaEngineNative::_get_midi_program_count, | ||||
| CarlaEngineNative::_get_midi_program_info, | CarlaEngineNative::_get_midi_program_info, | ||||
| CarlaEngineNative::_set_parameter_value, | CarlaEngineNative::_set_parameter_value, | ||||
| @@ -1886,7 +1860,6 @@ static const NativePluginDescriptor carlaPatchbayDesc = { | |||||
| CarlaEngineNative::_get_parameter_count, | CarlaEngineNative::_get_parameter_count, | ||||
| CarlaEngineNative::_get_parameter_info, | CarlaEngineNative::_get_parameter_info, | ||||
| CarlaEngineNative::_get_parameter_value, | CarlaEngineNative::_get_parameter_value, | ||||
| CarlaEngineNative::_get_parameter_text, | |||||
| CarlaEngineNative::_get_midi_program_count, | CarlaEngineNative::_get_midi_program_count, | ||||
| CarlaEngineNative::_get_midi_program_info, | CarlaEngineNative::_get_midi_program_info, | ||||
| CarlaEngineNative::_set_parameter_value, | CarlaEngineNative::_set_parameter_value, | ||||
| @@ -1929,7 +1902,6 @@ static const NativePluginDescriptor carlaPatchbay3sDesc = { | |||||
| CarlaEngineNative::_get_parameter_count, | CarlaEngineNative::_get_parameter_count, | ||||
| CarlaEngineNative::_get_parameter_info, | CarlaEngineNative::_get_parameter_info, | ||||
| CarlaEngineNative::_get_parameter_value, | CarlaEngineNative::_get_parameter_value, | ||||
| CarlaEngineNative::_get_parameter_text, | |||||
| CarlaEngineNative::_get_midi_program_count, | CarlaEngineNative::_get_midi_program_count, | ||||
| CarlaEngineNative::_get_midi_program_info, | CarlaEngineNative::_get_midi_program_info, | ||||
| CarlaEngineNative::_set_parameter_value, | CarlaEngineNative::_set_parameter_value, | ||||
| @@ -1972,7 +1944,6 @@ static const NativePluginDescriptor carlaPatchbay16Desc = { | |||||
| CarlaEngineNative::_get_parameter_count, | CarlaEngineNative::_get_parameter_count, | ||||
| CarlaEngineNative::_get_parameter_info, | CarlaEngineNative::_get_parameter_info, | ||||
| CarlaEngineNative::_get_parameter_value, | CarlaEngineNative::_get_parameter_value, | ||||
| CarlaEngineNative::_get_parameter_text, | |||||
| CarlaEngineNative::_get_midi_program_count, | CarlaEngineNative::_get_midi_program_count, | ||||
| CarlaEngineNative::_get_midi_program_info, | CarlaEngineNative::_get_midi_program_info, | ||||
| CarlaEngineNative::_set_parameter_value, | CarlaEngineNative::_set_parameter_value, | ||||
| @@ -2015,7 +1986,6 @@ static const NativePluginDescriptor carlaPatchbay32Desc = { | |||||
| CarlaEngineNative::_get_parameter_count, | CarlaEngineNative::_get_parameter_count, | ||||
| CarlaEngineNative::_get_parameter_info, | CarlaEngineNative::_get_parameter_info, | ||||
| CarlaEngineNative::_get_parameter_value, | CarlaEngineNative::_get_parameter_value, | ||||
| CarlaEngineNative::_get_parameter_text, | |||||
| CarlaEngineNative::_get_midi_program_count, | CarlaEngineNative::_get_midi_program_count, | ||||
| CarlaEngineNative::_get_midi_program_info, | CarlaEngineNative::_get_midi_program_info, | ||||
| CarlaEngineNative::_set_parameter_value, | CarlaEngineNative::_set_parameter_value, | ||||
| @@ -467,25 +467,6 @@ public: | |||||
| CarlaPlugin::getParameterName(parameterId, strBuf); | CarlaPlugin::getParameterName(parameterId, strBuf); | ||||
| } | } | ||||
| void getParameterText(const uint32_t parameterId, char* const strBuf) const noexcept override | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_text != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_value != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); | |||||
| // FIXME - try | |||||
| if (const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId /*, fDescriptor->get_parameter_value(fHandle, parameterId)*/)) | |||||
| { | |||||
| std::strncpy(strBuf, text, STR_MAX); | |||||
| return; | |||||
| } | |||||
| carla_safe_assert("const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value)", __FILE__, __LINE__); | |||||
| CarlaPlugin::getParameterText(parameterId, strBuf); | |||||
| } | |||||
| void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override | void getParameterUnit(const uint32_t parameterId, char* const strBuf) const noexcept override | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | ||||
| @@ -1106,9 +1087,6 @@ public: | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_USES_SCALEPOINTS) | if (paramInfo->hints & NATIVE_PARAMETER_USES_SCALEPOINTS) | ||||
| pData->param.data[j].hints |= PARAMETER_USES_SCALEPOINTS; | pData->param.data[j].hints |= PARAMETER_USES_SCALEPOINTS; | ||||
| if (paramInfo->hints & NATIVE_PARAMETER_USES_CUSTOM_TEXT) | |||||
| pData->param.data[j].hints |= PARAMETER_USES_CUSTOM_TEXT; | |||||
| pData->param.ranges[j].min = min; | pData->param.ranges[j].min = min; | ||||
| pData->param.ranges[j].max = max; | pData->param.ranges[j].max = max; | ||||
| pData->param.ranges[j].def = def; | pData->param.ranges[j].def = def; | ||||
| @@ -398,6 +398,12 @@ int main(int argc, char* argv[]) | |||||
| CarlaString clientName(name != nullptr ? name : label); | CarlaString clientName(name != nullptr ? name : label); | ||||
| // LV2 URI is not usable as client name | |||||
| //if (itype == CarlaBackend::PLUGIN_LV2 && clientName == label) | |||||
| { | |||||
| } | |||||
| if (clientName.isEmpty()) | if (clientName.isEmpty()) | ||||
| { | { | ||||
| const String jfilename = String(CharPointer_UTF8(filename)); | const String jfilename = String(CharPointer_UTF8(filename)); | ||||
| @@ -84,8 +84,7 @@ typedef enum { | |||||
| NATIVE_PARAMETER_IS_INTEGER = 1 << 4, | NATIVE_PARAMETER_IS_INTEGER = 1 << 4, | ||||
| NATIVE_PARAMETER_IS_LOGARITHMIC = 1 << 5, | NATIVE_PARAMETER_IS_LOGARITHMIC = 1 << 5, | ||||
| NATIVE_PARAMETER_USES_SAMPLE_RATE = 1 << 6, | NATIVE_PARAMETER_USES_SAMPLE_RATE = 1 << 6, | ||||
| NATIVE_PARAMETER_USES_SCALEPOINTS = 1 << 7, | |||||
| NATIVE_PARAMETER_USES_CUSTOM_TEXT = 1 << 8 | |||||
| NATIVE_PARAMETER_USES_SCALEPOINTS = 1 << 7 | |||||
| } NativeParameterHints; | } NativeParameterHints; | ||||
| typedef enum { | typedef enum { | ||||
| @@ -225,7 +224,6 @@ typedef struct _NativePluginDescriptor { | |||||
| uint32_t (*get_parameter_count)(NativePluginHandle handle); | uint32_t (*get_parameter_count)(NativePluginHandle handle); | ||||
| const NativeParameter* (*get_parameter_info)(NativePluginHandle handle, uint32_t index); | const NativeParameter* (*get_parameter_info)(NativePluginHandle handle, uint32_t index); | ||||
| float (*get_parameter_value)(NativePluginHandle handle, uint32_t index); | float (*get_parameter_value)(NativePluginHandle handle, uint32_t index); | ||||
| const char* (*get_parameter_text)(NativePluginHandle handle, uint32_t index /*, float value*/); | |||||
| uint32_t (*get_midi_program_count)(NativePluginHandle handle); | uint32_t (*get_midi_program_count)(NativePluginHandle handle); | ||||
| const NativeMidiProgram* (*get_midi_program_info)(NativePluginHandle handle, uint32_t index); | const NativeMidiProgram* (*get_midi_program_info)(NativePluginHandle handle, uint32_t index); | ||||
| @@ -235,12 +235,6 @@ protected: | |||||
| return 0.0f; | return 0.0f; | ||||
| } | } | ||||
| virtual const char* getParameterText(const uint32_t index /*, const float value*/) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), nullptr); | |||||
| return nullptr; | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| @@ -401,11 +395,6 @@ public: | |||||
| return handlePtr->getParameterValue(index); | return handlePtr->getParameterValue(index); | ||||
| } | } | ||||
| static const char* _get_parameter_text(NativePluginHandle handle, uint32_t index /*, float value*/) | |||||
| { | |||||
| return handlePtr->getParameterText(index /*, value*/); | |||||
| } | |||||
| static uint32_t _get_midi_program_count(NativePluginHandle handle) | static uint32_t _get_midi_program_count(NativePluginHandle handle) | ||||
| { | { | ||||
| return handlePtr->getMidiProgramCount(); | return handlePtr->getMidiProgramCount(); | ||||
| @@ -537,7 +526,6 @@ public: \ | |||||
| ClassName::_get_parameter_count, \ | ClassName::_get_parameter_count, \ | ||||
| ClassName::_get_parameter_info, \ | ClassName::_get_parameter_info, \ | ||||
| ClassName::_get_parameter_value, \ | ClassName::_get_parameter_value, \ | ||||
| ClassName::_get_parameter_text, \ | |||||
| ClassName::_get_midi_program_count, \ | ClassName::_get_midi_program_count, \ | ||||
| ClassName::_get_midi_program_info, \ | ClassName::_get_midi_program_info, \ | ||||
| ClassName::_set_parameter_value, \ | ClassName::_set_parameter_value, \ | ||||
| @@ -590,7 +590,7 @@ int jackbridge_client_name_size() | |||||
| if (getBridgeInstance().client_name_size_ptr != nullptr) | if (getBridgeInstance().client_name_size_ptr != nullptr) | ||||
| return getBridgeInstance().client_name_size_ptr(); | return getBridgeInstance().client_name_size_ptr(); | ||||
| #endif | #endif | ||||
| return 0; | |||||
| return 33; | |||||
| } | } | ||||
| char* jackbridge_get_client_name(jack_client_t* client) | char* jackbridge_get_client_name(jack_client_t* client) | ||||
| @@ -1214,7 +1214,7 @@ int jackbridge_port_name_size() | |||||
| if (getBridgeInstance().port_name_size_ptr != nullptr) | if (getBridgeInstance().port_name_size_ptr != nullptr) | ||||
| return getBridgeInstance().port_name_size_ptr(); | return getBridgeInstance().port_name_size_ptr(); | ||||
| #endif | #endif | ||||
| return 0; | |||||
| return 256; | |||||
| } | } | ||||
| int jackbridge_port_type_size() | int jackbridge_port_type_size() | ||||
| @@ -1226,7 +1226,7 @@ int jackbridge_port_type_size() | |||||
| if (getBridgeInstance().port_type_size_ptr != nullptr) | if (getBridgeInstance().port_type_size_ptr != nullptr) | ||||
| return getBridgeInstance().port_type_size_ptr(); | return getBridgeInstance().port_type_size_ptr(); | ||||
| #endif | #endif | ||||
| return 0; | |||||
| return 32; | |||||
| } | } | ||||
| size_t jackbridge_port_type_get_buffer_size(jack_client_t* client, const char* port_type) | size_t jackbridge_port_type_get_buffer_size(jack_client_t* client, const char* port_type) | ||||
| @@ -21,10 +21,10 @@ | |||||
| #undef DESCFUNCS | #undef DESCFUNCS | ||||
| #define DESCFUNCS \ | #define DESCFUNCS \ | ||||
| nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, \ | |||||
| nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, \ | |||||
| nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, \ | |||||
| nullptr, nullptr, nullptr, nullptr | |||||
| nullptr, nullptr, nullptr, nullptr, nullptr, \ | |||||
| nullptr, nullptr, nullptr, nullptr, nullptr, \ | |||||
| nullptr, nullptr, nullptr, nullptr, nullptr, \ | |||||
| nullptr, nullptr, nullptr, nullptr, nullptr, nullptr | |||||
| static const NativePluginDescriptor sNativePluginDescriptors[] = { | static const NativePluginDescriptor sNativePluginDescriptors[] = { | ||||
| @@ -64,7 +64,6 @@ static const NativePluginDescriptor bypassDesc = { | |||||
| .get_parameter_count = NULL, | .get_parameter_count = NULL, | ||||
| .get_parameter_info = NULL, | .get_parameter_info = NULL, | ||||
| .get_parameter_value = NULL, | .get_parameter_value = NULL, | ||||
| .get_parameter_text = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| @@ -285,7 +285,6 @@ static const NativePluginDescriptor lfoDesc = { | |||||
| .get_parameter_count = lfo_get_parameter_count, | .get_parameter_count = lfo_get_parameter_count, | ||||
| .get_parameter_info = lfo_get_parameter_info, | .get_parameter_info = lfo_get_parameter_info, | ||||
| .get_parameter_value = lfo_get_parameter_value, | .get_parameter_value = lfo_get_parameter_value, | ||||
| .get_parameter_text = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| @@ -165,7 +165,6 @@ static const NativePluginDescriptor midichanfilterDesc = { | |||||
| .get_parameter_count = midichanfilter_get_parameter_count, | .get_parameter_count = midichanfilter_get_parameter_count, | ||||
| .get_parameter_info = midichanfilter_get_parameter_info, | .get_parameter_info = midichanfilter_get_parameter_info, | ||||
| .get_parameter_value = midichanfilter_get_parameter_value, | .get_parameter_value = midichanfilter_get_parameter_value, | ||||
| .get_parameter_text = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| @@ -235,7 +235,6 @@ static const NativePluginDescriptor midigainDesc = { | |||||
| .get_parameter_count = midigain_get_parameter_count, | .get_parameter_count = midigain_get_parameter_count, | ||||
| .get_parameter_info = midigain_get_parameter_info, | .get_parameter_info = midigain_get_parameter_info, | ||||
| .get_parameter_value = midigain_get_parameter_value, | .get_parameter_value = midigain_get_parameter_value, | ||||
| .get_parameter_text = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| @@ -105,7 +105,6 @@ static const NativePluginDescriptor midijoinDesc = { | |||||
| .get_parameter_count = NULL, | .get_parameter_count = NULL, | ||||
| .get_parameter_info = NULL, | .get_parameter_info = NULL, | ||||
| .get_parameter_value = NULL, | .get_parameter_value = NULL, | ||||
| .get_parameter_text = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| @@ -105,7 +105,6 @@ static const NativePluginDescriptor midisplitDesc = { | |||||
| .get_parameter_count = NULL, | .get_parameter_count = NULL, | ||||
| .get_parameter_info = NULL, | .get_parameter_info = NULL, | ||||
| .get_parameter_value = NULL, | .get_parameter_value = NULL, | ||||
| .get_parameter_text = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| @@ -86,7 +86,6 @@ static const NativePluginDescriptor midithroughDesc = { | |||||
| .get_parameter_count = NULL, | .get_parameter_count = NULL, | ||||
| .get_parameter_info = NULL, | .get_parameter_info = NULL, | ||||
| .get_parameter_value = NULL, | .get_parameter_value = NULL, | ||||
| .get_parameter_text = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| @@ -164,7 +164,6 @@ static const NativePluginDescriptor miditransposeDesc = { | |||||
| .get_parameter_count = miditranspose_get_parameter_count, | .get_parameter_count = miditranspose_get_parameter_count, | ||||
| .get_parameter_info = miditranspose_get_parameter_info, | .get_parameter_info = miditranspose_get_parameter_info, | ||||
| .get_parameter_value = miditranspose_get_parameter_value, | .get_parameter_value = miditranspose_get_parameter_value, | ||||
| .get_parameter_text = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| @@ -408,7 +408,6 @@ static const NativePluginDescriptor rev1AmbisonicDesc = { | |||||
| REV1Plugin::_get_parameter_count, | REV1Plugin::_get_parameter_count, | ||||
| REV1Plugin::_get_parameter_info, | REV1Plugin::_get_parameter_info, | ||||
| REV1Plugin::_get_parameter_value, | REV1Plugin::_get_parameter_value, | ||||
| REV1Plugin::_get_parameter_text, | |||||
| REV1Plugin::_get_midi_program_count, | REV1Plugin::_get_midi_program_count, | ||||
| REV1Plugin::_get_midi_program_info, | REV1Plugin::_get_midi_program_info, | ||||
| REV1Plugin::_set_parameter_value, | REV1Plugin::_set_parameter_value, | ||||
| @@ -448,7 +447,6 @@ static const NativePluginDescriptor rev1StereoDesc = { | |||||
| REV1Plugin::_get_parameter_count, | REV1Plugin::_get_parameter_count, | ||||
| REV1Plugin::_get_parameter_info, | REV1Plugin::_get_parameter_info, | ||||
| REV1Plugin::_get_parameter_value, | REV1Plugin::_get_parameter_value, | ||||
| REV1Plugin::_get_parameter_text, | |||||
| REV1Plugin::_get_midi_program_count, | REV1Plugin::_get_midi_program_count, | ||||
| REV1Plugin::_get_midi_program_info, | REV1Plugin::_get_midi_program_info, | ||||
| REV1Plugin::_set_parameter_value, | REV1Plugin::_set_parameter_value, | ||||
| @@ -79,10 +79,6 @@ struct PluginListManager { | |||||
| continue; | continue; | ||||
| } | } | ||||
| // skip midi plugins, not implemented yet | |||||
| if (desc->audioIns == 0 && desc->audioOuts == 0 && desc->midiIns >= 1 && desc->midiOuts >= 1) | |||||
| continue; | |||||
| descs.append(desc); | descs.append(desc); | ||||
| } | } | ||||
| } | } | ||||
| @@ -328,15 +328,31 @@ static void writePluginFile(const NativePluginDescriptor* const pluginDesc) | |||||
| text += " lv2:designation lv2:control ;\n"; | text += " lv2:designation lv2:control ;\n"; | ||||
| text += " lv2:index " + String(portIndex++) + " ;\n"; | text += " lv2:index " + String(portIndex++) + " ;\n"; | ||||
| if (pluginDesc->midiIns > 1) | |||||
| if (pluginDesc->hints & NATIVE_PLUGIN_USES_TIME) | |||||
| { | { | ||||
| text += " lv2:symbol \"lv2_events_in_1\" ;\n"; | |||||
| text += " lv2:name \"Events Input #1\" ;\n"; | |||||
| if (pluginDesc->midiIns > 1) | |||||
| { | |||||
| text += " lv2:symbol \"lv2_events_in_1\" ;\n"; | |||||
| text += " lv2:name \"Events Input #1\" ;\n"; | |||||
| } | |||||
| else | |||||
| { | |||||
| text += " lv2:symbol \"lv2_events_in\" ;\n"; | |||||
| text += " lv2:name \"Events Input\" ;\n"; | |||||
| } | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| text += " lv2:symbol \"lv2_events_in\" ;\n"; | |||||
| text += " lv2:name \"Events Input\" ;\n"; | |||||
| if (pluginDesc->midiIns > 1) | |||||
| { | |||||
| text += " lv2:symbol \"lv2_midi_in_1\" ;\n"; | |||||
| text += " lv2:name \"MIDI Input #1\" ;\n"; | |||||
| } | |||||
| else | |||||
| { | |||||
| text += " lv2:symbol \"lv2_midi_in\" ;\n"; | |||||
| text += " lv2:name \"MIDI Input\" ;\n"; | |||||
| } | |||||
| } | } | ||||
| text += " ] ;\n\n"; | text += " ] ;\n\n"; | ||||
| @@ -354,17 +370,8 @@ static void writePluginFile(const NativePluginDescriptor* const pluginDesc) | |||||
| text += " atom:bufferType atom:Sequence ;\n"; | text += " atom:bufferType atom:Sequence ;\n"; | ||||
| text += " atom:supports <" LV2_MIDI__MidiEvent "> ;\n"; | text += " atom:supports <" LV2_MIDI__MidiEvent "> ;\n"; | ||||
| text += " lv2:index " + String(portIndex++) + " ;\n"; | text += " lv2:index " + String(portIndex++) + " ;\n"; | ||||
| if (pluginDesc->midiIns > 1) | |||||
| { | |||||
| text += " lv2:symbol \"lv2_events_in_" + String(i+1) + "\" ;\n"; | |||||
| text += " lv2:name \"Events Input #" + String(i+1) + "\" ;\n"; | |||||
| } | |||||
| else | |||||
| { | |||||
| text += " lv2:symbol \"lv2_events_in\" ;\n"; | |||||
| text += " lv2:name \"Events Input\" ;\n"; | |||||
| } | |||||
| text += " lv2:symbol \"lv2_midi_in_" + String(i+1) + "\" ;\n"; | |||||
| text += " lv2:name \"MIDI Input #" + String(i+1) + "\" ;\n"; | |||||
| if (i+1 == pluginDesc->midiIns) | if (i+1 == pluginDesc->midiIns) | ||||
| text += " ] ;\n\n"; | text += " ] ;\n\n"; | ||||
| @@ -372,7 +379,6 @@ static void writePluginFile(const NativePluginDescriptor* const pluginDesc) | |||||
| text += " ] , [\n"; | text += " ] , [\n"; | ||||
| } | } | ||||
| #if 0 // TODO | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // MIDI outputs | // MIDI outputs | ||||
| @@ -402,7 +408,6 @@ static void writePluginFile(const NativePluginDescriptor* const pluginDesc) | |||||
| else | else | ||||
| text += " ] , [\n"; | text += " ] , [\n"; | ||||
| } | } | ||||
| #endif | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Freewheel port | // Freewheel port | ||||
| @@ -416,7 +421,7 @@ static void writePluginFile(const NativePluginDescriptor* const pluginDesc) | |||||
| text += " lv2:minimum 0.0 ;\n"; | text += " lv2:minimum 0.0 ;\n"; | ||||
| text += " lv2:maximum 1.0 ;\n"; | text += " lv2:maximum 1.0 ;\n"; | ||||
| text += " lv2:designation <" LV2_CORE__freeWheeling "> ;\n"; | text += " lv2:designation <" LV2_CORE__freeWheeling "> ;\n"; | ||||
| text += " lv2:portProperty lv2:toggled ;\n"; | |||||
| text += " lv2:portProperty lv2:toggled, <" LV2_PORT_PROPS__notOnGUI "> ;\n"; | |||||
| text += " ] ;\n"; | text += " ] ;\n"; | ||||
| text += "\n"; | text += "\n"; | ||||
| @@ -497,27 +502,20 @@ static void writePluginFile(const NativePluginDescriptor* const pluginDesc) | |||||
| text += " lv2:minimum " + String::formatted("%f", paramInfo->ranges.min) + " ;\n"; | text += " lv2:minimum " + String::formatted("%f", paramInfo->ranges.min) + " ;\n"; | ||||
| text += " lv2:maximum " + String::formatted("%f", paramInfo->ranges.max) + " ;\n"; | text += " lv2:maximum " + String::formatted("%f", paramInfo->ranges.max) + " ;\n"; | ||||
| if (paramInfo->hints & NATIVE_PARAMETER_IS_ENABLED) | |||||
| { | |||||
| if ((paramInfo->hints & NATIVE_PARAMETER_IS_AUTOMABLE) == 0) | |||||
| text += " lv2:portProperty <" LV2_PORT_PROPS__expensive "> ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_IS_BOOLEAN) | |||||
| text += " lv2:portProperty lv2:toggled ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_IS_INTEGER) | |||||
| text += " lv2:portProperty lv2:integer ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_IS_LOGARITHMIC) | |||||
| text += " lv2:portProperty <" LV2_PORT_PROPS__logarithmic "> ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_USES_SAMPLE_RATE) | |||||
| text += " lv2:portProperty lv2:toggled ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_USES_SCALEPOINTS) | |||||
| text += " lv2:portProperty lv2:enumeration ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_USES_CUSTOM_TEXT) | |||||
| pass(); // TODO: custom lv2 extension for this | |||||
| } | |||||
| else | |||||
| { | |||||
| if ((paramInfo->hints & NATIVE_PARAMETER_IS_AUTOMABLE) == 0) | |||||
| text += " lv2:portProperty <" LV2_PORT_PROPS__expensive "> ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_IS_BOOLEAN) | |||||
| text += " lv2:portProperty lv2:toggled ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_IS_INTEGER) | |||||
| text += " lv2:portProperty lv2:integer ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_IS_LOGARITHMIC) | |||||
| text += " lv2:portProperty <" LV2_PORT_PROPS__logarithmic "> ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_USES_SAMPLE_RATE) | |||||
| text += " lv2:portProperty lv2:toggled ;\n"; | |||||
| if (paramInfo->hints & NATIVE_PARAMETER_USES_SCALEPOINTS) | |||||
| text += " lv2:portProperty lv2:enumeration ;\n"; | |||||
| if ((paramInfo->hints & NATIVE_PARAMETER_IS_ENABLED) == 0) | |||||
| text += " lv2:portProperty <" LV2_PORT_PROPS__notOnGUI "> ;\n"; | text += " lv2:portProperty <" LV2_PORT_PROPS__notOnGUI "> ;\n"; | ||||
| } | |||||
| for (uint32_t j=0; j < paramInfo->scalePointCount; ++j) | for (uint32_t j=0; j < paramInfo->scalePointCount; ++j) | ||||
| { | { | ||||
| @@ -171,9 +171,7 @@ public: | |||||
| else if (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME) | else if (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME) | ||||
| fUI.portOffset += 1; | fUI.portOffset += 1; | ||||
| #if 0 // TODO | |||||
| fUI.portOffset += desc->midiOuts; | fUI.portOffset += desc->midiOuts; | ||||
| #endif | |||||
| fUI.portOffset += 1; // freewheel | fUI.portOffset += 1; // freewheel | ||||
| fUI.portOffset += desc->audioIns; | fUI.portOffset += desc->audioIns; | ||||
| fUI.portOffset += desc->audioOuts; | fUI.portOffset += desc->audioOuts; | ||||
| @@ -265,60 +263,43 @@ public: | |||||
| for (uint32_t i=0; i < fPorts.paramCount; ++i) | for (uint32_t i=0; i < fPorts.paramCount; ++i) | ||||
| { | { | ||||
| if (fPorts.paramsOut[i]) | |||||
| continue; | |||||
| CARLA_SAFE_ASSERT_CONTINUE(fPorts.paramsPtr[i] != nullptr) | CARLA_SAFE_ASSERT_CONTINUE(fPorts.paramsPtr[i] != nullptr) | ||||
| curValue = *fPorts.paramsPtr[i]; | curValue = *fPorts.paramsPtr[i]; | ||||
| if ((! carla_compareFloats(fPorts.paramsLast[i], curValue)) && (fDescriptor->get_parameter_info(fHandle, i)->hints & NATIVE_PARAMETER_IS_OUTPUT) == 0) | |||||
| { | |||||
| fPorts.paramsLast[i] = curValue; | |||||
| fDescriptor->set_parameter_value(fHandle, i, curValue); | |||||
| } | |||||
| if (carla_compareFloats(fPorts.paramsLast[i], curValue)) | |||||
| continue; | |||||
| fPorts.paramsLast[i] = curValue; | |||||
| fDescriptor->set_parameter_value(fHandle, i, curValue); | |||||
| } | } | ||||
| if (fDescriptor->midiIns > 0 || (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME) != 0) | |||||
| if (fDescriptor->midiIns > 0 || fDescriptor->midiOuts > 0 || (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME) != 0) | |||||
| { | { | ||||
| fMidiEventCount = 0; | fMidiEventCount = 0; | ||||
| carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2); | carla_zeroStruct<NativeMidiEvent>(fMidiEvents, kMaxMidiEvents*2); | ||||
| LV2_ATOM_SEQUENCE_FOREACH(fPorts.eventsIn[0], iter) | |||||
| if (fDescriptor->hints & NATIVE_PLUGIN_USES_TIME) | |||||
| { | { | ||||
| const LV2_Atom_Event* const event((const LV2_Atom_Event*)iter); | |||||
| if (event == nullptr) | |||||
| continue; | |||||
| if (event->body.type == fURIs.midiEvent) | |||||
| LV2_ATOM_SEQUENCE_FOREACH(fPorts.eventsIn[0], iter) | |||||
| { | { | ||||
| if (event->body.size > 4) | |||||
| continue; | |||||
| if (event->time.frames >= frames) | |||||
| const LV2_Atom_Event* const event((const LV2_Atom_Event*)iter); | |||||
| if (event == nullptr) | |||||
| continue; | continue; | ||||
| if (fMidiEventCount >= kMaxMidiEvents*2) | |||||
| if (event->body.type != fURIs.atomBlank) | |||||
| continue; | continue; | ||||
| const uint8_t* const data((const uint8_t*)(event + 1)); | |||||
| fMidiEvents[fMidiEventCount].port = 0; | |||||
| fMidiEvents[fMidiEventCount].time = (uint32_t)event->time.frames; | |||||
| fMidiEvents[fMidiEventCount].size = (uint8_t)event->body.size; | |||||
| for (uint32_t i=0; i < event->body.size; ++i) | |||||
| fMidiEvents[fMidiEventCount].data[i] = data[i]; | |||||
| fMidiEventCount += 1; | |||||
| continue; | |||||
| } | |||||
| if (event->body.type == fURIs.atomBlank) | |||||
| { | |||||
| const LV2_Atom_Object* const obj((const LV2_Atom_Object*)&event->body); | const LV2_Atom_Object* const obj((const LV2_Atom_Object*)&event->body); | ||||
| if (obj->body.otype != fURIs.timePos) | if (obj->body.otype != fURIs.timePos) | ||||
| continue; | continue; | ||||
| LV2_Atom* bar = nullptr; | |||||
| LV2_Atom* barBeat = nullptr; | |||||
| LV2_Atom* bar = nullptr; | |||||
| LV2_Atom* barBeat = nullptr; | |||||
| LV2_Atom* beat = nullptr; | LV2_Atom* beat = nullptr; | ||||
| LV2_Atom* beatUnit = nullptr; | LV2_Atom* beatUnit = nullptr; | ||||
| LV2_Atom* beatsPerBar = nullptr; | LV2_Atom* beatsPerBar = nullptr; | ||||
| @@ -455,11 +436,10 @@ public: | |||||
| } | } | ||||
| fTimeInfo.bbt.valid = (beatsPerMinute != nullptr && beatsPerBar != nullptr && beatUnit != nullptr); | fTimeInfo.bbt.valid = (beatsPerMinute != nullptr && beatsPerBar != nullptr && beatUnit != nullptr); | ||||
| continue; | |||||
| } | } | ||||
| } | } | ||||
| for (uint32_t i=1; i < fDescriptor->midiIns; ++i) | |||||
| for (uint32_t i=0; i < fDescriptor->midiIns; ++i) | |||||
| { | { | ||||
| LV2_ATOM_SEQUENCE_FOREACH(fPorts.eventsIn[i], iter) | LV2_ATOM_SEQUENCE_FOREACH(fPorts.eventsIn[i], iter) | ||||
| { | { | ||||
| @@ -478,20 +458,22 @@ public: | |||||
| const uint8_t* const data((const uint8_t*)(event + 1)); | const uint8_t* const data((const uint8_t*)(event + 1)); | ||||
| fMidiEvents[fMidiEventCount].port = (uint8_t)i; | |||||
| fMidiEvents[fMidiEventCount].size = (uint8_t)event->body.size; | |||||
| fMidiEvents[fMidiEventCount].time = (uint32_t)event->time.frames; | |||||
| NativeMidiEvent& nativeEvent(fMidiEvents[fMidiEventCount++]); | |||||
| carla_zeroStruct(nativeEvent); | |||||
| for (uint32_t j=0; j < event->body.size; ++j) | |||||
| fMidiEvents[fMidiEventCount].data[j] = data[j]; | |||||
| nativeEvent.port = (uint8_t)i; | |||||
| nativeEvent.size = (uint8_t)event->body.size; | |||||
| nativeEvent.time = (uint32_t)event->time.frames; | |||||
| fMidiEventCount += 1; | |||||
| for (uint32_t j=0; j < event->body.size; ++j) | |||||
| nativeEvent.data[j] = data[j]; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| fIsProcessing = true; | fIsProcessing = true; | ||||
| fDescriptor->process(fHandle, fPorts.audioIns, fPorts.audioOuts, frames, fMidiEvents, fMidiEventCount); | |||||
| // FIXME | |||||
| fDescriptor->process(fHandle, const_cast<float**>(fPorts.audioIns), fPorts.audioOuts, frames, fMidiEvents, fMidiEventCount); | |||||
| fIsProcessing = false; | fIsProcessing = false; | ||||
| // update timePos for next callback | // update timePos for next callback | ||||
| @@ -529,9 +511,61 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| // TODO - midi out | |||||
| updateParameterOutputs(); | updateParameterOutputs(); | ||||
| if (fDescriptor->midiOuts > 0) | |||||
| { | |||||
| uint32_t capacities[fDescriptor->midiOuts]; | |||||
| uint32_t offsets [fDescriptor->midiOuts]; | |||||
| for (uint32_t i=0, size=fDescriptor->midiOuts; i<size; ++i) | |||||
| { | |||||
| LV2_Atom_Sequence* const seq(fPorts.midiOuts[i]); | |||||
| CARLA_SAFE_ASSERT_CONTINUE(seq != nullptr); | |||||
| capacities[i] = seq->atom.size; | |||||
| offsets [i] = 0; | |||||
| } | |||||
| LV2_Atom_Event* aev; | |||||
| uint32_t size; | |||||
| // reverse lookup MIDI events | |||||
| for (uint32_t i = (kMaxMidiEvents*2)-1; i >= fMidiEventCount; --i) | |||||
| { | |||||
| if (fMidiEvents[i].data[0] == 0) | |||||
| break; | |||||
| NativeMidiEvent& nativeEvent(fMidiEvents[i]); | |||||
| const uint8_t port(nativeEvent.port); | |||||
| CARLA_SAFE_ASSERT_CONTINUE(nativeEvent.port < fDescriptor->midiOuts); | |||||
| LV2_Atom_Sequence* const seq(fPorts.midiOuts[port]); | |||||
| CARLA_SAFE_ASSERT_CONTINUE(seq != nullptr); | |||||
| if (sizeof(LV2_Atom_Event) + nativeEvent.size > capacities[port] - offsets[port]) | |||||
| continue; | |||||
| if (offsets[port] == 0) | |||||
| { | |||||
| seq->atom.size = 0; | |||||
| seq->atom.type = fURIs.atomSequence; | |||||
| seq->body.unit = 0; | |||||
| seq->body.pad = 0; | |||||
| } | |||||
| aev = (LV2_Atom_Event*)(LV2_ATOM_CONTENTS(LV2_Atom_Sequence, seq) + offsets[port]); | |||||
| aev->time.frames = nativeEvent.time; | |||||
| aev->body.size = nativeEvent.size; | |||||
| aev->body.type = fURIs.midiEvent; | |||||
| std::memcpy(LV2_ATOM_BODY(&aev->body), nativeEvent.data, nativeEvent.size); | |||||
| size = lv2_atom_pad_size(sizeof(LV2_Atom_Event) + nativeEvent.size); | |||||
| offsets[port] += size; | |||||
| seq->atom.size += size; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -878,13 +912,14 @@ protected: | |||||
| // reverse-find first free event, and put it there | // reverse-find first free event, and put it there | ||||
| for (uint32_t i=(kMaxMidiEvents*2)-1; i > fMidiEventCount; --i) | for (uint32_t i=(kMaxMidiEvents*2)-1; i > fMidiEventCount; --i) | ||||
| { | { | ||||
| if (fMidiEvents[i].data[0] == 0) | |||||
| { | |||||
| std::memcpy(&fMidiEvents[i], event, sizeof(NativeMidiEvent)); | |||||
| return true; | |||||
| } | |||||
| if (fMidiEvents[i].data[0] != 0) | |||||
| continue; | |||||
| std::memcpy(&fMidiEvents[i], event, sizeof(NativeMidiEvent)); | |||||
| return true; | |||||
| } | } | ||||
| carla_stdout("NativePlugin::handleWriteMidiEvent(%p) - buffer full", event); | |||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -1070,14 +1105,15 @@ private: | |||||
| } fUI; | } fUI; | ||||
| struct Ports { | struct Ports { | ||||
| LV2_Atom_Sequence** eventsIn; | |||||
| LV2_Atom_Sequence** midiOuts; | |||||
| float** audioIns; | |||||
| float** audioOuts; | |||||
| const LV2_Atom_Sequence** eventsIn; | |||||
| /* */ LV2_Atom_Sequence** midiOuts; | |||||
| const float** audioIns; | |||||
| /* */ float** audioOuts; | |||||
| float* freewheel; | float* freewheel; | ||||
| uint32_t paramCount; | uint32_t paramCount; | ||||
| float* paramsLast; | float* paramsLast; | ||||
| float** paramsPtr; | float** paramsPtr; | ||||
| bool* paramsOut; | |||||
| Ports() | Ports() | ||||
| : eventsIn(nullptr), | : eventsIn(nullptr), | ||||
| @@ -1087,7 +1123,8 @@ private: | |||||
| freewheel(nullptr), | freewheel(nullptr), | ||||
| paramCount(0), | paramCount(0), | ||||
| paramsLast(nullptr), | paramsLast(nullptr), | ||||
| paramsPtr(nullptr) {} | |||||
| paramsPtr(nullptr), | |||||
| paramsOut(nullptr) {} | |||||
| ~Ports() | ~Ports() | ||||
| { | { | ||||
| @@ -1126,6 +1163,12 @@ private: | |||||
| delete[] paramsPtr; | delete[] paramsPtr; | ||||
| paramsPtr = nullptr; | paramsPtr = nullptr; | ||||
| } | } | ||||
| if (paramsOut != nullptr) | |||||
| { | |||||
| delete[] paramsOut; | |||||
| paramsOut = nullptr; | |||||
| } | |||||
| } | } | ||||
| void init(const NativePluginDescriptor* const desc, NativePluginHandle handle) | void init(const NativePluginDescriptor* const desc, NativePluginHandle handle) | ||||
| @@ -1134,14 +1177,14 @@ private: | |||||
| if (desc->midiIns > 0) | if (desc->midiIns > 0) | ||||
| { | { | ||||
| eventsIn = new LV2_Atom_Sequence*[desc->midiIns]; | |||||
| eventsIn = new const LV2_Atom_Sequence*[desc->midiIns]; | |||||
| for (uint32_t i=0; i < desc->midiIns; ++i) | for (uint32_t i=0; i < desc->midiIns; ++i) | ||||
| eventsIn[i] = nullptr; | eventsIn[i] = nullptr; | ||||
| } | } | ||||
| else if (desc->hints & NATIVE_PLUGIN_USES_TIME) | else if (desc->hints & NATIVE_PLUGIN_USES_TIME) | ||||
| { | { | ||||
| eventsIn = new LV2_Atom_Sequence*[1]; | |||||
| eventsIn = new const LV2_Atom_Sequence*[1]; | |||||
| eventsIn[0] = nullptr; | eventsIn[0] = nullptr; | ||||
| } | } | ||||
| @@ -1155,7 +1198,7 @@ private: | |||||
| if (desc->audioIns > 0) | if (desc->audioIns > 0) | ||||
| { | { | ||||
| audioIns = new float*[desc->audioIns]; | |||||
| audioIns = new const float*[desc->audioIns]; | |||||
| for (uint32_t i=0; i < desc->audioIns; ++i) | for (uint32_t i=0; i < desc->audioIns; ++i) | ||||
| audioIns[i] = nullptr; | audioIns[i] = nullptr; | ||||
| @@ -1177,11 +1220,13 @@ private: | |||||
| { | { | ||||
| paramsLast = new float[paramCount]; | paramsLast = new float[paramCount]; | ||||
| paramsPtr = new float*[paramCount]; | paramsPtr = new float*[paramCount]; | ||||
| paramsOut = new bool[paramCount]; | |||||
| for (uint32_t i=0; i < paramCount; ++i) | for (uint32_t i=0; i < paramCount; ++i) | ||||
| { | { | ||||
| paramsLast[i] = desc->get_parameter_value(handle, i); | paramsLast[i] = desc->get_parameter_value(handle, i); | ||||
| paramsPtr[i] = nullptr; | |||||
| paramsPtr [i] = nullptr; | |||||
| paramsOut [i] = (desc->get_parameter_info(handle, i)->hints & NATIVE_PARAMETER_IS_OUTPUT); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -1209,7 +1254,6 @@ private: | |||||
| } | } | ||||
| } | } | ||||
| #if 0 // TODO | |||||
| for (uint32_t i=0; i < desc->midiOuts; ++i) | for (uint32_t i=0; i < desc->midiOuts; ++i) | ||||
| { | { | ||||
| if (port == index++) | if (port == index++) | ||||
| @@ -1218,7 +1262,6 @@ private: | |||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| #endif | |||||
| if (port == index++) | if (port == index++) | ||||
| { | { | ||||
| @@ -438,6 +438,7 @@ public: | |||||
| fMidiOutEvents.numEvents = 0; | fMidiOutEvents.numEvents = 0; | ||||
| if (fHandle != nullptr) | if (fHandle != nullptr) | ||||
| // FIXME | |||||
| fDescriptor->process(fHandle, const_cast<float**>(inputs), outputs, static_cast<uint32_t>(sampleFrames), fMidiEvents, fMidiEventCount); | fDescriptor->process(fHandle, const_cast<float**>(inputs), outputs, static_cast<uint32_t>(sampleFrames), fMidiEvents, fMidiEventCount); | ||||
| fMidiEventCount = 0; | fMidiEventCount = 0; | ||||