Browse Source

Continue documentation

gh-pages
falkTX 9 years ago
parent
commit
964a566666
8 changed files with 67 additions and 61 deletions
  1. +18
    -20
      distrho/DistrhoPlugin.hpp
  2. +1
    -1
      distrho/src/DistrhoPlugin.cpp
  3. +5
    -5
      distrho/src/DistrhoPluginChecks.h
  4. +6
    -6
      distrho/src/DistrhoPluginLADSPA+DSSI.cpp
  5. +7
    -7
      distrho/src/DistrhoPluginLV2.cpp
  6. +4
    -4
      distrho/src/DistrhoPluginLV2export.cpp
  7. +9
    -9
      distrho/src/DistrhoPluginVST.cpp
  8. +17
    -9
      dpf.doxygen

+ 18
- 20
distrho/DistrhoPlugin.hpp View File

@@ -35,20 +35,20 @@
START_NAMESPACE_DISTRHO

/**
@defgroup dpf DISTRHO Plugin Framework
@mainpage DISTRHO %Plugin Framework

A plugin framework designed to make development of new plugins an easy and enjoyable task.@n
DISTRHO %Plugin Framework (or @b DPF for short)
is a plugin framework designed to make development of new plugins an easy and enjoyable task.@n
It allows developers to create plugins with custom UIs using a simple C++ API.

@section Macros
You start by creating a "DistrhoPluginInfo.h" file describing the plugin via macros, see PluginMacros.
You start by creating a "DistrhoPluginInfo.h" file describing the plugin via macros, see @ref PluginMacros.

@section Plugin
TODO

@section Parameters
describe input and output, automable and rt safe, boolean etc, cv
@{
*/

/* ------------------------------------------------------------------------------------------------------------
@@ -104,7 +104,7 @@ START_NAMESPACE_DISTRHO
#define DISTRHO_PLUGIN_URI "urn:distrho:name"

/**
Wherever the plugin has a custom UI.
Wherever the plugin has a custom %UI.
@see DISTRHO_UI_USE_NANOVG
@see UI
*/
@@ -118,18 +118,18 @@ START_NAMESPACE_DISTRHO

/**
Wherever the plugin is a synth.@n
@ref DISTRHO_PLUGIN_WANTS_MIDI_INPUT is automatically enabled when this is too.
@see DISTRHO_PLUGIN_WANTS_MIDI_INPUT
@ref DISTRHO_PLUGIN_WANT_MIDI_INPUT is automatically enabled when this is too.
@see DISTRHO_PLUGIN_WANT_MIDI_INPUT
*/
#define DISTRHO_PLUGIN_IS_SYNTH 1

/**
Enable direct access between the UI and plugin code.
Enable direct access between the %UI and plugin code.
@see UI::d_getPluginInstancePointer()
@note DO NOT USE THIS UNLESS STRICTLY NECESSARY!!
Try to avoid it at all costs!
*/
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0

/**
Wherever the plugin introduces latency during audio or midi processing.
@@ -141,13 +141,13 @@ START_NAMESPACE_DISTRHO
Wherever the plugin wants MIDI input.@n
This is automatically enabled if @ref DISTRHO_PLUGIN_IS_SYNTH is true.
*/
#define DISTRHO_PLUGIN_WANTS_MIDI_INPUT 1
#define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1

/**
Wherever the plugin wants MIDI output.
@see Plugin::d_writeMidiEvent(const MidiEvent&)
*/
#define DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT 1
#define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1

/**
Wherever the plugin provides its own internal programs.
@@ -170,14 +170,14 @@ START_NAMESPACE_DISTRHO
#define DISTRHO_PLUGIN_WANT_TIMEPOS 1

/**
Wherever the UI uses NanoVG for drawing instead of the default raw OpenGL calls.@n
When enabled your UI instance will subclass @ref NanoWidget instead of @ref Widget.
Wherever the %UI uses NanoVG for drawing instead of the default raw OpenGL calls.@n
When enabled your %UI instance will subclass @ref NanoWidget instead of @ref Widget.
*/
#define DISTRHO_UI_USE_NANOVG 1

