aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lv2_plugin_guide/guide.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lv2_plugin_guide/guide.adoc')
-rw-r--r--doc/lv2_plugin_guide/guide.adoc26
1 files changed, 13 insertions, 13 deletions
diff --git a/doc/lv2_plugin_guide/guide.adoc b/doc/lv2_plugin_guide/guide.adoc
index df085a0..eb64657 100644
--- a/doc/lv2_plugin_guide/guide.adoc
+++ b/doc/lv2_plugin_guide/guide.adoc
@@ -62,7 +62,7 @@ Part 1: The code
Let's start off by including the core LV2 header.
-[source, C]
+[source,c]
--------------------------------------------------------------------------------
#include <lv2/lv2plug.in/ns/lv2core/lv2.h>
--------------------------------------------------------------------------------
@@ -74,14 +74,14 @@ This header is part of the "core" LV2 specification: http://lv2plug.in/ns/lv2cor
LV2 plugins are are responsible for keeping track of what ports they have and what host-controlled data structures they're attached to.
In our simple amplifier, these are the only variables stored in the plugin structure:
-[source, C]
+[source,c]
----
include::../../plugins/eg-amp.lv2/amp.c[tags=Amp]
----
We also define an `enum` for their indices to keep the code readable:
-[source, C]
+[source,c]
----
include::../../plugins/eg-amp.lv2/amp.c[tags=PortIndex]
----
@@ -111,12 +111,12 @@ guarantees you have for when each callback may be invoked see XXX
Since this plugin contains minimal state, the `instantiate` and `cleanup` functions simply allocate and free the `Amp` structure:
-[source, C]
+[source,c]
--------------------------------------------------------------------------------
include::../../plugins/eg-amp.lv2/amp.c[tags=instantiate]
--------------------------------------------------------------------------------
-[source, C]
+[source,c]
--------------------------------------------------------------------------------
include::../../plugins/eg-amp.lv2/amp.c[tags=cleanup]
--------------------------------------------------------------------------------
@@ -126,7 +126,7 @@ Each call from the host will provide a pointer to a buffer for one of the ports.
The plugin will need to store that pointer and either read from it or write to
it depending upon if it's an input or an output.
-[source, C]
+[source,c]
----
include::../../plugins/eg-amp.lv2/amp.c[tags=connect_port]
----
@@ -134,7 +134,7 @@ include::../../plugins/eg-amp.lv2/amp.c[tags=connect_port]
After the host has connected data to each one of the ports and activated the
plugin then the amplfier LV2 plugin can run for a number of samples.
-[source, C]
+[source,c]
----
include::../../plugins/eg-amp.lv2/amp.c[tags=run]
----
@@ -144,7 +144,7 @@ all of these functions.
Since multiple LV2 plugins can be contained in the same shared library this is
done through the exported lv2_descriptor(link) function:
-[source, C]
+[source,c]
----
include::../../plugins/eg-amp.lv2/amp.c[tags=descriptor]
----
@@ -281,7 +281,7 @@ Part 4: A recap
~~~~~~~~~~~~~~~
amp.c:
-[source, C]
+[source,c]
--------------------------------------------------------------------------------
#include <lv2/lv2plug.in/ns/lv2core/lv2.h>
#define AMP_URI "http://lv2plug.in/plugins.eg-amp"
@@ -491,7 +491,7 @@ example, so let's focus on what is different.
To start off with, we're going to need headers for each one of the chunks of the
API we're using:
-[source,C]
+[source,c]
--------------------------------------------------------------------------------
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
#include "lv2/lv2plug.in/ns/ext/atom/util.h"
@@ -508,7 +508,7 @@ Next up we'll want to store our data which consists of:
- A URID which identifies a MIDI event from other Atom events
- The number of active notes
-[source, C]
+[source,c]
--------------------------------------------------------------------------------
typedef struct {
const LV2_Atom_Sequence* control;
@@ -558,7 +558,7 @@ What this means for the output port is that we can process a chunk of samples up
to the new MIDI event, update the number of notes, and then process the next
chunk of data.
-[source, C]
+[source,c]
--------------------------------------------------------------------------------
static void
run(LV2_Handle instance, uint32_t sample_count)
@@ -607,7 +607,7 @@ function.
We need to preserve any connections, but wipe out any state in the plugin.
For the MIDI gate this is just clearing the number of active notes
-[source, C]
+[source,c]
--------------------------------------------------------------------------------
static void activate(LV2_Handle instance) {
Midigate* self = (Midigate*)instance;