Skip to content

Commit c8a3661

Browse files
committed
Add web browser plugin example
Signed-off-by: falkTX <[email protected]>
1 parent ad2de42 commit c8a3661

File tree

6 files changed

+700
-1
lines changed

6 files changed

+700
-1
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ endif
1818
plugins: dgl
1919
$(MAKE) all -C plugins/ImGuiDemo
2020
$(MAKE) all -C plugins/TextEditor
21+
$(MAKE) all -C plugins/WebBrowser
2122

2223
ifneq ($(CROSS_COMPILING),true)
2324
gen: plugins dpf/utils/lv2_ttl_generator
@@ -36,6 +37,7 @@ clean:
3637
$(MAKE) clean -C dpf/utils/lv2-ttl-generator
3738
$(MAKE) clean -C plugins/ImGuiDemo
3839
$(MAKE) clean -C plugins/TextEditor
40+
$(MAKE) clean -C plugins/WebBrowser
3941
rm -rf bin build dpf-widgets/opengl/*.d dpf-widgets/opengl/*.o
4042

4143
# --------------------------------------------------------------

dpf

Lines changed: 355 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,355 @@
1+
/*
2+
* Web Browser example
3+
* Copyright (C) 2025 Filipe Coelho <[email protected]>
4+
* SPDX-License-Identifier: ISC
5+
*/
6+
7+
/**
8+
The plugin name.@n
9+
This is used to identify your plugin before a Plugin instance can be created.
10+
@note This macro is required.
11+
*/
12+
#define DISTRHO_PLUGIN_NAME "Web Browser"
13+
14+
/**
15+
Number of audio inputs the plugin has.
16+
@note This macro is required.
17+
*/
18+
#define DISTRHO_PLUGIN_NUM_INPUTS 2
19+
20+
/**
21+
Number of audio outputs the plugin has.
22+
@note This macro is required.
23+
*/
24+
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2
25+
26+
/**
27+
The plugin URI when exporting in LV2 format.
28+
@note This macro is required.
29+
*/
30+
#define DISTRHO_PLUGIN_URI "urn:distrho:examples:web-browser"
31+
32+
/**
33+
Whether the plugin has a custom %UI.
34+
@see DISTRHO_UI_USE_NANOVG
35+
@see UI
36+
*/
37+
#define DISTRHO_PLUGIN_HAS_UI 1
38+
39+
/**
40+
Whether the plugin processing is realtime-safe.@n
41+
TODO - list rtsafe requirements
42+
*/
43+
#define DISTRHO_PLUGIN_IS_RT_SAFE 1
44+
45+
/**
46+
Whether the plugin is a synth.@n
47+
@ref DISTRHO_PLUGIN_WANT_MIDI_INPUT is automatically enabled when this is too.
48+
@see DISTRHO_PLUGIN_WANT_MIDI_INPUT
49+
*/
50+
#define DISTRHO_PLUGIN_IS_SYNTH 0
51+
52+
/**
53+
Enable direct access between the %UI and plugin code.
54+
@see UI::getPluginInstancePointer()
55+
@note DO NOT USE THIS UNLESS STRICTLY NECESSARY!!
56+
Try to avoid it at all costs!
57+
*/
58+
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
59+
60+
/**
61+
Whether the plugin introduces latency during audio or midi processing.
62+
@see Plugin::setLatency(uint32_t)
63+
*/
64+
#define DISTRHO_PLUGIN_WANT_LATENCY 0
65+
66+
/**
67+
Whether the plugin wants MIDI input.@n
68+
This is automatically enabled if @ref DISTRHO_PLUGIN_IS_SYNTH is true.
69+
*/
70+
#define DISTRHO_PLUGIN_WANT_MIDI_INPUT 0
71+
72+
/**
73+
Whether the plugin wants MIDI output.
74+
@see Plugin::writeMidiEvent(const MidiEvent&)
75+
*/
76+
#define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 0
77+
78+
/**
79+
Whether the plugin wants to change its own parameter inputs.@n
80+
Not all hosts or plugin formats support this,
81+
so Plugin::canRequestParameterValueChanges() can be used to query support at runtime.
82+
@see Plugin::requestParameterValueChange(uint32_t, float)
83+
*/
84+
#define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 0
85+
86+
/**
87+
Whether the plugin provides its own internal programs.
88+
@see Plugin::initProgramName(uint32_t, String&)
89+
@see Plugin::loadProgram(uint32_t)
90+
*/
91+
#define DISTRHO_PLUGIN_WANT_PROGRAMS 0
92+
93+
/**
94+
Whether the plugin uses internal non-parameter data.
95+
@see Plugin::initState(uint32_t, String&, String&)
96+
@see Plugin::setState(const char*, const char*)
97+
*/
98+
#define DISTRHO_PLUGIN_WANT_STATE 1
99+
100+
/**
101+
Whether the plugin implements the full state API.
102+
When this macro is enabled, the plugin must implement a new getState(const char* key) function, which the host calls when saving its session/project.
103+
This is useful for plugins that have custom internal values not exposed to the host as key-value state pairs or parameters.
104+
Most simple effects and synths will not need this.
105+
@note this macro is automatically enabled if a plugin has programs and state, as the key-value state pairs need to be updated when the current program changes.
106+
@see Plugin::getState(const char*)
107+
*/
108+
#define DISTRHO_PLUGIN_WANT_FULL_STATE 0
109+
110+
/**
111+
Whether the plugin wants time position information from the host.
112+
@see Plugin::getTimePosition()
113+
*/
114+
#define DISTRHO_PLUGIN_WANT_TIMEPOS 0
115+
116+
/**
117+
Whether the %UI uses a custom toolkit implementation based on OpenGL.@n
118+
When enabled, the macros @ref DISTRHO_UI_CUSTOM_INCLUDE_PATH and @ref DISTRHO_UI_CUSTOM_WIDGET_TYPE are required.
119+
*/
120+
#define DISTRHO_UI_USE_CUSTOM 1
121+
122+
/**
123+
The include path to the header file used by the custom toolkit implementation.
124+
This path must be relative to dpf/distrho/DistrhoUI.hpp
125+
@see DISTRHO_UI_USE_CUSTOM
126+
*/
127+
#define DISTRHO_UI_CUSTOM_INCLUDE_PATH "DearImGui.hpp"
128+
129+
/**
130+
The top-level-widget typedef to use for the custom toolkit.
131+
This widget class MUST be a subclass of DGL TopLevelWindow class.
132+
It is recommended that you keep this widget class inside the DGL namespace,
133+
and define widget type as e.g. DGL_NAMESPACE::MyCustomTopLevelWidget.
134+
@see DISTRHO_UI_USE_CUSTOM
135+
*/
136+
#define DISTRHO_UI_CUSTOM_WIDGET_TYPE DGL_NAMESPACE::ImGuiTopLevelWidget
137+
138+
/**
139+
Default UI width to use when creating initial and temporary windows.@n
140+
Setting this macro allows to skip a temporary UI from being created in certain VST2 and VST3 hosts.
141+
(which would normally be done for knowing the UI size before host creates a window for it)
142+
143+
Value must match 1x scale factor.
144+
145+
When this macro is defined, the companion DISTRHO_UI_DEFAULT_HEIGHT macro must be defined as well.
146+
*/
147+
#define DISTRHO_UI_DEFAULT_WIDTH 1100
148+
149+
/**
150+
Default UI height to use when creating initial and temporary windows.@n
151+
Setting this macro allows to skip a temporary UI from being created in certain VST2 and VST3 hosts.
152+
(which would normally be done for knowing the UI size before host creates a window for it)
153+
154+
Value must match 1x scale factor.
155+
156+
When this macro is defined, the companion DISTRHO_UI_DEFAULT_WIDTH macro must be defined as well.
157+
*/
158+
#define DISTRHO_UI_DEFAULT_HEIGHT 600
159+
160+
/**
161+
Whether the %UI uses NanoVG for drawing instead of the default raw OpenGL calls.@n
162+
When enabled your %UI instance will subclass @ref NanoWidget instead of @ref Widget.
163+
*/
164+
#define DISTRHO_UI_USE_NANOVG 0
165+
166+
/**
167+
Whether the %UI is resizable to any size by the user.@n
168+
By default this is false, and resizing is only allowed under the plugin UI control,@n
169+
Enabling this options makes it possible for the user to resize the plugin UI at anytime.
170+
@see UI::setGeometryConstraints(uint, uint, bool, bool)
171+
*/
172+
#define DISTRHO_UI_USER_RESIZABLE 1
173+
174+
/**
175+
Whether to %UI is going to use file browser dialogs.@n
176+
By default this is false, with the file browser APIs not available for use.
177+
*/
178+
#define DISTRHO_UI_FILE_BROWSER 0
179+
180+
/**
181+
Whether to %UI is going to use web browser views.@n
182+
By default this is false, with the web browser APIs not available for use.
183+
*/
184+
#define DISTRHO_UI_WEB_VIEW 1
185+
186+
/**
187+
A 4-character symbol that identifies a brand or manufacturer, with at least one non-lower case character.@n
188+
Plugins from the same brand should use the same symbol.
189+
@note This macro is required when building AU plugins, and used for VST3 if present
190+
@note Setting this macro will change the uid of a VST3 plugin.
191+
If you already released a DPF-based VST3 plugin make sure to also enable DPF_VST3_DONT_USE_BRAND_ID
192+
*/
193+
#define DISTRHO_PLUGIN_BRAND_ID Dstr
194+
195+
/**
196+
A 4-character symbol which identifies a plugin.@n
197+
It must be unique within at least a set of plugins from the brand.
198+
@note This macro is required when building AU plugins
199+
*/
200+
#define DISTRHO_PLUGIN_UNIQUE_ID dWeb
201+
202+
/**
203+
Custom LV2 category for the plugin.@n
204+
This is a single string, and can be one of the following values:
205+
206+
- lv2:AllpassPlugin
207+
- lv2:AmplifierPlugin
208+
- lv2:AnalyserPlugin
209+
- lv2:BandpassPlugin
210+
- lv2:ChorusPlugin
211+
- lv2:CombPlugin
212+
- lv2:CompressorPlugin
213+
- lv2:ConstantPlugin
214+
- lv2:ConverterPlugin
215+
- lv2:DelayPlugin
216+
- lv2:DistortionPlugin
217+
- lv2:DynamicsPlugin
218+
- lv2:EQPlugin
219+
- lv2:EnvelopePlugin
220+
- lv2:ExpanderPlugin
221+
- lv2:FilterPlugin
222+
- lv2:FlangerPlugin
223+
- lv2:FunctionPlugin
224+
- lv2:GatePlugin
225+
- lv2:GeneratorPlugin
226+
- lv2:HighpassPlugin
227+
- lv2:InstrumentPlugin
228+
- lv2:LimiterPlugin
229+
- lv2:LowpassPlugin
230+
- lv2:MIDIPlugin
231+
- lv2:MixerPlugin
232+
- lv2:ModulatorPlugin
233+
- lv2:MultiEQPlugin
234+
- lv2:OscillatorPlugin
235+
- lv2:ParaEQPlugin
236+
- lv2:PhaserPlugin
237+
- lv2:PitchPlugin
238+
- lv2:ReverbPlugin
239+
- lv2:SimulatorPlugin
240+
- lv2:SpatialPlugin
241+
- lv2:SpectralPlugin
242+
- lv2:UtilityPlugin
243+
- lv2:WaveshaperPlugin
244+
245+
See http://lv2plug.in/ns/lv2core for more information.
246+
*/
247+
#define DISTRHO_PLUGIN_LV2_CATEGORY "lv2:UtilityPlugin"
248+
249+
/**
250+
Custom VST3 categories for the plugin.@n
251+
This is a single concatenated string of categories, separated by a @c |.
252+
253+
Each effect category can be one of the following values:
254+
255+
- Fx
256+
- Fx|Ambisonics
257+
- Fx|Analyzer
258+
- Fx|Delay
259+
- Fx|Distortion
260+
- Fx|Dynamics
261+
- Fx|EQ
262+
- Fx|Filter
263+
- Fx|Instrument
264+
- Fx|Instrument|External
265+
- Fx|Spatial
266+
- Fx|Generator
267+
- Fx|Mastering
268+
- Fx|Modulation
269+
- Fx|Network
270+
- Fx|Pitch Shift
271+
- Fx|Restoration
272+
- Fx|Reverb
273+
- Fx|Surround
274+
- Fx|Tools
275+
276+
Each instrument category can be one of the following values:
277+
278+
- Instrument
279+
- Instrument|Drum
280+
- Instrument|External
281+
- Instrument|Piano
282+
- Instrument|Sampler
283+
- Instrument|Synth
284+
- Instrument|Synth|Sampler
285+
286+
And extra categories possible for any plugin type:
287+
288+
- Mono
289+
- Stereo
290+
*/
291+
#define DISTRHO_PLUGIN_VST3_CATEGORIES "Fx|Tools|Stereo"
292+
293+
/**
294+
Custom CLAP features for the plugin.@n
295+
This is a list of features defined as a string array body, without the terminating @c , or nullptr.
296+
297+
A top-level category can be set as feature and be one of the following values:
298+
299+
- instrument
300+
- audio-effect
301+
- note-effect
302+
- analyzer
303+
304+
The following sub-categories can also be set:
305+
306+
- synthesizer
307+
- sampler
308+
- drum
309+
- drum-machine
310+
311+
- filter
312+
- phaser
313+
- equalizer
314+
- de-esser
315+
- phase-vocoder
316+
- granular
317+
- frequency-shifter
318+
- pitch-shifter
319+
320+
- distortion
321+
- transient-shaper
322+
- compressor
323+
- limiter
324+
325+
- flanger
326+
- chorus
327+
- delay
328+
- reverb
329+
330+
- tremolo
331+
- glitch
332+
333+
- utility
334+
- pitch-correction
335+
- restoration
336+
337+
- multi-effects
338+
339+
- mixing
340+
- mastering
341+
342+
And finally the following audio capabilities can be set:
343+
344+
- mono
345+
- stereo
346+
- surround
347+
- ambisonic
348+
*/
349+
#define DISTRHO_PLUGIN_CLAP_FEATURES "audio-effect", "stereo"
350+
351+
/**
352+
The plugin id when exporting in CLAP format, in reverse URI form.
353+
@note This macro is required when building CLAP plugins
354+
*/
355+
#define DISTRHO_PLUGIN_CLAP_ID "studio.kx.distrho.examples.web-browser"

0 commit comments

Comments
 (0)