/**
The UI URI when exporting in LV2 format.@n
By default this is set as @ref DISTRHO_PLUGIN_URI with "#UI" as suffix.
The %UI URI when exporting in LV2 format.@n
By default this is set to @ref DISTRHO_PLUGIN_URI with "#UI" as suffix.
*/
#define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#UI"

@@ -564,7 +564,7 @@ struct TimePosition {
DISTRHO_PLUGIN_WANT_STATE activates internal state features.
When enabled you need to implement d_initStateKey() and d_setState().

The process function d_run() changes wherever DISTRHO_PLUGIN_WANTS_MIDI_INPUT is enabled or not.
The process function d_run() changes wherever DISTRHO_PLUGIN_WANT_MIDI_INPUT is enabled or not.
When enabled it provides midi input events.
*/
class Plugin
@@ -620,7 +620,7 @@ public:
void d_setLatency(uint32_t frames) noexcept;
#endif

#if DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
/**
Write a MIDI output event.
This function must only be called during d_run().
@@ -741,7 +741,7 @@ protected:
*/
virtual void d_deactivate() {}

#if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
/**
Run/process function for plugins with MIDI input.
@note: Some parameters might be null if there are no audio inputs/outputs or MIDI events.
@@ -793,8 +793,6 @@ private:
*/
extern Plugin* createPlugin();

/** @} */

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

END_NAMESPACE_DISTRHO


+ 1
- 1
distrho/src/DistrhoPlugin.cpp View File

@@ -96,7 +96,7 @@ void Plugin::d_setLatency(const uint32_t frames) noexcept
}
#endif

#if DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
bool Plugin::d_writeMidiEvent(const MidiEvent& /*midiEvent*/) noexcept
{
// TODO


+ 5
- 5
distrho/src/DistrhoPluginChecks.h View File

@@ -61,8 +61,8 @@
# define DISTRHO_PLUGIN_WANT_LATENCY 0
#endif

#ifndef DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT
# define DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT 0
#ifndef DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
# define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 0
#endif

#ifndef DISTRHO_PLUGIN_WANT_PROGRAMS
@@ -98,9 +98,9 @@
// -----------------------------------------------------------------------
// Enable MIDI input if synth, test if midi-input disabled when synth

#ifndef DISTRHO_PLUGIN_WANTS_MIDI_INPUT
# define DISTRHO_PLUGIN_WANTS_MIDI_INPUT DISTRHO_PLUGIN_IS_SYNTH
#elif DISTRHO_PLUGIN_IS_SYNTH && ! DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#ifndef DISTRHO_PLUGIN_WANT_MIDI_INPUT
# define DISTRHO_PLUGIN_WANT_MIDI_INPUT DISTRHO_PLUGIN_IS_SYNTH
#elif DISTRHO_PLUGIN_IS_SYNTH && ! DISTRHO_PLUGIN_WANT_MIDI_INPUT
# error Synths need MIDI input to work!
#endif



+ 6
- 6
distrho/src/DistrhoPluginLADSPA+DSSI.cpp View File

@@ -16,7 +16,7 @@

#include "DistrhoPluginInternal.hpp"

#if DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
# error Cannot use MIDI Output with LADSPA or DSSI
#endif

@@ -24,7 +24,7 @@
# include "dssi/dssi.h"
#else
# include "ladspa/ladspa.h"
# if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
# if DISTRHO_PLUGIN_WANT_MIDI_INPUT
# error Cannot use MIDI with LADSPA
# endif
# if DISTRHO_PLUGIN_WANT_STATE
@@ -190,7 +190,7 @@ public:
}
}

#if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
// Get MIDI Events
uint32_t midiEventCount = 0;
MidiEvent midiEvents[eventCount];
@@ -271,7 +271,7 @@ public:

updateParameterOutputs();

#if defined(DISTRHO_PLUGIN_TARGET_DSSI) && ! DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if defined(DISTRHO_PLUGIN_TARGET_DSSI) && ! DISTRHO_PLUGIN_WANT_MIDI_INPUT
return; // unused
(void)events; (void)eventCount;
#endif
@@ -435,7 +435,7 @@ static void dssi_select_program(LADSPA_Handle instance, ulong bank, ulong progra
}
# endif

