Browse Source

Cleanup lv2 macro use

pull/321/merge
falkTX 2 years ago
parent
commit
a5e132b465
1 changed files with 55 additions and 55 deletions
  1. +55
    -55
      distrho/src/DistrhoPluginLV2.cpp

+ 55
- 55
distrho/src/DistrhoPluginLV2.cpp View File

@@ -620,22 +620,22 @@ public:
// Run plugin // Run plugin
if (sampleCount != 0) if (sampleCount != 0)
{ {
#ifdef DISTRHO_PLUGIN_LICENSED_FOR_MOD
#ifdef DISTRHO_PLUGIN_LICENSED_FOR_MOD
fRunCount = mod_license_run_begin(fRunCount, sampleCount); fRunCount = mod_license_run_begin(fRunCount, sampleCount);
#endif
#endif


#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
fPlugin.run(fPortAudioIns, fPortAudioOuts, sampleCount, fMidiEvents, midiEventCount); fPlugin.run(fPortAudioIns, fPortAudioOuts, sampleCount, fMidiEvents, midiEventCount);
#else
#else
fPlugin.run(fPortAudioIns, fPortAudioOuts, sampleCount); fPlugin.run(fPortAudioIns, fPortAudioOuts, sampleCount);
#endif
#endif


#ifdef DISTRHO_PLUGIN_LICENSED_FOR_MOD
#ifdef DISTRHO_PLUGIN_LICENSED_FOR_MOD
for (uint32_t i=0; i<DISTRHO_PLUGIN_NUM_OUTPUTS; ++i) for (uint32_t i=0; i<DISTRHO_PLUGIN_NUM_OUTPUTS; ++i)
mod_license_run_silence(fRunCount, fPortAudioOuts[i], sampleCount, i); mod_license_run_silence(fRunCount, fPortAudioOuts[i], sampleCount, i);
#endif
#endif


#if DISTRHO_PLUGIN_WANT_TIMEPOS
#if DISTRHO_PLUGIN_WANT_TIMEPOS
// update timePos for next callback // update timePos for next callback
if (d_isNotZero(fLastPositionData.speed)) if (d_isNotZero(fLastPositionData.speed))
{ {
@@ -691,12 +691,12 @@ public:


fPlugin.setTimePosition(fTimePosition); fPlugin.setTimePosition(fTimePosition);
} }
#endif
#endif
} }


updateParameterOutputsAndTriggers(); updateParameterOutputsAndTriggers();


#if DISTRHO_PLUGIN_WANT_STATE
#if DISTRHO_PLUGIN_WANT_STATE
fEventsOutData.initIfNeeded(fURIDs.atomSequence); fEventsOutData.initIfNeeded(fURIDs.atomSequence);


LV2_Atom_Event* aev; LV2_Atom_Event* aev;
@@ -797,11 +797,11 @@ public:
break; break;
} }
} }
#endif
#endif


#if DISTRHO_LV2_USE_EVENTS_OUT
#if DISTRHO_LV2_USE_EVENTS_OUT
fEventsOutData.endRun(); fEventsOutData.endRun();
#endif
#endif
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -860,7 +860,7 @@ public:


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


#if DISTRHO_PLUGIN_WANT_PROGRAMS
#if DISTRHO_PLUGIN_WANT_PROGRAMS
const LV2_Program_Descriptor* lv2_get_program(const uint32_t index) const LV2_Program_Descriptor* lv2_get_program(const uint32_t index)
{ {
if (index >= fPlugin.getProgramCount()) if (index >= fPlugin.getProgramCount())
@@ -895,30 +895,30 @@ public:
setPortControlValue(i, fLastControlValues[i]); setPortControlValue(i, fLastControlValues[i]);
} }


# if DISTRHO_PLUGIN_WANT_FULL_STATE
#if DISTRHO_PLUGIN_WANT_FULL_STATE
// Update state // Update state
for (StringToStringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit) for (StringToStringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit)
{ {
const String& key = cit->first; const String& key = cit->first;
fStateMap[key] = fPlugin.getStateValue(key); fStateMap[key] = fPlugin.getStateValue(key);
} }
# endif
#endif
} }
#endif
#endif


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


