clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 1585a3136ba3f1366ae26cdc02ebee25c6f1b945
parent 3ee5b72ff7f16309e4d378af232d70727891343d
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date:   Wed,  8 Oct 2014 19:34:18 +0200

Update the spec

Diffstat:
Minclude/clap/clap.h | 5++++-
Mspec.html | 17+++++++++++++++--
Mspec.rst | 15++++++++++++++-
3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/include/clap/clap.h b/include/clap/clap.h @@ -245,8 +245,11 @@ struct clap_host struct clap_plugin *plugin, struct clap_event *events); + /* used for timing events */ + uint64_t (*steady_time)(struct clap_host *host); + /* future features */ - void *(*extension)(struct clap_plugin *plugin, const char *extention_id); + void *(*extension)(struct clap_host *host, const char *extention_id); }; //////////// diff --git a/spec.html b/spec.html @@ -676,6 +676,13 @@ otherwise.</p> <h3><a class="toc-backref" href="#id36">Sending events to the host</a></h3> <p>The plugin can notify the host of parameter changes by sending events to: <tt class="docutils literal"><span class="pre">host-&gt;events(host,</span> plugin, events);</tt>.</p> +<p>Events sent to the host should be stamped:</p> +<pre class="code c literal-block"> +<span class="k">struct</span> <span class="n">clap_event</span> <span class="n">ev</span><span class="p">;</span> +<span class="c1">// ... +</span><span class="n">ev</span><span class="p">.</span><span class="n">sample_offset</span> <span class="o">=</span> <span class="n">host</span><span class="o">-&gt;</span><span class="n">steady_time</span><span class="p">(</span><span class="n">host</span><span class="p">);</span> +<span class="n">host</span><span class="o">-&gt;</span><span class="n">events</span><span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">plugin</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">ev</span><span class="p">);</span> +</pre> </div> <div class="section" id="hiding-the-gui"> <h3><a class="toc-backref" href="#id37">Hiding the GUI</a></h3> @@ -683,9 +690,10 @@ otherwise.</p> If the plugin window has been closed by the user, then the plugin should send an event <tt class="docutils literal">CLAP_EVENT_GUI_CLOSED</tt> to the host.</p> <pre class="code c literal-block"> -<span class="k">struct</span> <span class="n">clap</span> <span class="n">event</span> <span class="n">ev</span><span class="p">;</span> +<span class="k">struct</span> <span class="n">clap_event</span> <span class="n">ev</span><span class="p">;</span> <span class="n">ev</span><span class="p">.</span><span class="n">next</span> <span class="o">=</span> <span class="nb">NULL</span><span class="p">;</span> <span class="n">ev</span><span class="p">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">CLAP_EVENT_GUI_CLOSED</span><span class="p">;</span> +<span class="n">ev</span><span class="p">.</span><span class="n">sample_offset</span> <span class="o">=</span> <span class="n">host</span><span class="o">-&gt;</span><span class="n">steady_time</span><span class="p">(</span><span class="n">host</span><span class="p">);</span> <span class="n">host</span><span class="o">-&gt;</span><span class="n">events</span><span class="p">(</span><span class="n">host</span><span class="p">,</span> <span class="n">plugin</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">ev</span><span class="p">);</span> </pre> </div> @@ -702,6 +710,8 @@ It is the responsibility of the host to free the linked list.</p> <h3><a class="toc-backref" href="#id40">Load a preset</a></h3> <p>To load a preset, the host should send an event <tt class="docutils literal">CLAP_EVENT_PRESET_SET</tt> to the plugin.</p> +<p>When a preset is loaded from the plugin's GUI, the plugin must send a +<tt class="docutils literal">CLAP_EVENT_PRESET_SET</tt> to the host.</p> </div> </div> <div class="section" id="save-and-restore-plugin-s-state"> @@ -987,8 +997,11 @@ big endian machine, it should load again successfully.</p> <span class="k">struct</span> <span class="n">clap_plugin</span> <span class="o">*</span><span class="n">plugin</span><span class="p">,</span> <span class="k">struct</span> <span class="n">clap_event</span> <span class="o">*</span><span class="n">events</span><span class="p">);</span> + <span class="cm">/* used for timing events */</span> + <span class="kt">uint64_t</span> <span class="p">(</span><span class="o">*</span><span class="n">steady_time</span><span class="p">)(</span><span class="k">struct</span> <span class="n">clap_host</span> <span class="o">*</span><span class="n">host</span><span class="p">);</span> + <span class="cm">/* future features */</span> - <span class="kt">void</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">extension</span><span class="p">)(</span><span class="k">struct</span> <span class="n">clap_plugin</span> <span class="o">*</span><span class="n">plugin</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">extention_id</span><span class="p">);</span> + <span class="kt">void</span> <span class="o">*</span><span class="p">(</span><span class="o">*</span><span class="n">extension</span><span class="p">)(</span><span class="k">struct</span> <span class="n">clap_host</span> <span class="o">*</span><span class="n">host</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">extention_id</span><span class="p">);</span> <span class="p">};</span> <span class="c1">//////////// diff --git a/spec.rst b/spec.rst @@ -433,6 +433,15 @@ Sending events to the host The plugin can notify the host of parameter changes by sending events to: ``host->events(host, plugin, events);``. +Events sent to the host should be stamped: + +.. code:: c + + struct clap_event ev; + // ... + ev.sample_offset = host->steady_time(host); + host->events(host, plugin, &ev); + Hiding the GUI ~~~~~~~~~~~~~~ @@ -442,9 +451,10 @@ send an event ``CLAP_EVENT_GUI_CLOSED`` to the host. .. code:: c - struct clap event ev; + struct clap_event ev; ev.next = NULL; ev.type = CLAP_EVENT_GUI_CLOSED; + ev.sample_offset = host->steady_time(host); host->events(host, plugin, &ev); @@ -464,6 +474,9 @@ Load a preset To load a preset, the host should send an event ``CLAP_EVENT_PRESET_SET`` to the plugin. +When a preset is loaded from the plugin's GUI, the plugin must send a +``CLAP_EVENT_PRESET_SET`` to the host. + Save and restore plugin's state -------------------------------