Skip to content

Commit

Permalink
deploy: b1f9c9a
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Feb 25, 2024
1 parent cf5ccfa commit 4971247
Show file tree
Hide file tree
Showing 57 changed files with 998 additions and 998 deletions.
20 changes: 10 additions & 10 deletions advanced/channel_mimicking.html
Original file line number Diff line number Diff line change
Expand Up @@ -181,25 +181,25 @@ <h1 id="audio-channel-mimicking"><a class="header" href="#audio-channel-mimickin
<p>For instance, consider the following case:</p>
<pre><code class="language-cpp">struct
{
halp::audio_input_bus&lt;&quot;Main Input&quot;&gt; audio;
halp::audio_input_bus&lt;"Main Input"&gt; audio;
} inputs;

struct
{
halp::audio_output_bus&lt;&quot;Output&quot;&gt; audio;
halp::audio_output_bus&lt;"Output"&gt; audio;
} outputs;
</code></pre>
<p>Here, everything is fine: the host can send 1, 2, ... channels to the input, and Avendish will make sure that the audio output matches that.</p>
<p>Now imagine that we add another bus: </p>
<p>Now imagine that we add another bus:</p>
<pre><code class="language-cpp">struct ins
{
halp::audio_input_bus&lt;&quot;Main Input&quot;&gt; audio;
halp::audio_input_bus&lt;&quot;Sidechain&quot;&gt; sidechain;
halp::audio_input_bus&lt;"Main Input"&gt; audio;
halp::audio_input_bus&lt;"Sidechain"&gt; sidechain;
} inputs;

struct outs
{
halp::audio_output_bus&lt;&quot;Output&quot;&gt; audio;
halp::audio_output_bus&lt;"Output"&gt; audio;
} outputs;
</code></pre>
<p>Even if for us, humans, it is reasonable to assume that there will be as many output channels, as there are in the main input, it is not something that a computer can assume that easily.</p>
Expand All @@ -208,16 +208,16 @@ <h1 id="audio-channel-mimicking"><a class="header" href="#audio-channel-mimickin
<pre><code class="language-cpp">static constexpr auto mimick_channel = &amp;ins::audio;
</code></pre>
<p>Taking the member function pointer to an input will allow Avendish to match the channel count at run-time.</p>
<p>An helper is provided: for instance, in the above case, it would give: </p>
<p>An helper is provided: for instance, in the above case, it would give:</p>
<pre><code class="language-cpp">struct ins
{
halp::audio_input_bus&lt;&quot;Main Input&quot;&gt; audio;
halp::audio_input_bus&lt;&quot;Sidechain&quot;&gt; sidechain;
halp::audio_input_bus&lt;"Main Input"&gt; audio;
halp::audio_input_bus&lt;"Sidechain"&gt; sidechain;
} inputs;

struct outs
{
halp::mimic_audio_bus&lt;&quot;Output&quot;, &amp;ins::audio&gt; audio;
halp::mimic_audio_bus&lt;"Output", &amp;ins::audio&gt; audio;
} outputs;
</code></pre>

Expand Down
14 changes: 7 additions & 7 deletions advanced/cmake.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,15 @@ <h1 class="menu-title">Avendish documentation</h1>
<div id="content" class="content">
<main>
<h1 id="configuration-with-cmake"><a class="header" href="#configuration-with-cmake">Configuration with CMake</a></h1>
<p>So far, the &quot;building&quot; side of things has been left under the carpet.</p>
<p>So far, the "building" side of things has been left under the carpet.</p>
<p>It is actually not very complicated.</p>
<p>We have:</p>
<ul>
<li>A processor, <code>MyProcessor</code>.</li>
<li>A binding for which we want to build this processor, for instance a Python or VST3 binding.</li>
</ul>
<p>What CMake does is that it generates a small <code>.cpp</code> file that combines both.</p>
<p>Here is for instance how it is done for Python: </p>
<p>Here is for instance how it is done for Python:</p>
<pre><code class="language-cpp">/* SPDX-License-Identifier: GPL-3.0-or-later */

#include &lt;@AVND_MAIN_FILE@&gt;
Expand All @@ -195,9 +195,9 @@ <h1 id="configuration-with-cmake"><a class="header" href="#configuration-with-cm
static const python::processor&lt; type &gt; instance{m};
}
</code></pre>
<p>Here, <code>AVND_MAIN_FILE</code>, <code>AVND_C_NAME</code> and <code>AVND_MAIN_CLASS</code> are options that are passed to CMake.
<p>Here, <code>AVND_MAIN_FILE</code>, <code>AVND_C_NAME</code> and <code>AVND_MAIN_CLASS</code> are options that are passed to CMake.
For an actual processor though, it's likely that you would have to write your own entrypoint.</p>
<p>Here is the Clap entrypoint, which is fairly similar: </p>
<p>Here is the Clap entrypoint, which is fairly similar:</p>
<pre><code class="language-cpp">/* SPDX-License-Identifier: GPL-3.0-or-later */

