From 004966d15495a45e839dad2dc6f10f6b286bc289 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 16 Jul 2011 09:03:23 +0100 Subject: [PATCH] Basic LV2 activate and deactivate --- .../audio/plugin_client/LV2/juce_LV2_Wrapper.cpp | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp b/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp index 07f7c73..d75ff8f 100644 --- a/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp +++ b/juce/source/src/audio/plugin_client/LV2/juce_LV2_Wrapper.cpp @@ -65,10 +65,13 @@ public: printf("JuceLV2Wrapper()\n"); filter = createPluginFilter(); + filter->setPlayConfigDetails(JucePlugin_MaxNumInputChannels, JucePlugin_MaxNumOutputChannels, 0, 0); + descriptor = _descriptor; //features = _features; sample_rate = _sample_rate; + buffer_size = 512; port_count = 0; #if JucePlugin_WantsMidiInput @@ -158,6 +161,21 @@ public: void do_activate() { + if (filter != nullptr) { + filter->setNonRealtime(false); + filter->setPlayConfigDetails(JucePlugin_MaxNumInputChannels, JucePlugin_MaxNumOutputChannels, sample_rate, buffer_size); + filter->prepareToPlay(sample_rate, buffer_size); + +#if JucePlugin_WantsMidiInput || JucePlugin_ProducesMidiOutput + midi_buffer.ensureSize(2048); + midi_buffer.clear(); +#endif + +#if JucePlugin_ProducesMidiOutput + //outgoingEvents.ensureSize (512); +#endif + + } #if 0 wrapper->filter->setNonRealtime(false); wrapper->filter->setPlayConfigDetails(JucePlugin_MaxNumInputChannels, JucePlugin_MaxNumOutputChannels, wrapper->sample_rate, block_size); @@ -202,10 +220,11 @@ public: void do_deactivate() { -#if 0 - wrapper->filter->releaseResources(); - wrapper->midi_buffer.clear(); -#endif + if (filter != nullptr) + { + filter->releaseResources(); + //outgoingEvents.freeEvents(); + } } private: @@ -213,6 +232,7 @@ private: const LV2_Descriptor* descriptor; double sample_rate; + int buffer_size; uint32_t port_count; #if JucePlugin_WantsMidiInput -- 2.11.4.GIT