Browse Source

Implement new Native API as needed

tags/1.9.4
falkTX 11 years ago
parent
commit
6544011b37
2 changed files with 19 additions and 6 deletions
  1. +4
    -4
      source/backend/native/zynaddsubfx.cpp
  2. +15
    -2
      source/backend/plugin/NativePlugin.cpp

+ 4
- 4
source/backend/native/zynaddsubfx.cpp View File

@@ -108,7 +108,6 @@ public:
fMaster(new Master()),
fSampleRate(getSampleRate()),
fIsActive(false),
fIsOffline(false),
fThread(fMaster, host)
{
fThread.start();
@@ -235,7 +234,7 @@ protected:
if (program >= BANK_SIZE)
return;

if (fIsOffline || ! fIsActive)
if (isOffline() || ! fIsActive)
{
loadProgram(fMaster, channel, bank, program);
#ifdef WANT_ZYNADDSUBFX_UI
@@ -375,6 +374,8 @@ protected:
case PLUGIN_OPCODE_SAMPLE_RATE_CHANGED:
// TODO
break;
case PLUGIN_OPCODE_OFFLINE_CHANGED:
break;
case PLUGIN_OPCODE_UI_NAME_CHANGED:
#ifdef WANT_ZYNADDSUBFX_UI
// TODO
@@ -616,10 +617,9 @@ private:
uint32_t fNextProgram;
};

Master* const fMaster;
Master* fMaster;
unsigned fSampleRate;
bool fIsActive;
bool fIsOffline;

ZynThread fThread;



+ 15
- 2
source/backend/plugin/NativePlugin.cpp View File

@@ -189,6 +189,7 @@ public:

fHost.get_buffer_size = carla_host_get_buffer_size;
fHost.get_sample_rate = carla_host_get_sample_rate;
fHost.is_offline = carla_host_is_offline;
fHost.get_time_info = carla_host_get_time_info;
fHost.write_midi_event = carla_host_write_midi_event;
fHost.ui_parameter_changed = carla_host_ui_parameter_changed;
@@ -436,9 +437,11 @@ public:
CARLA_ASSERT(fHandle != nullptr);
CARLA_ASSERT(parameterId < kData->param.count);

if (fDescriptor->get_parameter_text != nullptr && parameterId < kData->param.count)
if (fDescriptor->get_parameter_value != nullptr && fDescriptor->get_parameter_text != nullptr && parameterId < kData->param.count)
{
if (const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId))
const float value(fDescriptor->get_parameter_value(fHandle, parameterId));

if (const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value))
{
std::strncpy(strBuf, text, STR_MAX);
return;
@@ -2023,6 +2026,11 @@ protected:
return kData->engine->getSampleRate();
}

bool handleIsOffline()
{
return kData->engine->isOffline();
}

const ::TimeInfo* handleGetTimeInfo()
{
CARLA_ASSERT(fIsProcessing);
@@ -2354,6 +2362,11 @@ private:
return handlePtr->handleGetSampleRate();
}

static bool carla_host_is_offline(HostHandle handle)
{
return handlePtr->handleIsOffline();
}

static const ::TimeInfo* carla_host_get_time_info(HostHandle handle)
{
return handlePtr->handleGetTimeInfo();


Loading…
Cancel
Save