# if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
# if DISTRHO_PLUGIN_WANT_MIDI_INPUT
static void dssi_run_synth(LADSPA_Handle instance, ulong sampleCount, snd_seq_event_t* events, ulong eventCount)
{
instancePtr->dssi_run_synth(sampleCount, events, eventCount);
@@ -490,7 +490,7 @@ static DSSI_Descriptor sDssiDescriptor = {
/* select_program */ nullptr,
# endif
/* get_midi_controller_for_port */ nullptr,
# if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
# if DISTRHO_PLUGIN_WANT_MIDI_INPUT
dssi_run_synth,
# else
/* run_synth */ nullptr,


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

@@ -44,8 +44,8 @@
# warning LV2 TimePos still TODO
#endif

#define DISTRHO_LV2_USE_EVENTS_IN (DISTRHO_PLUGIN_WANTS_MIDI_INPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI))
#define DISTRHO_LV2_USE_EVENTS_OUT (DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI))
#define DISTRHO_LV2_USE_EVENTS_IN (DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI))
#define DISTRHO_LV2_USE_EVENTS_OUT (DISTRHO_PLUGIN_WANT_MIDI_OUTPUT || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI))

START_NAMESPACE_DISTRHO

@@ -271,7 +271,7 @@ public:
}

#if DISTRHO_LV2_USE_EVENTS_IN
# if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
# if DISTRHO_PLUGIN_WANT_MIDI_INPUT
uint32_t midiEventCount = 0;
# endif
LV2_ATOM_SEQUENCE_FOREACH(fPortEventsIn, event)
@@ -279,7 +279,7 @@ public:
if (event == nullptr)
break;

# if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
# if DISTRHO_PLUGIN_WANT_MIDI_INPUT
if (event->body.type == fURIDs.midiEvent)
{
if (midiEventCount >= kMaxMidiEvents)
@@ -477,7 +477,7 @@ public:
fPlugin.setTimePosition(fTimePosition);
# endif

#if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
fPlugin.run(fPortAudioIns, fPortAudioOuts, sampleCount, fMidiEvents, midiEventCount);
#else
fPlugin.run(fPortAudioIns, fPortAudioOuts, sampleCount);
@@ -529,7 +529,7 @@ public:
uint32_t size, offset = 0;
LV2_Atom_Event* aev;

# if DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT
# if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
// TODO
# endif
# if (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI)
@@ -783,7 +783,7 @@ private:
// Temporary data
float* fLastControlValues;
double fSampleRate;
#if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
MidiEvent fMidiEvents[kMaxMidiEvents];
#endif
#if DISTRHO_PLUGIN_WANT_TIMEPOS


+ 4
- 4
distrho/src/DistrhoPluginLV2export.cpp View File

@@ -49,8 +49,8 @@
# define DISTRHO_PLUGIN_HAS_UI 0
#endif

#define DISTRHO_LV2_USE_EVENTS_IN (DISTRHO_PLUGIN_WANTS_MIDI_INPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI))
#define DISTRHO_LV2_USE_EVENTS_OUT (DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI))
#define DISTRHO_LV2_USE_EVENTS_IN (DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI))
#define DISTRHO_LV2_USE_EVENTS_OUT (DISTRHO_PLUGIN_WANT_MIDI_OUTPUT || (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI))

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

@@ -255,7 +255,7 @@ void lv2_generate_ttl(const char* const basename)
# if (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI)
pluginString += " atom:supports <" LV2_ATOM__String "> ;\n";
# endif
# if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
# if DISTRHO_PLUGIN_WANT_MIDI_INPUT
pluginString += " atom:supports <" LV2_MIDI__MidiEvent "> ;\n";
# endif
# if DISTRHO_PLUGIN_WANT_TIMEPOS
@@ -276,7 +276,7 @@ void lv2_generate_ttl(const char* const basename)
# if (DISTRHO_PLUGIN_WANT_STATE && DISTRHO_PLUGIN_HAS_UI)
pluginString += " atom:supports <" LV2_ATOM__String "> ;\n";
# endif
# if DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT
# if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
pluginString += " atom:supports <" LV2_MIDI__MidiEvent "> ;\n";
# endif
pluginString += " ] ;\n\n";


+ 9
- 9
distrho/src/DistrhoPluginVST.cpp View File

@@ -202,7 +202,7 @@ protected:

void sendNote(const uint8_t channel, const uint8_t note, const uint8_t velocity)
{
#if 0 //DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if 0 //DISTRHO_PLUGIN_WANT_MIDI_INPUT
// TODO
#else
return; // unused
@@ -278,7 +278,7 @@ public:
std::memset(fProgramName, 0, sizeof(char)*(32+1));
std::strcpy(fProgramName, "Default");

#if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
fMidiEventCount = 0;
#endif

@@ -390,7 +390,7 @@ public:
if (value != 0)
{
fPlugin.activate();
#if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
fMidiEventCount = 0;
#endif
}
@@ -548,7 +548,7 @@ public:
}
#endif // DISTRHO_PLUGIN_WANT_STATE

#if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
case effProcessEvents:
if (const VstEvents* const events = (const VstEvents*)ptr)
{
@@ -586,7 +586,7 @@ public:
}
break;

#if DISTRHO_PLUGIN_WANTS_MIDI_INPUT || DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || DISTRHO_OS_MAC
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT || DISTRHO_PLUGIN_WANT_MIDI_OUTPUT || DISTRHO_PLUGIN_WANT_TIMEPOS || DISTRHO_OS_MAC
case effCanDo:
if (const char* const canDo = (const char*)ptr)
{
@@ -597,13 +597,13 @@ public:
return 0xbeef0000;
}
# endif
# if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
# if DISTRHO_PLUGIN_WANT_MIDI_INPUT
if (std::strcmp(canDo, "receiveVstEvents") == 0)
return 1;
if (std::strcmp(canDo, "receiveVstMidiEvent") == 0)
return 1;
# endif
# if DISTRHO_PLUGIN_WANTS_MIDI_OUTPUT
# if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
if (std::strcmp(canDo, "sendVstEvents") == 0)
return 1;
if (std::strcmp(canDo, "sendVstMidiEvent") == 0)
@@ -690,7 +690,7 @@ public:
}
#endif

#if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
fPlugin.run(inputs, outputs, sampleFrames, fMidiEvents, fMidiEventCount);
fMidiEventCount = 0;
#else
@@ -724,7 +724,7 @@ private:
// Temporary data
char fProgramName[32+1];

#if DISTRHO_PLUGIN_WANTS_MIDI_INPUT
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
uint32_t fMidiEventCount;
MidiEvent fMidiEvents[kMaxMidiEvents];
#endif


+ 17
- 9
dpf.doxygen View File

@@ -47,7 +47,7 @@ LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
@@ -242,14 +242,22 @@ SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = DOXYGEN \
DISTRHO_PLUGIN_HAS_MIDI_INPUT \
DISTRHO_PLUGIN_HAS_MIDI_OUTPUT \
DISTRHO_PLUGIN_WANT_DIRECT_ACCESS \
DISTRHO_PLUGIN_WANT_LATENCY \
DISTRHO_PLUGIN_WANT_PROGRAMS \
DISTRHO_PLUGIN_WANT_STATE \
DISTRHO_PLUGIN_WANT_TIMEPOS
EXPAND_AS_DEFINED =
DISTRHO_PLUGIN_NAME="Plugin Name" \
DISTRHO_PLUGIN_NUM_INPUTS=2 \
DISTRHO_PLUGIN_NUM_OUTPUTS=2 \
DISTRHO_PLUGIN_URI="urn:distrho:name" \
DISTRHO_PLUGIN_HAS_UI=1 \
DISTRHO_PLUGIN_IS_RT_SAFE=1 \
DISTRHO_PLUGIN_IS_SYNTH=1 \
DISTRHO_PLUGIN_WANT_DIRECT_ACCESS=1 \
DISTRHO_PLUGIN_WANT_LATENCY=1 \
DISTRHO_PLUGIN_WANT_MIDI_INPUT=1 \
DISTRHO_PLUGIN_WANT_MIDI_OUTPUT=1 \
DISTRHO_PLUGIN_WANT_PROGRAMS=1 \
DISTRHO_PLUGIN_WANT_STATE=1 \
DISTRHO_PLUGIN_WANT_TIMEPOS=1 \
DISTRHO_UI_USE_NANOVG=1
EXPAND_AS_DEFINED = YES
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references


Loading…
Cancel
Save