Browse Source

Add buffer-size options to standalone, another build fix

Signed-off-by: falkTX <falktx@falktx.com>
tags/v1.3
falkTX 2 years ago
parent
commit
f374ab74df
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 72 additions and 16 deletions
  1. +1
    -1
      dpf
  2. +25
    -15
      plugins/Common/IldaeilPlugin.cpp
  3. +46
    -0
      plugins/Common/IldaeilUI.cpp

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 49d447b4369e0ed97b6a86cddf1843fc9130105c
Subproject commit a0963ec1555484e2b34ac07bf3815e56136a41fa

+ 25
- 15
plugins/Common/IldaeilPlugin.cpp View File

@@ -81,12 +81,14 @@ const char* IldaeilBasePlugin::getPathForJSFX()
class IldaeilPlugin : public IldaeilBasePlugin
{
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
static constexpr const uint kMaxMidiEventCount = 512;
NativeMidiEvent* fMidiEvents;
#if DISTRHO_PLUGIN_NUM_INPUTS == 0 || DISTRHO_PLUGIN_NUM_OUTPUTS == 0
float* fDummyBuffer;
float* fDummyBuffers[2];
#endif
#endif
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
static constexpr const uint kMaxMidiEventCount = 512;
NativeMidiEvent* fMidiEvents;
#endif
mutable NativeTimeInfo fCarlaTimeInfo;
mutable water::MemoryOutputStream fLastProjectState;
@@ -95,10 +97,12 @@ class IldaeilPlugin : public IldaeilBasePlugin
public:
IldaeilPlugin()
: IldaeilBasePlugin(),
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
fMidiEvents(nullptr),
#if DISTRHO_PLUGIN_NUM_INPUTS == 0 || DISTRHO_PLUGIN_NUM_OUTPUTS == 0
fDummyBuffer(nullptr),
#endif
#endif
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
fMidiEvents(nullptr),
#endif
fLastLatencyValue(0)
{
fCarlaPluginDescriptor = carla_get_native_rack_plugin();
@@ -165,11 +169,14 @@ public:
fCarlaPluginDescriptor->dispatcher(fCarlaPluginHandle, NATIVE_PLUGIN_OPCODE_HOST_USES_EMBED,
0, 0, nullptr, 0.0f);
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
fMidiEvents = new NativeMidiEvent[kMaxMidiEventCount];
#endif
#if DISTRHO_PLUGIN_NUM_INPUTS == 0 || DISTRHO_PLUGIN_NUM_OUTPUTS == 0
// create dummy buffers
bufferSizeChanged(getBufferSize());
#endif
#endif
}
~IldaeilPlugin() override
@@ -177,10 +184,12 @@ public:
if (fCarlaHostHandle != nullptr)
{
carla_host_handle_free(fCarlaHostHandle);
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
delete[] fMidiEvents;
#if DISTRHO_PLUGIN_NUM_INPUTS == 0 || DISTRHO_PLUGIN_NUM_OUTPUTS == 0
delete[] fDummyBuffer;
#endif
#endif
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
delete[] fMidiEvents;
#endif
}
if (fCarlaPluginHandle != nullptr)
@@ -438,7 +447,7 @@ protected:
#if DISTRHO_PLUGIN_NUM_INPUTS == 0
inputs = fDummyBuffers;
#endif
#if DISTRHO_PLUGIN_NUM_INPUTS == 0
#if DISTRHO_PLUGIN_NUM_OUTPUTS == 0
outputs = fDummyBuffers;
#endif
@@ -456,13 +465,14 @@ protected:
void bufferSizeChanged(const uint32_t newBufferSize) override
{
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
#if DISTRHO_PLUGIN_NUM_INPUTS == 0 || DISTRHO_PLUGIN_NUM_OUTPUTS == 0
delete[] fDummyBuffer;
fDummyBuffer = new float[newBufferSize];
fDummyBuffers[0] = fDummyBuffer;
fDummyBuffers[1] = fDummyBuffer;
std::memset(fDummyBuffer, 0, sizeof(float)*newBufferSize);
#endif
#endif
if (fCarlaPluginHandle != nullptr)
fCarlaPluginDescriptor->dispatcher(fCarlaPluginHandle, NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED,
0, newBufferSize, nullptr, 0.0f);


+ 46
- 0
plugins/Common/IldaeilUI.cpp View File

@@ -1085,6 +1085,52 @@ protected:
ImGui::SameLine();
if (supportsMIDI() && !isMIDIEnabled() && ImGui::Button("Enable MIDI"))
requestMIDI();

if (supportsBufferSizeChanges())
{
ImGui::SameLine();
ImGui::Spacing();

ImGui::SameLine();
ImGui::Text("Buffer Size:");

static constexpr uint bufferSizes_i[] = {
#ifndef DISTRHO_OS_WASM
128,
#endif
256, 512, 1024, 2048, 4096, 8192,
#ifdef DISTRHO_OS_WASM
16384,
#endif
};
static constexpr const char* bufferSizes_s[] = {
#ifndef DISTRHO_OS_WASM
"128",
#endif
"256", "512", "1024", "2048", "4096", "8192",
#ifdef DISTRHO_OS_WASM
"16384",
#endif
};
uint buffersize = getBufferSize();
int current = -1;
for (uint i=0; i<ARRAY_SIZE(bufferSizes_i); ++i)
{
if (bufferSizes_i[i] == buffersize)
{
current = i;
break;
}
}

ImGui::SameLine();
if (ImGui::Combo("##buffersize", &current, bufferSizes_s, ARRAY_SIZE(bufferSizes_s)))
{
const uint next = bufferSizes_i[current];
d_stdout("requesting new buffer size: %u -> %u", buffersize, next);
requestBufferSizeChange(next);
}
}
}
#endif
}


Loading…
Cancel
Save