Skip to content

Commit

Permalink
More documentation to find "an API" and solve the question "where is …
Browse files Browse the repository at this point in the history
…the API"
  • Loading branch information
Guillaume Piolat committed Dec 2, 2024
1 parent ab9d1e7 commit e54264c
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/clipit/source/gui.d
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ nothrow:
_clipKnob.position = rectangle(308, 101, 128, 128).scaleByFactor(S);
_outputGainKnob.position = rectangle(70, 320, 128, 128).scaleByFactor(S);
_mixKnob.position = rectangle(308, 320, 128, 128).scaleByFactor(S);

_modeSwitch.position = rectangle(380, 28, 50, 20).scaleByFactor(S);

_bassSlider.position = rectangle(208, 27, 96, 24).scaleByFactor(S);
Expand Down
20 changes: 17 additions & 3 deletions examples/clipit/source/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,23 @@ enum : int
paramBassBoost
}


/// Example mono/stereo distortion plugin.
/**
A small clipper plug-in named ClipIt!
It demonstrates:
- parameters
- I/O settings (mono or stereo)
- presets
- buffer-split
- using biquads from dplug:dsp
- resizeable UI
- use of dplug:flat-widgets
To go further:
- Examples: Distort and Template.
- FAQ: https://dplug.org/tutorials
- Inline Doc: https://dplug.dpldocs.info/dplug.html
*/
final class ClipitClient : dplug.client.Client
{
public:
Expand Down Expand Up @@ -204,6 +219,5 @@ private:

float _sampleRate;
BiquadDelay[2] _bassFilter;

}

26 changes: 23 additions & 3 deletions examples/distort/source/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import dplug.core,
import gui;
import ar;

// This define entry points for plugin formats,
// This define entry points for plugin formats,
// depending on which version identifiers are defined.
mixin(pluginEntryPoints!DistortClient);

Expand All @@ -22,7 +22,27 @@ enum : int
paramOnOff,
}

/// Example mono/stereo distortion plugin.
/**
A small distortion plug-in named Distort!
It demonstrates:
- parameters
- I/O settings (mono or stereo)
- basic presets
- latency reporting
- using biquads from dplug:dsp
- custom UI widgets and custom DSP
- drawing with `dplug:canvas` and `canvasity`
- resizeable UI
- basic DSP->UI feedback
- use of `dplug:pbr-widgets`
To go further:
- Examples: ClipIt and Template.
- FAQ: https://dplug.org/tutorials
- Inline Doc: https://dplug.dpldocs.info/dplug.html
*/

final class DistortClient : dplug.client.Client
{
public:
Expand Down Expand Up @@ -117,7 +137,7 @@ nothrow:
_outputRMS.reallocBuffer(maxFrames);

foreach(channel; 0..2)
{
{
_hpState[channel].initialize();
}
}
Expand Down
22 changes: 19 additions & 3 deletions examples/template/source/gui.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ import dplug.client;

import main;

/**
This is a barebones and empty UI with only a static image as
background.
To go further:
- Examples: Distort and ClipIt.
- FAQ: https://dplug.org/tutorials
- Inline Documentation: https://dplug.dpldocs.info/dplug.html
*/
class TemplateGUI : FlatBackgroundGUI!("blank.png")
{
public:
Expand All @@ -21,17 +30,24 @@ nothrow:
setUpdateMargin(0);

// ...
// Add widgets here with `addChild`
// Add widgets here with `addChild`.
//
// Base widgets are typically in packages dplug:flat-widgets
// and `dplug:flat_widgets`.
//
// See the examples/distort and example/clipit plug-ins for
// how to add interface elements to your plug-in.
// ...

}

override void reflow()
{
super.reflow();

// ...
// Set position of every widget here
// Set position of every widget here.
// This function is called on UI opening and resize.
// eg: _myKnob.position = rectangle(240, 170, 60, 60);
// ...
}

Expand Down
16 changes: 14 additions & 2 deletions examples/template/source/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ import gui;

mixin(pluginEntryPoints!MyClient);

/**
This is a barebones and empty plug-in that does nothing.
To go further:
- Examples: Distort and ClipIt.
- FAQ: https://dplug.org/tutorials
- Inline Doc: https://dplug.dpldocs.info/dplug.html
*/
final class MyClient : Client
{
public:
Expand All @@ -24,7 +32,11 @@ nothrow:
auto params = makeVec!Parameter();

// ...
// Add parameters here
// Add parameters here.
//
// See `dplug.client.params` module, and other examples.
// Example:
// params ~= mallocNew!BoolParameter(0, "bypass", false);
// ...

return params.releaseData();
Expand All @@ -36,7 +48,7 @@ nothrow:
int numOutputs)
{
// ...
// Add DSP initialization here
// Add DSP initialization here.
// ...
}

Expand Down

0 comments on commit e54264c

Please sign in to comment.