File: adding_plugins.html

package info (click to toggle)
cmt 1.18-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 576 kB
  • sloc: cpp: 7,000; makefile: 98
file content (93 lines) | stat: -rw-r--r-- 3,413 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<HTML>
  <HEAD>
    <TITLE>CMT Documentation</TITLE>
    <META NAME="DESCRIPTION"
          CONTENT="CMT Documentation">
  </HEAD>
  <BODY BGCOLOR=#FFFFFF>
    
    <CENTER><IMG BORDER=0 SRC="/images/top.jpg"></CENTER>

    <HR/>


<H1>Adding Plugins to the CMT Library</H1>

<P>The CMT <A HREF="http://www.ladspa.org">
LADSPA</A> plugin collection is written in C++ and uses a little
additional sophistication to make plugin writing easier. This document
describes how to add a new plugin to the toolkit.</P>

<P>CMT plugins interpret <CODE>LADSPA_Handle</CODE> entities as
pointers to objects derived from the <CODE>CMT_PluginInstance</CODE>
class. Plugin instance structures are defined by subclassing this, so
writing a descendent of <CODE>CMT_PluginInstance</CODE> is the first
thing to do. The CMT library provides its own implementation of
<CODE>connect_port()</CODE>, <CODE>cleanup()</CODE> and a templated
form of <CODE>instantiate()</CODE> (see
<CODE>CMT_Instantiate<>()</CODE>). These calls assume that any
instantiation or cleanup mechanisms required will be written in the
constructor or destructor of the class.</P>

<P>When writing a plugin module, an initialisation function should be
included. To ensure this is called, add a call to the
<CODE>initialise_modules()</CODE> function in
<CODE>descriptor.cpp</CODE>. The module should also be added to the
<CODE>makefile</CODE>.</P>

<P>Your initialisation function should construct new
<CODE>CMT_Desctiptor</CODE> plugin descriptor structures and pass them
to <CODE>registerNewPluginDescriptor()</CODE>. The
<CODE>CMT_Descriptor</CODE> is directly descended from
<CODE>LADSPA_Descriptor</CODE> but provides constructor, destructor
and <CODE>addPort()</CODE> methods.</P>

<P>All plugins need unique IDs. During development, use values between
1 and 1000. When the plugin is ready, please request a block of IDs
from <A HREF="mailto:ids@ladspa.org">ids@ladspa.org</A>.</P>

<P>In practice, CMT plugin writing is probably best learned by
example. For a simple case, see the <CODE>mixer.cpp</CODE>
module. This defines a <CODE>SimpleMixer</CODE> class to handle
instance data, a <CODE>runSimpleMixer()</CODE> function for use with
it and a <CODE>mixer_descriptor()</CODE> function to provide a
description of the plugin to the CMT core. The
<CODE>mixer_descriptor()</CODE> function is declared and referenced in
the <CODE>descriptor.cpp</CODE> module. Additional information is
available in <CODE>cmt.h</CODE> and <CODE>ladspa.h</CODE>.</P>

<P>CMT plugins are <A HREF="license.html">licenced</A> under GPL
version 2. Please read and understand this license before submitting
plugins to the library.</P>

<HR/>

<H1>CMT Index</H1>

<UL>
  <LI><A HREF="overview.html">Overview</A></LI>
  <LI><A HREF="http://www.ladspa.org/download/index.html">Download</A></LI>
  <LI><A HREF="installation.html">Installation</A></LI>
  <LI><A HREF="license.html">License (LGPL)</A></LI>
  <LI><A HREF="plugins.html">Plugins in the Library</A></LI>
  <LI><A HREF="adding_plugins.html">Adding Plugins to the Library</A></LI>
  <LI><A HREF="changes.html">Change History</A></LI>
  <LI><A HREF="bugs.html">Bugs</A></LI>
</UL>

<H2>Other Links</H2>

<UL>
  <LI>
    The <A HREF="http://www.ladspa.org/ladspa_sdk/overview.html">LADSPA
      Software Development Kit</A>
  </LI>
</UL>


    <HR/>

    <CENTER><IMG BORDER=0 SRC="/images/base.jpg"></CENTER>

  </BODY>
</HTML>