diff --git a/source/backend/engine/CarlaEngineGraph.cpp b/source/backend/engine/CarlaEngineGraph.cpp index 0027800ab..f2989aa15 100644 --- a/source/backend/engine/CarlaEngineGraph.cpp +++ b/source/backend/engine/CarlaEngineGraph.cpp @@ -1812,12 +1812,15 @@ void PatchbayGraph::process(CarlaEngine::ProtectedData* const data, const float* fillWaterMidiBufferFromEngineEvents(midiBuffer, data->events.in); } + // set audio size, needed for water internals + audioBuffer.setSize(audioBuffer.getNumChannels(), frames, false, false, true); + // put carla audio in water buffer { int i=0; for (; i < static_cast(inputs); ++i) - carla_copyFloats(audioBuffer.getWritePointer(i), inBuf[i], frames); + audioBuffer.copyFrom(i, 0, inBuf[i], frames); // clear remaining channels for (const int count=audioBuffer.getNumChannels(); i(NATIVE_PLUGIN_IS_SYNTH |NATIVE_PLUGIN_HAS_UI - //|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD |NATIVE_PLUGIN_USES_STATE |NATIVE_PLUGIN_USES_TIME), @@ -2064,7 +2063,6 @@ static const NativePluginDescriptor carlaRackNoMidiOutDesc = { /* category */ NATIVE_PLUGIN_CATEGORY_OTHER, /* hints */ static_cast(NATIVE_PLUGIN_IS_SYNTH |NATIVE_PLUGIN_HAS_UI - //|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD |NATIVE_PLUGIN_USES_STATE |NATIVE_PLUGIN_USES_TIME), @@ -2106,7 +2104,6 @@ static const NativePluginDescriptor carlaPatchbayDesc = { /* category */ NATIVE_PLUGIN_CATEGORY_OTHER, /* hints */ static_cast(NATIVE_PLUGIN_IS_SYNTH |NATIVE_PLUGIN_HAS_UI - //|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD |NATIVE_PLUGIN_USES_STATE |NATIVE_PLUGIN_USES_TIME), @@ -2148,7 +2145,6 @@ static const NativePluginDescriptor carlaPatchbay3sDesc = { /* category */ NATIVE_PLUGIN_CATEGORY_OTHER, /* hints */ static_cast(NATIVE_PLUGIN_IS_SYNTH |NATIVE_PLUGIN_HAS_UI - //|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD |NATIVE_PLUGIN_USES_STATE |NATIVE_PLUGIN_USES_TIME), @@ -2190,7 +2186,6 @@ static const NativePluginDescriptor carlaPatchbay16Desc = { /* category */ NATIVE_PLUGIN_CATEGORY_OTHER, /* hints */ static_cast(NATIVE_PLUGIN_IS_SYNTH |NATIVE_PLUGIN_HAS_UI - //|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD |NATIVE_PLUGIN_USES_STATE |NATIVE_PLUGIN_USES_TIME), @@ -2232,7 +2227,6 @@ static const NativePluginDescriptor carlaPatchbay32Desc = { /* category */ NATIVE_PLUGIN_CATEGORY_OTHER, /* hints */ static_cast(NATIVE_PLUGIN_IS_SYNTH |NATIVE_PLUGIN_HAS_UI - //|NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS |NATIVE_PLUGIN_NEEDS_UI_MAIN_THREAD |NATIVE_PLUGIN_USES_STATE |NATIVE_PLUGIN_USES_TIME), diff --git a/source/backend/plugin/CarlaPluginNative.cpp b/source/backend/plugin/CarlaPluginNative.cpp index 20f71690b..de1d8b14d 100644 --- a/source/backend/plugin/CarlaPluginNative.cpp +++ b/source/backend/plugin/CarlaPluginNative.cpp @@ -346,7 +346,7 @@ public: uint options = 0x0; // can't disable fixed buffers if using MIDI output - if (fMidiOut.count == 0 && (fDescriptor->hints & NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS) == 0) + if (fDescriptor->midiOuts == 0 && (fDescriptor->hints & NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS) == 0) options |= PLUGIN_OPTION_FIXED_BUFFERS; // can't disable forced stereo if enabled in the engine @@ -2453,7 +2453,7 @@ public: pData->options = 0x0; - if (fMidiOut.count != 0 || (fDescriptor->hints & NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS) != 0) + if (fDescriptor->midiOuts != 0 || (fDescriptor->hints & NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS) != 0) pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; else if (options & PLUGIN_OPTION_FIXED_BUFFERS) pData->options |= PLUGIN_OPTION_FIXED_BUFFERS; diff --git a/source/modules/water/buffers/AudioSampleBuffer.h b/source/modules/water/buffers/AudioSampleBuffer.h index 1a3b34294..95613e5b0 100644 --- a/source/modules/water/buffers/AudioSampleBuffer.h +++ b/source/modules/water/buffers/AudioSampleBuffer.h @@ -61,7 +61,7 @@ public: throw a std::bad_alloc exception. */ AudioSampleBuffer (int numChannelsToAllocate, - int numSamplesToAllocate) noexcept + int numSamplesToAllocate) noexcept : numChannels (numChannelsToAllocate), size (numSamplesToAllocate) { @@ -87,8 +87,8 @@ public: size of the arrays passed in */ AudioSampleBuffer (float* const* dataToReferTo, - int numChannelsToUse, - int numSamples) noexcept + int numChannelsToUse, + int numSamples) noexcept : numChannels (numChannelsToUse), size (numSamples), allocatedBytes (0) @@ -116,9 +116,9 @@ public: size of the arrays passed in */ AudioSampleBuffer (float* const* dataToReferTo, - int numChannelsToUse, - int startSample, - int numSamples) noexcept + int numChannelsToUse, + int startSample, + int numSamples) noexcept : numChannels (numChannelsToUse), size (numSamples), allocatedBytes (0), diff --git a/source/modules/water/processors/AudioProcessorGraph.cpp b/source/modules/water/processors/AudioProcessorGraph.cpp index b54687c05..4e1a933a9 100644 --- a/source/modules/water/processors/AudioProcessorGraph.cpp +++ b/source/modules/water/processors/AudioProcessorGraph.cpp @@ -920,9 +920,7 @@ void AudioProcessorGraph::Node::setParentGraph (AudioProcessorGraph* const graph struct AudioProcessorGraph::AudioProcessorGraphBufferHelpers { AudioProcessorGraphBufferHelpers() - { - currentAudioInputBuffer = nullptr; - } + : currentAudioInputBuffer (nullptr) {} void setRenderingBufferSize (int newNumChannels, int newNumSamples) { @@ -1345,7 +1343,7 @@ void AudioProcessorGraph::processAudio (AudioSampleBuffer& buffer, MidiBuffer& m const int numSamples = buffer.getNumSamples(); currentAudioInputBuffer = &buffer; - currentAudioOutputBuffer.setSize (jmax (1, buffer.getNumChannels()), numSamples); + currentAudioOutputBuffer.setSize (jmax (1, buffer.getNumChannels()), numSamples, false, false, true); currentAudioOutputBuffer.clear(); currentMidiInputBuffer = &midiMessages; currentMidiOutputBuffer.clear(); @@ -1418,14 +1416,14 @@ void AudioProcessorGraph::AudioGraphIOProcessor::releaseResources() void AudioProcessorGraph::AudioGraphIOProcessor::processAudio (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) { + CARLA_SAFE_ASSERT_RETURN(graph != nullptr,); + AudioSampleBuffer*& currentAudioInputBuffer = graph->audioBuffers->currentAudioInputBuffer; AudioSampleBuffer& currentAudioOutputBuffer = graph->audioBuffers->currentAudioOutputBuffer; - jassert (graph != nullptr); - switch (type) { case audioOutputNode: diff --git a/source/modules/water/processors/AudioProcessorGraph.h b/source/modules/water/processors/AudioProcessorGraph.h index d6ade734e..2afd868f8 100644 --- a/source/modules/water/processors/AudioProcessorGraph.h +++ b/source/modules/water/processors/AudioProcessorGraph.h @@ -340,7 +340,6 @@ public: void reset() override; void setNonRealtime (bool) noexcept override; -// void setPlayHead (AudioPlayHead*) override; bool acceptsMidi() const override; bool producesMidi() const override;