Browse Source

Carla: VST fixing, only call effMainsChanged on init and close

tags/v0.9.0
falkTX 12 years ago
parent
commit
dbcbd584c1
1 changed files with 19 additions and 39 deletions
  1. +19
    -39
      c++/carla-backend/vst.cpp

+ 19
- 39
c++/carla-backend/vst.cpp View File

@@ -111,11 +111,9 @@ public:
}

if (m_activeBefore)
{
effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
}

effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f);
}
}
@@ -1016,9 +1014,6 @@ public:
sendMidiAllNotesOff();

effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);

effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);

postponeEvent(PluginPostEventParameterChange, PARAMETER_ACTIVE, 0, 0.0);
@@ -1194,7 +1189,6 @@ public:
midiEventCount = MAX_MIDI_CHANNELS*2;
}

effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);
}

@@ -1231,10 +1225,7 @@ public:
else
{
if (m_activeBefore)
{
effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
}
}

CARLA_PROCESS_CONTINUE_CHECK;
@@ -1356,10 +1347,7 @@ public:
void bufferSizeChanged(uint32_t newBufferSize)
{
if (m_active)
{
effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
}

#if ! VST_FORCE_DEPRECATED
effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, newBufferSize, nullptr, x_engine->getSampleRate());
@@ -1367,10 +1355,7 @@ public:
effect->dispatcher(effect, effSetBlockSize, 0, newBufferSize, nullptr, 0.0f);

if (m_active)
{
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);
}
}

// -------------------------------------------------------------------
@@ -1468,9 +1453,8 @@ public:
return x_engine->getSampleRate();
}

const VstTimeInfo_R* handleAudioMasterGetTime()
intptr_t handleAudioMasterGetTime()
{
static VstTimeInfo_R vstTimeInfo;
memset(&vstTimeInfo, 0, sizeof(VstTimeInfo_R));

const CarlaTimeInfo* const timeInfo = x_engine->getTimeInfo();
@@ -1521,7 +1505,7 @@ public:
vstTimeInfo.flags |= kVstTimeSigValid;
}

return &vstTimeInfo;
return (intptr_t)&vstTimeInfo;
}

intptr_t handleAudioMasterTempoAt()
@@ -1557,18 +1541,12 @@ public:
engineProcessUnlock();

if (m_active)
{
effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
}

reload();

if (m_active)
{
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);
}

x_engine->callback(CALLBACK_RELOAD_ALL, m_id, 0, 0, 0.0);

@@ -1577,6 +1555,7 @@ public:

void handleAudioMasterNeedIdle()
{
qDebug("VstPlugin::handleAudioMasterNeedIdle()");
needIdle = true;
}

@@ -1594,7 +1573,7 @@ public:

if (! isProcessing)
{
qCritical("VstPlugin:handleAudioMasterProcessEvents(%p) - received MIDI out events outside audio thread, ignoring", vstEvents);
qCritical("VstPlugin::handleAudioMasterProcessEvents(%p) - received MIDI out events outside audio thread, ignoring", vstEvents);
return 0;
}

@@ -1841,26 +1820,24 @@ public:
CARLA_ASSERT(self);
if (self)
{
ret = (intptr_t)self->handleAudioMasterGetTime();
ret = self->handleAudioMasterGetTime();
}
else
{
qWarning("VstPlugin::hostCallback::audioMasterGetTime called without valid object");

static VstTimeInfo_R timeInfo;
memset(&timeInfo, 0, sizeof(VstTimeInfo_R));
timeInfo.sampleRate = 44100.0;
static VstTimeInfo_R vstTimeInfo;
memset(&vstTimeInfo, 0, sizeof(VstTimeInfo_R));
vstTimeInfo.sampleRate = 44100.0;

// Tempo
timeInfo.tempo = 120.0;
timeInfo.flags |= kVstTempoValid;
vstTimeInfo.tempo = 120.0;
vstTimeInfo.flags |= kVstTempoValid;

// Time Signature
timeInfo.timeSigNumerator = 4;
timeInfo.timeSigDenominator = 4;
timeInfo.flags |= kVstTimeSigValid;
vstTimeInfo.timeSigNumerator = 4;
vstTimeInfo.timeSigDenominator = 4;
vstTimeInfo.flags |= kVstTimeSigValid;

ret = (intptr_t)&timeInfo;
ret = (intptr_t)&vstTimeInfo;
}
break;

@@ -2206,6 +2183,8 @@ public:
#endif

effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);

#if ! VST_FORCE_DEPRECATED
effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, x_engine->getBufferSize(), nullptr, x_engine->getSampleRate());
#endif
@@ -2286,7 +2265,8 @@ private:
intptr_t reserved;
VstEvent* data[MAX_MIDI_EVENTS*2];
} events;
VstMidiEvent midiEvents[MAX_MIDI_EVENTS*2];
VstMidiEvent midiEvents[MAX_MIDI_EVENTS*2];
VstTimeInfo_R vstTimeInfo;

struct {
GuiType type;


Loading…
Cancel
Save