#if DISTRHO_PLUGIN_WANT_STATE
#if DISTRHO_PLUGIN_WANT_STATE
LV2_State_Status lv2_save(const LV2_State_Store_Function store, const LV2_State_Handle handle) LV2_State_Status lv2_save(const LV2_State_Store_Function store, const LV2_State_Handle handle)
{ {
# if DISTRHO_PLUGIN_WANT_FULL_STATE
#if DISTRHO_PLUGIN_WANT_FULL_STATE
// Update current state // Update current state
for (StringToStringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit) for (StringToStringMap::const_iterator cit=fStateMap.begin(), cite=fStateMap.end(); cit != cite; ++cit)
{ {
const String& key = cit->first; const String& key = cit->first;
fStateMap[key] = fPlugin.getStateValue(key); fStateMap[key] = fPlugin.getStateValue(key);
} }
# endif
#endif


String lv2key; String lv2key;
LV2_URID urid; LV2_URID urid;
@@ -1021,11 +1021,11 @@ public:


setState(key, value); setState(key, value);


#if DISTRHO_PLUGIN_WANT_STATE
#if DISTRHO_PLUGIN_WANT_STATE
// signal msg needed for UI // signal msg needed for UI
if ((hints & kStateIsOnlyForDSP) == 0x0) if ((hints & kStateIsOnlyForDSP) == 0x0)
fNeededUiSends[i] = true; fNeededUiSends[i] = true;
#endif
#endif
} }


return LV2_STATE_SUCCESS; return LV2_STATE_SUCCESS;
@@ -1090,16 +1090,16 @@ public:
{ {
return LV2_WORKER_SUCCESS; return LV2_WORKER_SUCCESS;
} }
#endif
#endif


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


#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
void* lv2_get_instance_pointer() void* lv2_get_instance_pointer()
{ {
return fPlugin.getInstancePointer(); return fPlugin.getInstancePointer();
} }
#endif
#endif


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


@@ -1107,36 +1107,36 @@ private:
PluginExporter fPlugin; PluginExporter fPlugin;
const bool fUsingNominal; // if false use maxBlockLength const bool fUsingNominal; // if false use maxBlockLength


#ifdef DISTRHO_PLUGIN_LICENSED_FOR_MOD
#ifdef DISTRHO_PLUGIN_LICENSED_FOR_MOD
uint32_t fRunCount; uint32_t fRunCount;
#endif
#endif


// LV2 ports // LV2 ports
#if DISTRHO_PLUGIN_NUM_INPUTS > 0
#if DISTRHO_PLUGIN_NUM_INPUTS > 0
const float* fPortAudioIns[DISTRHO_PLUGIN_NUM_INPUTS]; const float* fPortAudioIns[DISTRHO_PLUGIN_NUM_INPUTS];
#else
#else
const float** fPortAudioIns; const float** fPortAudioIns;
#endif
#if DISTRHO_PLUGIN_NUM_OUTPUTS > 0
#endif
#if DISTRHO_PLUGIN_NUM_OUTPUTS > 0
float* fPortAudioOuts[DISTRHO_PLUGIN_NUM_OUTPUTS]; float* fPortAudioOuts[DISTRHO_PLUGIN_NUM_OUTPUTS];
#else
#else
float** fPortAudioOuts; float** fPortAudioOuts;
#endif
#endif
float** fPortControls; float** fPortControls;
#if DISTRHO_LV2_USE_EVENTS_IN
#if DISTRHO_LV2_USE_EVENTS_IN
LV2_Atom_Sequence* fPortEventsIn; LV2_Atom_Sequence* fPortEventsIn;
#endif
#if DISTRHO_PLUGIN_WANT_LATENCY
#endif
#if DISTRHO_PLUGIN_WANT_LATENCY
float* fPortLatency; float* fPortLatency;
#endif
#endif


// Temporary data // Temporary data
float* fLastControlValues; float* fLastControlValues;
double fSampleRate; double fSampleRate;
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
MidiEvent fMidiEvents[kMaxMidiEvents]; MidiEvent fMidiEvents[kMaxMidiEvents];
#endif
#if DISTRHO_PLUGIN_WANT_TIMEPOS
#endif
#if DISTRHO_PLUGIN_WANT_TIMEPOS
TimePosition fTimePosition; TimePosition fTimePosition;


