Browse Source

Fix vst plugin for some hosts (ardour3 and energyXT on linux)

gh-pages
falkTX 9 years ago
parent
commit
793c580f8d
2 changed files with 22 additions and 2 deletions
  1. +12
    -0
      distrho/src/DistrhoPluginInternal.hpp
  2. +10
    -2
      distrho/src/DistrhoPluginVST.cpp

+ 12
- 0
distrho/src/DistrhoPluginInternal.hpp View File

@@ -377,6 +377,18 @@ public:

// -------------------------------------------------------------------

uint32_t getBufferSize() const noexcept
{
DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr, 0);
return fData->bufferSize;
}

double getSampleRate() const noexcept
{
DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr, 0.0);
return fData->sampleRate;
}

void setBufferSize(const uint32_t bufferSize, bool doCallback = false)
{
DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr,);


+ 10
- 2
distrho/src/DistrhoPluginVST.cpp View File

@@ -404,7 +404,8 @@ public:
}
else
{
d_lastUiSampleRate = fAudioMaster(fEffect, audioMasterGetSampleRate, 0, 0, nullptr, 0.0f);
d_lastUiSampleRate = fPlugin.getSampleRate();

UIExporter tmpUI(nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr);
fVstRect.right = tmpUI.getWidth();
fVstRect.bottom = tmpUI.getHeight();
@@ -421,7 +422,7 @@ public:
return 0;
# endif

d_lastUiSampleRate = fAudioMaster(fEffect, audioMasterGetSampleRate, 0, 0, nullptr, 0.0f);
d_lastUiSampleRate = fPlugin.getSampleRate();

fVstUi = new UIVst(fAudioMaster, fEffect, this, &fPlugin, (intptr_t)ptr);

@@ -823,6 +824,13 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t
#endif
d_lastBufferSize = audioMaster(effect, audioMasterGetBlockSize, 0, 0, nullptr, 0.0f);
d_lastSampleRate = audioMaster(effect, audioMasterGetSampleRate, 0, 0, nullptr, 0.0f);

// some hosts are not ready at this point or return 0 buffersize/samplerate
if (d_lastBufferSize == 0)
d_lastBufferSize = 2048;
if (d_lastSampleRate <= 0.0)
d_lastSampleRate = 44100.0;

PluginVst* const plugin(new PluginVst(audioMaster, effect));
#ifdef VESTIGE_HEADER
effect->ptr2 = plugin;


Loading…
Cancel
Save