Browse Source

Native plugins working again, misc fixes

tags/1.9.4
falkTX 12 years ago
parent
commit
b567aad0b5
8 changed files with 727 additions and 650 deletions
  1. +1
    -1
      source/backend/CarlaNative.h
  2. +2
    -2
      source/backend/engine/CarlaEngineRtAudio.cpp
  3. +4
    -2
      source/backend/plugin/CarlaPluginInternal.hpp
  4. +21
    -14
      source/backend/plugin/DssiPlugin.cpp
  5. +2
    -4
      source/backend/plugin/LadspaPlugin.cpp
  6. +1
    -1
      source/backend/plugin/Lv2Plugin.cpp
  7. +695
    -625
      source/backend/plugin/NativePlugin.cpp
  8. +1
    -1
      source/backend/plugin/VstPlugin.cpp

+ 1
- 1
source/backend/CarlaNative.h View File

@@ -98,7 +98,7 @@ typedef struct _Parameter {
} Parameter;

typedef struct _MidiEvent {
uint32_t port;
uint8_t port;
uint32_t time;
uint8_t data[3];
} MidiEvent;


+ 2
- 2
source/backend/engine/CarlaEngineRtAudio.cpp View File

@@ -270,7 +270,7 @@ protected:
{
for (unsigned int i=0; i < nframes*2; i++)
{
if (i % 2)
if (i % 2 == 0)
fAudioInBuf1[i/2] = insPtr[i];
else
fAudioInBuf2[i/2] = insPtr[i];
@@ -308,7 +308,7 @@ protected:
{
for (unsigned int i=0; i < nframes*2; i++)
{
if (i % 2)
if (i % 2 == 0)
outsPtr[i] = fAudioOutBuf1[i/2];
else
outsPtr[i] = fAudioOutBuf2[i/2];


+ 4
- 2
source/backend/plugin/CarlaPluginInternal.hpp View File

@@ -247,10 +247,12 @@ struct PluginProgramData {
CARLA_ASSERT(names == nullptr);

if (names == nullptr)
{
names = new ProgramName[count];

for (uint32_t i=0; i < count; i++)
names[i] = nullptr;
for (uint32_t i=0; i < count; i++)
names[i] = nullptr;
}

this->count = count;
}


+ 21
- 14
source/backend/plugin/DssiPlugin.cpp View File

@@ -30,7 +30,7 @@ public:
DssiPlugin(CarlaEngine* const engine, const unsigned int id)
: CarlaPlugin(engine, id)
{
carla_debug("DssiPlugin::DssiPlugin()");
carla_debug("DssiPlugin::DssiPlugin(%p, %i)", engine, id);

fHandle = nullptr;
fHandle2 = nullptr;
@@ -277,6 +277,8 @@ public:

void setMidiProgram(int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool block)
{
CARLA_ASSERT(fDssiDescriptor != nullptr);
CARLA_ASSERT(fHandle != nullptr);
CARLA_ASSERT(index >= -1 && index < static_cast<int32_t>(kData->midiprog.count));

if (index < -1)
@@ -285,7 +287,7 @@ public:
return;

// FIXME
if (index >= 0)
if (fDssiDescriptor != nullptr && fHandle != nullptr && index >= 0)
{
const uint32_t bank = kData->midiprog.data[index].bank;
const uint32_t program = kData->midiprog.data[index].program;
@@ -295,7 +297,7 @@ public:
//const CarlaEngine::ScopedLocker m(x_engine, block);
fDssiDescriptor->select_program(fHandle, bank, program);

if (fHandle)
if (fHandle2 != nullptr)
fDssiDescriptor->select_program(fHandle2, bank, program);
}
else
@@ -304,7 +306,7 @@ public:

fDssiDescriptor->select_program(fHandle, bank, program);

if (fHandle2)
if (fHandle2 != nullptr)
fDssiDescriptor->select_program(fHandle2, bank, program);
}
}
@@ -419,6 +421,7 @@ public:
{
kData->audioOut.createNew(aOuts);
fAudioOutBuffers = new float*[aOuts];
needsCtrlIn = true;

for (uint32_t i=0; i < aOuts; i++)
fAudioOutBuffers[i] = nullptr;
@@ -469,7 +472,6 @@ public:
j = iAudioOut++;
kData->audioOut.ports[j].port = (CarlaEngineAudioPort*)kData->client->addPort(kEnginePortTypeAudio, portName, false);
kData->audioOut.ports[j].rindex = i;
needsCtrlIn = true;

if (forcedStereoOut)
{
@@ -681,7 +683,7 @@ public:

if (kData->engine->getOptions().useDssiVstChunks && QString(fFilename).endsWith("dssi-vst.so", Qt::CaseInsensitive))
{
if (fDssiDescriptor->get_custom_data && fDssiDescriptor->set_custom_data)
if (fDssiDescriptor->get_custom_data != nullptr && fDssiDescriptor->set_custom_data != nullptr)
fHints |= PLUGIN_USES_CHUNKS;
}

@@ -845,7 +847,6 @@ public:
void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t framesOffset)
{
uint32_t i, k;
unsigned long midiEventCount = 0;

// --------------------------------------------------------------------------------------------------------
// Check if active
@@ -871,8 +872,10 @@ public:
return;
}

unsigned long midiEventCount = 0;

// --------------------------------------------------------------------------------------------------------
// Check if active before
// Check if not active before

if (! kData->activeBefore)
{
@@ -1123,6 +1126,9 @@ public:
allNotesOffSent = true;
}

if (midiEventCount >= MAX_MIDI_EVENTS)
continue;

carla_zeroStruct<snd_seq_event_t>(fMidiEvents[midiEventCount]);

if (! sampleAccurate)
@@ -1132,7 +1138,7 @@ public:
fMidiEvents[midiEventCount].data.control.channel = event.channel;
fMidiEvents[midiEventCount].data.control.param = MIDI_CONTROL_ALL_SOUND_OFF;

midiEventCount++;
midiEventCount += 1;

break;

@@ -1145,6 +1151,9 @@ public:
allNotesOffSent = true;
}

if (midiEventCount >= MAX_MIDI_EVENTS)
continue;

carla_zeroStruct<snd_seq_event_t>(fMidiEvents[midiEventCount]);

if (! sampleAccurate)
@@ -1154,7 +1163,7 @@ public:
fMidiEvents[midiEventCount].data.control.channel = event.channel;
fMidiEvents[midiEventCount].data.control.param = MIDI_CONTROL_ALL_NOTES_OFF;

midiEventCount++;
midiEventCount += 1;

break;
}
@@ -1178,8 +1187,8 @@ public:

carla_zeroStruct<snd_seq_event_t>(fMidiEvents[midiEventCount]);

//if (! sampleAccurate)
fMidiEvents[midiEventCount].time.tick = time - timeOffset;
if (! sampleAccurate)
fMidiEvents[midiEventCount].time.tick = time - timeOffset;

if (MIDI_IS_STATUS_NOTE_OFF(status))
{
@@ -1394,8 +1403,6 @@ public:

} // End of Control Output

CARLA_PROCESS_CONTINUE_CHECK;

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

kData->activeBefore = kData->active;


+ 2
- 4
source/backend/plugin/LadspaPlugin.cpp View File

@@ -416,6 +416,7 @@ public:
{
kData->audioOut.createNew(aOuts);
fAudioOutBuffers = new float*[aOuts];
needsCtrlIn = true;

for (uint32_t i=0; i < aOuts; i++)
fAudioOutBuffers[i] = nullptr;
@@ -467,7 +468,6 @@ public:
j = iAudioOut++;
kData->audioOut.ports[j].port = (CarlaEngineAudioPort*)kData->client->addPort(kEnginePortTypeAudio, portName, false);
kData->audioOut.ports[j].rindex = i;
needsCtrlIn = true;

if (forcedStereoOut)
{
@@ -770,7 +770,7 @@ public:
}

// --------------------------------------------------------------------------------------------------------
// Check if active before
// Check if not active before

if (! kData->activeBefore)
{
@@ -1094,8 +1094,6 @@ public:

} // End of Control Output

CARLA_PROCESS_CONTINUE_CHECK;

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

kData->activeBefore = kData->active;


+ 1
- 1
source/backend/plugin/Lv2Plugin.cpp View File

@@ -199,7 +199,7 @@ public:
Lv2Plugin(CarlaEngine* const engine, const unsigned short id)
: CarlaPlugin(engine, id)
{
carla_debug("Lv2Plugin::Lv2Plugin()");
carla_debug("Lv2Plugin::Lv2Plugin(%p, %i)", engine, id);

m_type = PLUGIN_LV2;
m_count += 1;


+ 695
- 625
source/backend/plugin/NativePlugin.cpp
File diff suppressed because it is too large
View File


+ 1
- 1
source/backend/plugin/VstPlugin.cpp View File

@@ -50,7 +50,7 @@ public:
VstPlugin(CarlaEngine* const engine, const unsigned short id)
: CarlaPlugin(engine, id)
{
carla_debug("VstPlugin::VstPlugin()");
carla_debug("VstPlugin::VstPlugin(%p, %i)", engine, id);

m_type = PLUGIN_VST;



Loading…
Cancel
Save