struct Lv2PositionData { struct Lv2PositionData {
@@ -1160,9 +1160,9 @@ private:
ticksPerBeat(-1.0) {} ticksPerBeat(-1.0) {}


} fLastPositionData; } fLastPositionData;
#endif
#endif


#if DISTRHO_LV2_USE_EVENTS_OUT
#if DISTRHO_LV2_USE_EVENTS_OUT
struct Lv2EventsOutData { struct Lv2EventsOutData {
uint32_t capacity, offset; uint32_t capacity, offset;
LV2_Atom_Sequence* port; LV2_Atom_Sequence* port;
@@ -1198,7 +1198,7 @@ private:
} }


} fEventsOutData; } fEventsOutData;
#endif
#endif


// LV2 URIDs // LV2 URIDs
struct URIDs { struct URIDs {
@@ -1262,13 +1262,13 @@ private:
} fURIDs; } fURIDs;


// LV2 features // LV2 features
#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
const LV2_ControlInputPort_Change_Request* const fCtrlInPortChangeReq; const LV2_ControlInputPort_Change_Request* const fCtrlInPortChangeReq;
#endif
#endif
const LV2_URID_Map* const fUridMap; const LV2_URID_Map* const fUridMap;
const LV2_Worker_Schedule* const fWorker; const LV2_Worker_Schedule* const fWorker;


#if DISTRHO_PLUGIN_WANT_STATE
#if DISTRHO_PLUGIN_WANT_STATE
LV2_Atom_Forge fAtomForge; LV2_Atom_Forge fAtomForge;
StringToStringMap fStateMap; StringToStringMap fStateMap;
UridToStringMap fUridStateMap; UridToStringMap fUridStateMap;
@@ -1321,7 +1321,7 @@ private:
d_stderr("Failed to find plugin state with key \"%s\"", key); d_stderr("Failed to find plugin state with key \"%s\"", key);
return false; return false;
} }
#endif
#endif


void updateParameterOutputsAndTriggers() void updateParameterOutputsAndTriggers()
{ {
@@ -1341,13 +1341,13 @@ private:
} }
} }


#if DISTRHO_PLUGIN_WANT_LATENCY
#if DISTRHO_PLUGIN_WANT_LATENCY
if (fPortLatency != nullptr) if (fPortLatency != nullptr)
*fPortLatency = fPlugin.getLatency(); *fPortLatency = fPlugin.getLatency();
#endif
#endif
} }


#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
bool requestParameterValueChange(const uint32_t index, const float value) bool requestParameterValueChange(const uint32_t index, const float value)
{ {
if (fCtrlInPortChangeReq == nullptr) if (fCtrlInPortChangeReq == nullptr)
@@ -1359,16 +1359,16 @@ private:
{ {
return (((PluginLv2*)ptr)->requestParameterValueChange(index, value) == 0); return (((PluginLv2*)ptr)->requestParameterValueChange(index, value) == 0);
} }
#endif
#endif


#if DISTRHO_PLUGIN_WANT_STATE
#if DISTRHO_PLUGIN_WANT_STATE
static bool updateStateValueCallback(void* const ptr, const char* const key, const char* const value) static bool updateStateValueCallback(void* const ptr, const char* const key, const char* const value)
{ {
return ((PluginLv2*)ptr)->updateState(key, value); return ((PluginLv2*)ptr)->updateState(key, value);
} }
#endif
#endif


#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
bool writeMidi(const MidiEvent& midiEvent) bool writeMidi(const MidiEvent& midiEvent)
{ {
DISTRHO_SAFE_ASSERT_RETURN(fEventsOutData.port != nullptr, false); DISTRHO_SAFE_ASSERT_RETURN(fEventsOutData.port != nullptr, false);
@@ -1398,7 +1398,7 @@ private:
{ {
return ((PluginLv2*)ptr)->writeMidi(midiEvent); return ((PluginLv2*)ptr)->writeMidi(midiEvent);
} }
#endif
#endif
}; };


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


Loading…
Cancel
Save