See video: https://youtu.be/q-SA6T48ux0
Create a (just a bit more complex) graphical user interface for myPolyBlepSynth with dials, sliders, a combobox and an image surface to draw on it. Using B.Widgets.
- Start with myPolyBlepSynth
- Adapt the names and the URIs
- Export
ControlPorts
,controlLimits
, andPortGroups
to seperate .hpp files - Get the UI files from myAmp_BWidgets
- Adapt the names and the URIs, too
- Get B.Widgets from https://github.com/sjaehn/BWidgets using git:
git submodule add https://github.com/sjaehn/BWidgets.git myAmp_BWidgets/BWidgets
git submodule update --init --recursive
- Build B.Widgets
cd BWidgets
make bwidgets
- Add:
BWidgets::ComboBox
for waveformBWidgets::ValueHSlider
for attack, decay, sustain, and releaseBWidgets::ValueDial
for levelBWidgets::Image
for display- Store pointers to all controller widgets in a
std::array widgets
- Add method
drawWaveform()
- Constructor
- Initialize parent class
BWidgets::Window
- Initialize all widgets
- Add all controller widgets to
widgets
- Iterate through
widgets
andsetClickable(false)
(except forwaveform
)setFgColors()
(except forwaveform
)setCallbackfunction()
add()
createImage()
drawWaveform()
setBackground()
- Initialize parent class
portEvent()
- Get controller index from port index
- Set the controller values using
setValue()
valueChangedCallback()
- Find the event-emitting widget by iteration
- Get the controller index
getValue()
- Pass the controller value to the host using LV2
write_function()
and the respective port index
- Find the event-emitting widget by iteration
drawWaveform()
- Get access to the image surface by
getImageSurface()
- Draw to this surface using Cairo
- Update widget using
update()
- Get access to the image surface by
gcc mySPBSynth.c -fvisibility=hidden -O3 -fPIC -DPIC -shared -pthread `pkg-config --cflags lv2` -Wl,-Bstatic `pkg-config --libs --static lv2` -Wl,-Bdynamic -lm -o mySPBSynth.so
g++ -fPIC -DPIC -DPUGL_HAVE_CAIRO -fvisibility=hidden -std=c++17 -IBWidgets/include mySPBSynth_ui.cpp `pkg-config --cflags lv2 cairo x11` -c
g++ -shared -pthread -LBWidgets/build mySPBSynth_ui.o -lbwidgetscore -lcairoplus -lpugl `pkg-config --libs lv2 cairo x11` -o mySPBSynth_ui.so
- Create a new folder inside your LV2 directory
- Copy all .so, .ttl, and .png files
- And run
jalv.gtk3 https://github.com/sjaehn/lv2tutorial/mySPBSynth