Browse Source

Fixup carla-patchbay/graph to work with variable buffer sizes

tags/v1.9.9
falkTX 7 years ago
parent
commit
51c6bc346a
6 changed files with 16 additions and 22 deletions
  1. +4
    -1
      source/backend/engine/CarlaEngineGraph.cpp
  2. +0
    -6
      source/backend/engine/CarlaEngineNative.cpp
  3. +2
    -2
      source/backend/plugin/CarlaPluginNative.cpp
  4. +6
    -6
      source/modules/water/buffers/AudioSampleBuffer.h
  5. +4
    -6
      source/modules/water/processors/AudioProcessorGraph.cpp
  6. +0
    -1
      source/modules/water/processors/AudioProcessorGraph.h

+ 4
- 1
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -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<int>(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<count; ++i)


+ 0
- 6
source/backend/engine/CarlaEngineNative.cpp View File

@@ -2022,7 +2022,6 @@ static const NativePluginDescriptor carlaRackDesc = {
/* category */ NATIVE_PLUGIN_CATEGORY_OTHER,
/* hints */ static_cast<NativePluginHints>(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<NativePluginHints>(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<NativePluginHints>(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<NativePluginHints>(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<NativePluginHints>(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<NativePluginHints>(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),


+ 2
- 2
source/backend/plugin/CarlaPluginNative.cpp View File

@@ -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;


+ 6
- 6
source/modules/water/buffers/AudioSampleBuffer.h View File

@@ -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),


+ 4
- 6
source/modules/water/processors/AudioProcessorGraph.cpp View File

@@ -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:


+ 0
- 1
source/modules/water/processors/AudioProcessorGraph.h View File

@@ -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;


Loading…
Cancel
Save