#include &lt;@AVND_MAIN_FILE@&gt;
Expand Down Expand Up @@ -260,7 +260,7 @@ <h2 id="cmake-functions"><a class="header" href="#cmake-functions">CMake functio
)
</code></pre>
<h2 id="doing-it-by-hand"><a class="header" href="#doing-it-by-hand">Doing it by hand</a></h2>
<p>This is not very hard: Avendish is a header-only library, so you just have to add the <code>avendish/include</code> folder to your include path,
<p>This is not very hard: Avendish is a header-only library, so you just have to add the <code>avendish/include</code> folder to your include path,
and the <code>-std=c++20</code> flag to your build-system.</p>
<blockquote>
<p>Depending on your compiler, you may also need to add flags such as <code>-fconcepts</code> (GCC &lt;= 9) ; <code>-fcoroutines</code> (GCC &lt;= 11) ; <code>-fcoroutines-ts</code> (Clang &lt;= 14).</p>
Expand All @@ -273,8 +273,8 @@ <h2 id="doing-it-by-hand"><a class="header" href="#doing-it-by-hand">Doing it by
</blockquote>
<p>Finally, we have to wrap our class with the binding.</p>
<pre><code class="language-cpp">// Defines struct MyProcessor { ... };
#include &quot;MyProcessor.hpp&quot;
#include &quot;MyBinding.hpp&quot;
#include "MyProcessor.hpp"
#include "MyBinding.hpp"
// Set up those typedefs to provide services to plug-ins which need it
struct my_config {
using logger_type = ...;
Expand Down
14 changes: 7 additions & 7 deletions advanced/fft.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,24 +203,24 @@ <h1 id="fft-feature"><a class="header" href="#fft-feature">FFT feature</a></h1>
template &lt;halp::has_fft_1d&lt;double&gt; C&gt;
struct PeakBand
{
halp_meta(name, &quot;Peak band&quot;)
halp_meta(c_name, &quot;avnd_peak_band&quot;)
halp_meta(uuid, &quot;5610b62e-ef1f-4a34-abe0-e57816bc44c2&quot;)
halp_meta(name, "Peak band")
halp_meta(c_name, "avnd_peak_band")
halp_meta(uuid, "5610b62e-ef1f-4a34-abe0-e57816bc44c2")

struct
{
halp::audio_channel&lt;&quot;In&quot;, double&gt; audio;
halp::audio_channel&lt;"In", double&gt; audio;
} inputs;

struct
{
halp::val_port&lt;&quot;Peak&quot;, double&gt; peak;
halp::val_port&lt;&quot;Band&quot;, int&gt; band;
halp::val_port&lt;"Peak", double&gt; peak;
halp::val_port&lt;"Band", int&gt; band;
} outputs;

// Instantiate the FFT provided by the configuration.
// Syntax is a bit ugly as we are already in a template
// causing the need for the &quot;::template &quot; thing ; in C++23
// causing the need for the "::template " thing ; in C++23
// it should be possible to omit typename.
using fft_type = typename C::template fft_type&lt;double&gt;;
fft_type fft;
Expand Down
6 changes: 3 additions & 3 deletions advanced/injection.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ <h1 id="feature-injection"><a class="header" href="#feature-injection">Feature i
<p>Supported bindings: all</p>
</blockquote>
<p>Many processors may require some kind of common, cross-cutting algorithm or system for their proper operation.</p>
<p>Processors can optionally declare a template argument, which will contain the implementations of these &quot;cross-cutting concerns&quot; supported by the backend.</p>
<p>For now, there are two: </p>
<p>Processors can optionally declare a template argument, which will contain the implementations of these "cross-cutting concerns" supported by the backend.</p>
<p>For now, there are two:</p>
<ul>
<li>A logging system</li>
<li>An 1D FFT </li>
<li>An 1D FFT</li>
</ul>
<pre><code class="language-cpp">template&lt;typename Conf&gt;
// Get a compile error if the bindings cannot provide the thing.
Expand Down
26 changes: 13 additions & 13 deletions advanced/logging.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ <h1 id="logging-feature"><a class="header" href="#logging-feature">Logging featu
<blockquote>
<p>Supported bindings: all</p>
</blockquote>
<p>The API is modeled after <a href="https://github.com/gabime/spdlog">spdlog</a> and expects the <a href="https://github.com/fmtlib/fmt">fmt</a> syntax: </p>
<p>The API is modeled after <a href="https://github.com/gabime/spdlog">spdlog</a> and expects the <a href="https://github.com/fmtlib/fmt">fmt</a> syntax:</p>
<pre><code class="language-cpp">#pragma once

/* SPDX-License-Identifier: GPL-3.0-or-later */
Expand All @@ -197,17 +197,17 @@ <h1 id="logging-feature"><a class="header" href="#logging-feature">Logging featu
template &lt;typename C&gt;
requires
// Here we pass template arguments as a primitive form of dependency injection.
// Out effect is saying: &quot;I want to be passed configured with a type
// holding a &quot;logger_type&quot; typedef
// Out effect is saying: "I want to be passed configured with a type
// holding a "logger_type" typedef
// which will be something matching the logger concept.
halp::has_logger&lt;C&gt;
struct Logger
{
// halp_meta is simply a macro that expands to a consteval function.
// Hopefully C++ would use a similar syntax for reflexion.
halp_meta(name, &quot;Helpers&quot;)
halp_meta(c_name, &quot;avnd_helpers_logger&quot;)
halp_meta(uuid, &quot;3a646521-48f4-429b-a2b1-d67beb0d65cf&quot;)
halp_meta(name, "Helpers")
halp_meta(c_name, "avnd_helpers_logger")
halp_meta(uuid, "3a646521-48f4-429b-a2b1-d67beb0d65cf")

// We store our logger in the class to make things simpler.
// no_unique_address makes sure that it stays a zero-memory-cost abstraction
Expand All @@ -218,17 +218,17 @@ <h1 id="logging-feature"><a class="header" href="#logging-feature">Logging featu
// Ideally metaclasses would make that obsolete.
void example(float x)
{
logger.trace(&quot;example: {}&quot;, x);
logger.info(&quot;example: {}&quot;, x);
logger.debug(&quot;example: {}&quot;, x);
logger.warn(&quot;example: {}&quot;, x);
logger.error(&quot;example: {}&quot;, x);
logger.critical(&quot;example: {}&quot;, x);
logger.trace("example: {}", x);
logger.info("example: {}", x);
logger.debug("example: {}", x);
logger.warn("example: {}", x);
logger.error("example: {}", x);
logger.critical("example: {}", x);
}

struct
{
halp::func_ref&lt;&quot;member&quot;, &amp;Logger&lt;C&gt;::example&gt; my_message;
halp::func_ref&lt;"member", &amp;Logger&lt;C&gt;::example&gt; my_message;
} messages;
};
}
Expand Down
10 changes: 5 additions & 5 deletions advanced/port_types.codeedit.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,15 @@ <h1 id="code-editors"><a class="header" href="#code-editors">Code editors</a></h
<blockquote>
<p>Supported bindings: ossia</p>
</blockquote>
<p>For live-coding and similar purposes, it is common to embed a domain-specific programming language
<p>For live-coding and similar purposes, it is common to embed a domain-specific programming language
into a host environment: Faust, math expression languages, Javascript, Lisp, etc...</p>
<p>If one adds the <code>language</code> metadata to a string port, then the port will be recognized
as a programming language code input: hosts are encouraged to show some relevant text editor for code
<p>If one adds the <code>language</code> metadata to a string port, then the port will be recognized
as a programming language code input: hosts are encouraged to show some relevant text editor for code
instead of a simple line edit.</p>
<h2 id="example"><a class="header" href="#example">Example</a></h2>
<pre><code class="language-cpp">struct : halp::lineedit&lt;&quot;Program&quot;, &quot;&quot;&gt;
<pre><code class="language-cpp">struct : halp::lineedit&lt;"Program", ""&gt;
{
halp_meta(language, &quot;INTERCAL&quot;)
halp_meta(language, "INTERCAL")
} program;
</code></pre>
<p>should show up as a code editor with support for <a href="https://en.wikipedia.org/wiki/INTERCAL">INTERCAL</a> programs.</p>
Expand Down
62 changes: 31 additions & 31 deletions advanced/port_types.example.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,62 +197,62 @@ <h1 id="example"><a class="header" href="#example">Example</a></h1>

struct ControlGallery
{
halp_meta(name, &quot;Control gallery&quot;);
halp_meta(c_name, &quot;control_gallery&quot;);
halp_meta(category, &quot;Demo&quot;);
halp_meta(author, &quot;&lt;AUTHOR&gt;&quot;);
halp_meta(description, &quot;&lt;DESCRIPTION&gt;&quot;);
halp_meta(uuid, &quot;a9b0e2c6-61e9-45df-a75d-27abf7fb43d7&quot;);
halp_meta(name, "Control gallery");
halp_meta(c_name, "control_gallery");
halp_meta(category, "Demo");
halp_meta(author, "&lt;AUTHOR&gt;");
halp_meta(description, "&lt;DESCRIPTION&gt;");
halp_meta(uuid, "a9b0e2c6-61e9-45df-a75d-27abf7fb43d7");

struct
{
//! Buttons are level-triggers: true as long as the button is pressed
halp::accurate&lt;halp::maintained_button&lt;&quot;Press me ! (Button)&quot;&gt;&gt; button;
halp::accurate&lt;halp::maintained_button&lt;"Press me ! (Button)"&gt;&gt; button;

//! In contrast, impulses are edge-triggers: there is only a value at the moment of the click.
halp::accurate&lt;halp::impulse_button&lt;&quot;Press me ! (Impulse)&quot;&gt;&gt; impulse_button;
halp::accurate&lt;halp::impulse_button&lt;"Press me ! (Impulse)"&gt;&gt; impulse_button;

//! Common widgets
halp::accurate&lt;halp::hslider_f32&lt;&quot;Float slider&quot;, halp::range{0., 1., 0.5}&gt;&gt;
halp::accurate&lt;halp::hslider_f32&lt;"Float slider", halp::range{0., 1., 0.5}&gt;&gt;
float_slider;
halp::accurate&lt;halp::knob_f32&lt;&quot;Float knob&quot;, halp::range{0., 1., 0.5}&gt;&gt; float_knob;
halp::accurate&lt;halp::knob_f32&lt;"Float knob", halp::range{0., 1., 0.5}&gt;&gt; float_knob;
//// // FIXME
//// struct {
//// // FIXME meta_control(Control::LogFloatSlider, &quot;Float slider (log)&quot;, 0., 1., 0.5);
//// // FIXME meta_control(Control::LogFloatSlider, "Float slider (log)", 0., 1., 0.5);
//// ossia::timed_vec&lt;float&gt; values{};
//// } log_float_slider;
////

#if defined(__clang__) || defined(_MSC_VER)
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104720
halp::accurate&lt;halp::hslider_i32&lt;&quot;Int slider&quot;, halp::range{0., 1000., 10.}&gt;&gt;
halp::accurate&lt;halp::hslider_i32&lt;"Int slider", halp::range{0., 1000., 10.}&gt;&gt;
int_slider;
halp::accurate&lt;halp::spinbox_i32&lt;&quot;Int spinbox&quot;, halp::range{0, 1000, 10}&gt;&gt;
halp::accurate&lt;halp::spinbox_i32&lt;"Int spinbox", halp::range{0, 1000, 10}&gt;&gt;
int_spinbox;
#endif

//! Will look like a checkbox
halp::accurate&lt;halp::toggle&lt;&quot;Toggle&quot;, halp::toggle_setup{.init = true}&gt;&gt; toggle;
halp::accurate&lt;halp::toggle&lt;"Toggle", halp::toggle_setup{.init = true}&gt;&gt; toggle;

//! Same, but allows to choose what is displayed.
// FIXME halp::accurate&lt;halp::chooser_toggle&lt;&quot;Toggle&quot;, {&quot;Falsey&quot;, &quot;Truey&quot;}, false&gt;&gt; chooser_toggle;
// FIXME halp::accurate&lt;halp::chooser_toggle&lt;"Toggle", {"Falsey", "Truey"}, false&gt;&gt; chooser_toggle;

//! Allows to edit some text.
halp::accurate&lt;halp::lineedit&lt;&quot;Line edit&quot;, &quot;Henlo&quot;&gt;&gt; lineedit;
halp::accurate&lt;halp::lineedit&lt;"Line edit", "Henlo"&gt;&gt; lineedit;

//! First member of the pair is the text, second is the value.
//! Defining comboboxes and enumerations is a tiny bit more complicated
struct : halp::sample_accurate_values&lt;halp::combo_pair&lt;float&gt;&gt;
{
halp_meta(name, &quot;Combo box&quot;);
halp_meta(name, "Combo box");
enum widget
{
combobox
};

struct range
{
halp::combo_pair&lt;float&gt; values[3]{{&quot;Foo&quot;, -10.f}, {&quot;Bar&quot;, 5.f}, {&quot;Baz&quot;, 10.f}};
halp::combo_pair&lt;float&gt; values[3]{{"Foo", -10.f}, {"Bar", 5.f}, {"Baz", 10.f}};
int init{1}; // Bar
};

Expand All @@ -262,15 +262,15 @@ <h1 id="example"><a class="header" href="#example">Example</a></h1>
//! Here value will be the string
struct : halp::sample_accurate_values&lt;std::string_view&gt;
{
halp_meta(name, &quot;Enum 2&quot;);
halp_meta(name, "Enum 2");
enum widget
{
enumeration
};

struct range
{
std::string_view values[4]{&quot;Roses&quot;, &quot;Red&quot;, &quot;Violets&quot;, &quot;Blue&quot;};
std::string_view values[4]{"Roses", "Red", "Violets", "Blue"};
int init{1}; // Red
};

Expand All @@ -282,15 +282,15 @@ <h1 id="example"><a class="header" href="#example">Example</a></h1>
//! is below:
struct : halp::sample_accurate_values&lt;int&gt;
{
halp_meta(name, &quot;Enum 3&quot;);
halp_meta(name, "Enum 3");
enum widget
{
enumeration
};

struct range
{
std::string_view values[4]{&quot;Roses 2&quot;, &quot;Red 2&quot;, &quot;Violets 2&quot;, &quot;Blue 2&quot;};
std::string_view values[4]{"Roses 2", "Red 2", "Violets 2", "Blue 2"};
int init{1}; // Red
};

Expand All @@ -301,9 +301,9 @@ <h1 id="example"><a class="header" href="#example">Example</a></h1>
/// //! Same as Enum but won't reject strings that are not part of the list.
/// struct {
/// static const constexpr std::array&lt;const char*, 3&gt; choices() {
/// return {&quot;Square&quot;, &quot;Sine&quot;, &quot;Triangle&quot;};
/// return {"Square", "Sine", "Triangle"};
/// };
/// // FIXME meta_control(Control::UnvalidatedEnum, &quot;Unchecked enum&quot;, 1, choices());
/// // FIXME meta_control(Control::UnvalidatedEnum, "Unchecked enum", 1, choices());
/// ossia::timed_vec&lt;std::string&gt; values{};
/// } unvalidated_enumeration;

Expand All @@ -321,21 +321,21 @@ <h1 id="example"><a class="header" href="#example">Example</a></h1>
//! OSC messages can use either the int index or the string.
struct enum_t
{
halp__enum(&quot;Simple Enum&quot;, Peg, Square, Peg, Round, Hole)
halp__enum("Simple Enum", Peg, Square, Peg, Round, Hole)
};
halp::accurate&lt;enum_t&gt; simpler_enumeration;

struct combobox_t
{
halp__enum_combobox(&quot;Color&quot;, Blue, Red, Green, Teal, Blue, Black, Orange)
halp__enum_combobox("Color", Blue, Red, Green, Teal, Blue, Black, Orange)
};
halp::accurate&lt;combobox_t&gt; simpler_enumeration_in_a_combobox;

//! Crosshair XY chooser
halp::accurate&lt;halp::xy_pad_f32&lt;&quot;XY&quot;, halp::range{-5.f, 5.f, 0.f}&gt;&gt; position;
halp::accurate&lt;halp::xy_pad_f32&lt;"XY", halp::range{-5.f, 5.f, 0.f}&gt;&gt; position;

//! Color chooser. Colors are in 8-bit RGBA by default.
halp::accurate&lt;halp::color_chooser&lt;&quot;Color&quot;&gt;&gt; color;
halp::accurate&lt;halp::color_chooser&lt;"Color"&gt;&gt; color;

} inputs;

Expand All @@ -354,12 +354,12 @@ <h1 id="example"><a class="header" href="#example">Example</a></h1>
auto val = input.values.begin()-&gt;second;
if constexpr(std::is_enum_v&lt;decltype(val)&gt;) {
#if __has_include(&lt;magic_enum.hpp&gt;)
fmt::print(&quot;changed: {} {}&quot;, Control::name(), magic_enum::enum_name(val));
fmt::print("changed: {} {}", Control::name(), magic_enum::enum_name(val));
#else
fmt::print(&quot;changed: {} {}&quot;, Control::name(), static_cast&lt;std::underlying_type_t&lt;decltype(val)&gt;&gt;(val));
fmt::print("changed: {} {}", Control::name(), static_cast&lt;std::underlying_type_t&lt;decltype(val)&gt;&gt;(val));
#endif
} else {
fmt::print(&quot;changed: {} {}&quot;, Control::name(), val);
fmt::print("changed: {} {}", Control::name(), val);
}
}
});
Expand Down
Loading

0 comments on commit 4971247

Please sign in to comment.