diff --git a/INSTALL.md b/INSTALL.md index 76380f1..78824ac 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -19,41 +19,26 @@ Packagers can make use of the 'PREFIX' and 'DESTDIR' variable during install, li The required build dependencies are: (devel packages of these) - JACK - - liblo - Qt4 - - PyQt4 + - Python3 + - PyQt4 (Py3 version) -Optional but recommended: - - - FluidSynth - - LinuxSampler - -Optional for extended LV2 UIs support: - - - Gtk2 - - Gtk3 - - Suil - -On Debian and Ubuntu, use these commands to install all dependencies:
-`$ sudo apt-get install libjack-dev liblo-dev libqt4-dev libfluidsynth-dev`
+On Debian and Ubuntu, use these commands to install all build dependencies:
+`$ sudo apt-get install libjack-dev libqt4-dev`
`$ sudo apt-get install qt4-dev-tools python-qt4-dev python3-pyqt4 pyqt4-dev-tools` -NOTE: linuxsampler is not packaged in either Debian or Ubuntu, but it's available in KXStudio.
-
- To run all the apps/tools, you'll additionally need: - python3-dbus - - python3-liblo + - python3-dbus.mainloop.qt Optional but recommended: - a2jmidid - jack-capture - - python3-rdflib - - pulseaudio-module-jack + - pulseaudio[-module-jack] -The 'Cadence' and 'Catia' apps rely on jackdbus to work properly (either JACK2 or JACK1+DBus patch).
+The 'Cadence' app relies on jackdbus to work properly (either JACK2 or JACK1+DBus patch).
Claudia is a LADISH frontend, so it will obviously require LADISH to run. The python version used and tested is python3.2.
@@ -67,28 +52,39 @@ All tools require Python3 and Qt4, some of them work on Windows and Mac.
Here's the required run-time dependencies of each of the main tools: ### Cadence -Recommends a2jmidid (>= 8) and jackdbus
+Recommends a2jmidid (>= 7) and jackdbus
Suggests pulseaudio[-module-jack]

+### Cadence-JackMeter +Requires jack
+
+ +### Cadence-JackSettings +Requires jackdbus
+
+ +### Cadence-Logs +No special requirements
+
+ +### Cadence-Render +Requires jack-capture
+
+ +### Cadence-XY Controller +Requires jack
+
+ ### Catarina No special requirements

### Catia -Recommends a2jmidid (>= 8) and jackdbus
+Recommends a2jmidid (>= 7) and jackdbus

### Claudia [Linux only]
Requires jackdbus and ladish
Recommends a2jmidid

- -### Carla -Requires liblo
-Recommends python3-rdflib (for LADSPA-RDF support)
-
- -### Carla-Control -Requires python3-liblo
-
diff --git a/Makefile b/Makefile index 31dcebd..6ad31f8 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ all: UI RES CPP # ------------------------------------------------------------------------------------------------------------------------------------------------------ -UI: cadence catarina catia claudia carla tools +UI: cadence catarina catia claudia tools cadence: src/ui_cadence.py \ src/ui_cadence_tb_jack.py src/ui_cadence_tb_alsa.py src/ui_cadence_tb_a2j.py src/ui_cadence_tb_pa.py \ @@ -42,132 +42,126 @@ claudia: src/ui_claudia.py \ src/ui_claudia_createroom.py src/ui_claudia_projectname.py src/ui_claudia_projectproperties.py \ src/ui_claudia_runcustom.py src/ui_claudia_launcher.py src/ui_claudia_launcher_app.py -carla: src/ui_carla.py src/ui_carla_control.py \ - src/ui_carla_about.py src/ui_carla_database.py src/ui_carla_edit.py src/ui_carla_parameter.py src/ui_carla_plugin.py src/ui_carla_refresh.py \ - src/ui_inputdialog_value.py - -caitlyn: src/ui_caitlyn.py - tools: \ src/ui_logs.py src/ui_render.py \ src/ui_settings_app.py src/ui_settings_jack.py -src/ui_cadence.py: resources/ui/cadence.ui - $(PYUIC) $< -o $@ - -src/ui_cadence_tb_jack.py: resources/ui/cadence_tb_jack.ui - $(PYUIC) $< -o $@ - -src/ui_cadence_tb_alsa.py: resources/ui/cadence_tb_alsa.ui - $(PYUIC) $< -o $@ - -src/ui_cadence_tb_a2j.py: resources/ui/cadence_tb_a2j.ui - $(PYUIC) $< -o $@ - -src/ui_cadence_tb_pa.py: resources/ui/cadence_tb_pa.ui - $(PYUIC) $< -o $@ - -src/ui_cadence_rwait.py: resources/ui/cadence_rwait.ui - $(PYUIC) $< -o $@ - -src/ui_catarina.py: resources/ui/catarina.ui - $(PYUIC) $< -o $@ - -src/ui_catarina_addgroup.py: resources/ui/catarina_addgroup.ui - $(PYUIC) $< -o $@ - -src/ui_catarina_removegroup.py: resources/ui/catarina_removegroup.ui - $(PYUIC) $< -o $@ - -src/ui_catarina_renamegroup.py: resources/ui/catarina_renamegroup.ui - $(PYUIC) $< -o $@ - -src/ui_catarina_addport.py: resources/ui/catarina_addport.ui - $(PYUIC) $< -o $@ - -src/ui_catarina_removeport.py: resources/ui/catarina_removeport.ui - $(PYUIC) $< -o $@ - -src/ui_catarina_renameport.py: resources/ui/catarina_renameport.ui - $(PYUIC) $< -o $@ - -src/ui_catarina_connectports.py: resources/ui/catarina_connectports.ui - $(PYUIC) $< -o $@ - -src/ui_catarina_disconnectports.py: resources/ui/catarina_disconnectports.ui - $(PYUIC) $< -o $@ - -src/ui_catia.py: resources/ui/catia.ui - $(PYUIC) $< -o $@ - -src/ui_claudia.py: resources/ui/claudia.ui - $(PYUIC) $< -o $@ - -src/ui_claudia_studioname.py: resources/ui/claudia_studioname.ui - $(PYUIC) $< -o $@ - -src/ui_claudia_studiolist.py: resources/ui/claudia_studiolist.ui - $(PYUIC) $< -o $@ - -src/ui_claudia_createroom.py: resources/ui/claudia_createroom.ui - $(PYUIC) $< -o $@ - -src/ui_claudia_projectname.py: resources/ui/claudia_projectname.ui - $(PYUIC) $< -o $@ - -src/ui_claudia_projectproperties.py: resources/ui/claudia_projectproperties.ui - $(PYUIC) $< -o $@ - -src/ui_claudia_runcustom.py: resources/ui/claudia_runcustom.ui - $(PYUIC) $< -o $@ - -src/ui_claudia_launcher.py: resources/ui/claudia_launcher.ui - $(PYUIC) $< -o $@ - -src/ui_claudia_launcher_app.py: resources/ui/claudia_launcher_app.ui - $(PYUIC) $< -o $@ - -src/ui_caitlyn.py: resources/ui/caitlyn.ui - $(PYUIC) $< -o $@ - -src/ui_carla.py: resources/ui/carla.ui - $(PYUIC) $< -o $@ - -src/ui_carla_control.py: resources/ui/carla_control.ui - $(PYUIC) $< -o $@ - -src/ui_carla_about.py: resources/ui/carla_about.ui - $(PYUIC) $< -o $@ - -src/ui_carla_database.py: resources/ui/carla_database.ui - $(PYUIC) $< -o $@ - -src/ui_carla_edit.py: resources/ui/carla_edit.ui - $(PYUIC) $< -o $@ - -src/ui_carla_parameter.py: resources/ui/carla_parameter.ui - $(PYUIC) $< -o $@ - -src/ui_carla_plugin.py: resources/ui/carla_plugin.ui - $(PYUIC) $< -o $@ - -src/ui_carla_refresh.py: resources/ui/carla_refresh.ui - $(PYUIC) $< -o $@ - -src/ui_logs.py: resources/ui/logs.ui - $(PYUIC) $< -o $@ - -src/ui_render.py: resources/ui/render.ui - $(PYUIC) $< -o $@ - -src/ui_settings_app.py: resources/ui/settings_app.ui - $(PYUIC) $< -o $@ - -src/ui_settings_jack.py: resources/ui/settings_jack.ui - $(PYUIC) $< -o $@ - -src/ui_inputdialog_value.py: resources/ui/inputdialog_value.ui - $(PYUIC) $< -o $@ +src/ui_%.py: resources/ui/%.ui + $(PYUIC) $< -o $@ +# +# src/ui_cadence_tb_jack.py: resources/ui/cadence_tb_jack.ui +# $(PYUIC) $< -o $@ +# +# src/ui_cadence_tb_alsa.py: resources/ui/cadence_tb_alsa.ui +# $(PYUIC) $< -o $@ +# +# src/ui_cadence_tb_a2j.py: resources/ui/cadence_tb_a2j.ui +# $(PYUIC) $< -o $@ +# +# src/ui_cadence_tb_pa.py: resources/ui/cadence_tb_pa.ui +# $(PYUIC) $< -o $@ +# +# src/ui_cadence_rwait.py: resources/ui/cadence_rwait.ui +# $(PYUIC) $< -o $@ +# +# src/ui_catarina.py: resources/ui/catarina.ui +# $(PYUIC) $< -o $@ +# +# src/ui_catarina_addgroup.py: resources/ui/catarina_addgroup.ui +# $(PYUIC) $< -o $@ +# +# src/ui_catarina_removegroup.py: resources/ui/catarina_removegroup.ui +# $(PYUIC) $< -o $@ +# +# src/ui_catarina_renamegroup.py: resources/ui/catarina_renamegroup.ui +# $(PYUIC) $< -o $@ +# +# src/ui_catarina_addport.py: resources/ui/catarina_addport.ui +# $(PYUIC) $< -o $@ +# +# src/ui_catarina_removeport.py: resources/ui/catarina_removeport.ui +# $(PYUIC) $< -o $@ +# +# src/ui_catarina_renameport.py: resources/ui/catarina_renameport.ui +# $(PYUIC) $< -o $@ +# +# src/ui_catarina_connectports.py: resources/ui/catarina_connectports.ui +# $(PYUIC) $< -o $@ +# +# src/ui_catarina_disconnectports.py: resources/ui/catarina_disconnectports.ui +# $(PYUIC) $< -o $@ +# +# src/ui_catia.py: resources/ui/catia.ui +# $(PYUIC) $< -o $@ +# +# src/ui_claudia.py: resources/ui/claudia.ui +# $(PYUIC) $< -o $@ +# +# src/ui_claudia_studioname.py: resources/ui/claudia_studioname.ui +# $(PYUIC) $< -o $@ +# +# src/ui_claudia_studiolist.py: resources/ui/claudia_studiolist.ui +# $(PYUIC) $< -o $@ +# +# src/ui_claudia_createroom.py: resources/ui/claudia_createroom.ui +# $(PYUIC) $< -o $@ +# +# src/ui_claudia_projectname.py: resources/ui/claudia_projectname.ui +# $(PYUIC) $< -o $@ +# +# src/ui_claudia_projectproperties.py: resources/ui/claudia_projectproperties.ui +# $(PYUIC) $< -o $@ +# +# src/ui_claudia_runcustom.py: resources/ui/claudia_runcustom.ui +# $(PYUIC) $< -o $@ +# +# src/ui_claudia_launcher.py: resources/ui/claudia_launcher.ui +# $(PYUIC) $< -o $@ +# +# src/ui_claudia_launcher_app.py: resources/ui/claudia_launcher_app.ui +# $(PYUIC) $< -o $@ +# +# src/ui_caitlyn.py: resources/ui/caitlyn.ui +# $(PYUIC) $< -o $@ +# +# src/ui_carla.py: resources/ui/carla.ui +# $(PYUIC) $< -o $@ +# +# src/ui_carla_control.py: resources/ui/carla_control.ui +# $(PYUIC) $< -o $@ +# +# src/ui_carla_about.py: resources/ui/carla_about.ui +# $(PYUIC) $< -o $@ +# +# src/ui_carla_database.py: resources/ui/carla_database.ui +# $(PYUIC) $< -o $@ +# +# src/ui_carla_edit.py: resources/ui/carla_edit.ui +# $(PYUIC) $< -o $@ +# +# src/ui_carla_parameter.py: resources/ui/carla_parameter.ui +# $(PYUIC) $< -o $@ +# +# src/ui_carla_plugin.py: resources/ui/carla_plugin.ui +# $(PYUIC) $< -o $@ +# +# src/ui_carla_refresh.py: resources/ui/carla_refresh.ui +# $(PYUIC) $< -o $@ +# +# src/ui_logs.py: resources/ui/logs.ui +# $(PYUIC) $< -o $@ +# +# src/ui_render.py: resources/ui/render.ui +# $(PYUIC) $< -o $@ +# +# src/ui_settings_app.py: resources/ui/settings_app.ui +# $(PYUIC) $< -o $@ +# +# src/ui_settings_jack.py: resources/ui/settings_jack.ui +# $(PYUIC) $< -o $@ +# +# src/ui_inputdialog_value.py: resources/ui/inputdialog_value.ui +# $(PYUIC) $< -o $@ # ------------------------------------------------------------------------------------------------------------------------------------------------------ @@ -178,34 +172,7 @@ src/resources_rc.py: resources/resources.qrc # ------------------------------------------------------------------------------------------------------------------------------------------------------ -CPP: caitlib carla-backend carla-bridge carla-discovery jackmeter xycontroller - -caitlib: - $(MAKE) -C c++/caitlib - -carla-backend: carla-engine carla-native carla-plugin - $(MAKE) -C c++/carla-backend - -carla-bridge: - $(MAKE) -C c++/carla-bridge - -carla-discovery: - $(MAKE) -C c++/carla-discovery NATIVE=1 - -carla-engine: - $(MAKE) -C c++/carla-engine - -carla-lilv: - $(MAKE) -C c++/carla-lilv - -carla-native: - $(MAKE) -C c++/carla-native - -carla-plugin: - $(MAKE) -C c++/carla-plugin - -carla-rtmempool: - $(MAKE) -C c++/carla-rtmempool +CPP: jackmeter xycontroller jackmeter: $(MAKE) -C c++/jackmeter @@ -218,62 +185,16 @@ xycontroller: debug: $(MAKE) DEBUG=true -doxygen: - $(MAKE) doxygen -C c++/caitlib - $(MAKE) doxygen -C c++/carla-backend - $(MAKE) doxygen -C c++/carla-bridge - $(MAKE) doxygen -C c++/carla-engine - $(MAKE) doxygen -C c++/carla-native - $(MAKE) doxygen -C c++/carla-plugin - -# ------------------------------------------------------------------------------------------------------------------------------------------------------ - -posix32: - $(MAKE) -C c++/carla-bridge posix32 - $(MAKE) -C c++/carla-discovery posix32 - -posix64: - $(MAKE) -C c++/carla-bridge posix64 - $(MAKE) -C c++/carla-discovery posix64 - -win32: - $(MAKE) -C c++/carla-bridge win32 - $(MAKE) -C c++/carla-discovery win32 - -win64: - $(MAKE) -C c++/carla-bridge win64 - $(MAKE) -C c++/carla-discovery win64 - -wine32: - $(MAKE) -C c++/carla-jackbridge wine32 - cp c++/carla-jackbridge/libcarla-jackbridge-win32.dll.so c++/carla-bridge/libcarla-jackbridge-win32.dll - -wine64: - $(MAKE) -C c++/carla-jackbridge wine64 - cp c++/carla-jackbridge/libcarla-jackbridge-win64.dll.so c++/carla-bridge/libcarla-jackbridge-win64.dll - # ------------------------------------------------------------------------------------------------------------------------------------------------------ clean: - $(MAKE) clean -C c++/caitlib - $(MAKE) clean -C c++/carla-backend - $(MAKE) clean -C c++/carla-bridge - $(MAKE) clean -C c++/carla-discovery - $(MAKE) clean -C c++/carla-engine - $(MAKE) clean -C c++/carla-jackbridge - $(MAKE) clean -C c++/carla-lilv - $(MAKE) clean -C c++/carla-native - $(MAKE) clean -C c++/carla-plugin - $(MAKE) clean -C c++/carla-rtmempool $(MAKE) clean -C c++/jackmeter $(MAKE) clean -C c++/xycontroller rm -f *~ src/*~ src/*.pyc src/ui_*.py src/resources_rc.py - rm -rf c++/*/doxygen install: # Create directories install -d $(DESTDIR)$(PREFIX)/bin/ - install -d $(DESTDIR)$(PREFIX)/lib/cadence/ install -d $(DESTDIR)$(PREFIX)/share/applications/ install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/ install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/ @@ -300,14 +221,9 @@ install: data/catia \ data/claudia \ data/claudia-launcher \ - data/carla \ - data/carla-control \ - data/carla-standalone \ - data/caitlyn \ c++/jackmeter/cadence-jackmeter \ c++/xycontroller/cadence-xycontroller \ $(DESTDIR)$(PREFIX)/bin/ -# data/cadence-cpufreq # Install desktop files install -m 644 data/*.desktop $(DESTDIR)$(PREFIX)/share/applications/ @@ -318,8 +234,6 @@ install: install -m 644 resources/16x16/catia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/ install -m 644 resources/16x16/claudia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/ install -m 644 resources/16x16/claudia-launcher.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/ - install -m 644 resources/16x16/carla.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/ - install -m 644 resources/16x16/carla-control.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/ # Install icons, 48x48 install -m 644 resources/48x48/cadence.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/ @@ -327,8 +241,6 @@ install: install -m 644 resources/48x48/catia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/ install -m 644 resources/48x48/claudia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/ install -m 644 resources/48x48/claudia-launcher.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/ - install -m 644 resources/48x48/carla.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/ - install -m 644 resources/48x48/carla-control.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/ # Install icons, 128x128 install -m 644 resources/128x128/cadence.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/ @@ -336,8 +248,6 @@ install: install -m 644 resources/128x128/catia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/ install -m 644 resources/128x128/claudia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/ install -m 644 resources/128x128/claudia-launcher.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/ - install -m 644 resources/128x128/carla.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/ - install -m 644 resources/128x128/carla-control.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/ # Install icons, 256x256 install -m 644 resources/256x256/cadence.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/ @@ -345,8 +255,6 @@ install: install -m 644 resources/256x256/catia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/ install -m 644 resources/256x256/claudia.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/ install -m 644 resources/256x256/claudia-launcher.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/ - install -m 644 resources/256x256/carla.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/ - install -m 644 resources/256x256/carla-control.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/ # Install icons, scalable install -m 644 resources/scalable/cadence.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/ @@ -354,19 +262,10 @@ install: install -m 644 resources/scalable/catia.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/ install -m 644 resources/scalable/claudia.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/ install -m 644 resources/scalable/claudia-launcher.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/ - install -m 644 resources/scalable/carla.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/ - install -m 644 resources/scalable/carla-control.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/ # Install main code install -m 755 src/*.py $(DESTDIR)$(PREFIX)/share/cadence/src/ - install -m 755 \ - c++/caitlib/*.so \ - c++/carla-backend/*.so \ - c++/carla-bridge/carla-bridge-* \ - c++/carla-discovery/carla-discovery-* \ - $(DESTDIR)$(PREFIX)/lib/cadence/ - # Install addtional stuff for Cadence install -m 644 data/pulse2jack/* $(DESTDIR)$(PREFIX)/share/cadence/pulse2jack/ install -m 644 data/70cadence-plugin-paths $(X11_RC_DIR) @@ -389,47 +288,30 @@ install: $(DESTDIR)$(PREFIX)/bin/catia \ $(DESTDIR)$(PREFIX)/bin/claudia \ $(DESTDIR)$(PREFIX)/bin/claudia-launcher \ - $(DESTDIR)$(PREFIX)/bin/carla \ - $(DESTDIR)$(PREFIX)/bin/carla-control \ - $(DESTDIR)$(PREFIX)/bin/carla-standalone \ $(DESTDIR)$(PREFIX)/bin/caitlyn \ $(X11_RC_DIR)/70cadence-plugin-paths \ $(X11_RC_DIR)/99cadence-session-start -# $(DESTDIR)$(PREFIX)/bin/cadence-cpufreq - - # Remove unfinished - rm $(DESTDIR)$(PREFIX)/bin/caitlyn - rm $(DESTDIR)$(PREFIX)/share/applications/caitlyn.desktop uninstall: rm -f $(DESTDIR)$(PREFIX)/bin/cadence* rm -f $(DESTDIR)$(PREFIX)/bin/catarina rm -f $(DESTDIR)$(PREFIX)/bin/catia rm -f $(DESTDIR)$(PREFIX)/bin/claudia* - rm -f $(DESTDIR)$(PREFIX)/bin/carla* rm -f $(DESTDIR)$(PREFIX)/share/applications/cadence.desktop rm -f $(DESTDIR)$(PREFIX)/share/applications/catarina.desktop rm -f $(DESTDIR)$(PREFIX)/share/applications/catia.desktop rm -f $(DESTDIR)$(PREFIX)/share/applications/claudia.desktop rm -f $(DESTDIR)$(PREFIX)/share/applications/claudia-launcher.desktop - rm -f $(DESTDIR)$(PREFIX)/share/applications/carla.desktop - rm -f $(DESTDIR)$(PREFIX)/share/applications/carla-control.desktop - rm -f $(DESTDIR)$(PREFIX)/share/applications/caitlyn.desktop rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/cadence.png rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/catarina.png rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/catia.png rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/claudia.png rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/claudia-launcher.png - rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/carla.png - rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/*/apps/carla-control.png rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/cadence.svg rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/catarina.svg rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/catia.svg rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/claudia.svg rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/claudia-launcher.svg - rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/carla.svg - rm -f $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/carla-control.svg rm -f $(X11_RC_DIR)/70cadence-plugin-paths rm -f $(X11_RC_DIR)/99cadence-session-start - rm -rf $(DESTDIR)$(PREFIX)/lib/cadence/ rm -rf $(DESTDIR)$(PREFIX)/share/cadence/ diff --git a/README.md b/README.md index dbdd723..c774769 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ The tools share the same base source code, so most of them look quite similar (w Also, lots of custom widgets were coded when needed (like pixmapdial, pixmapkeyboard, patchcanvas and systray).
They can be re-used in other projects. Contact the author if you need help on that. -Note that the main focus goes to JACK2 (or JACK1+DBus); JACK1 (raw) may not work properly at this point. - ===== DESCRIPTIONS ===== ------------------------ @@ -57,13 +55,3 @@ A multimedia application launcher with LADISH support.
It searches for installed packages (not binaries), and displays the respective content as a launcher.
The content is got through an hardcoded database, created and/or modified to suit the target distribution.
Currently supports Debian and ArchLinux based distros. - -### [Carla](http://kxstudio.sourceforge.net/KXStudio:Applications:Carla) -Multi-plugin host for JACK.
-It has some nice features like automation of parameters via MIDI CCs (and send control outputs back to MIDI too) and full OSC control.
-Currently supports LADSPA (including LRDF), DSSI, LV2, and VST plugin formats, with additional GIG, SF2 and SFZ file support via FluidSynth and LinuxSampler. - -### [Carla-Control](http://kxstudio.sourceforge.net/KXStudio:Applications:Carla-Control) -An OSC Control GUI for Carla (you get the OSC address from the Carla's about dialog, and connect to it).
-Supports controlling main UI components (Dry/Wet, Volume and Balance), and all plugins parameters.
-Peak values and control outputs are displayed as well. diff --git a/c++/Makefile.mk b/c++/Makefile.mk index 40b81c1..4d7def9 100644 --- a/c++/Makefile.mk +++ b/c++/Makefile.mk @@ -26,9 +26,6 @@ BASE_FLAGS = -O2 -ffast-math -mtune=generic -msse -mfpmath=sse -Wall -Wextra BASE_FLAGS += -DNDEBUG endif -32BIT_FLAGS = -m32 -64BIT_FLAGS = -m64 - BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 $(CFLAGS) BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) LINK_FLAGS = $(LDFLAGS) @@ -37,40 +34,9 @@ ifneq ($(DEBUG),true) BUILD_CXX_FLAGS += -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT endif -# -------------------------------------------------------------- -# Modify to enable/disable specific features - -# Support for LADSPA, DSSI, LV2 and VST plugins -CARLA_PLUGIN_SUPPORT = true - -# Support for GIG, SF2 and SFZ sample banks (through fluidsynth and linuxsampler) -CARLA_SAMPLERS_SUPPORT = true - -# Support for Native Audio (ALSA and/or PulseAudio in Linux) -CARLA_RTAUDIO_SUPPORT = true - -# Comment this line to not use vestige header -BUILD_CXX_FLAGS += -DVESTIGE_HEADER - # -------------------------------------------------------------- -HAVE_QT5 = $(shell pkg-config --atleast-version 5 QtCore && echo true) - -HAVE_JACK = $(shell pkg-config --exists jack && echo true) -# HAVE_JACKSESSION = $(shell pkg-config --atleast-version=0.121.0 jack && echo true) - -ifeq ($(CARLA_PLUGIN_SUPPORT),true) -HAVE_SUIL = $(shell pkg-config --exists suil-0 && echo true) -endif - -ifeq ($(CARLA_SAMPLERS_SUPPORT),true) -HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true) -HAVE_LINUXSAMPLER = $(shell pkg-config --exists linuxsampler && echo true) -endif - -ifeq ($(CARLA_RTAUDIO_SUPPORT),true) -HAVE_ALSA = $(shell pkg-config --exists alsa && echo true) -HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true) -endif +HAVE_QT5 = $(shell pkg-config --atleast-version 5 QtCore && echo true) -HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml && echo true) +# Currently broken +# HAVE_JACKSESSION = $(shell pkg-config --atleast-version=0.121.0 jack && echo true) diff --git a/c++/caitlib/Makefile b/c++/caitlib/Makefile deleted file mode 100644 index f0efd21..0000000 --- a/c++/caitlib/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/make -f -# Makefile for caitlib # -# ----------------------------- # -# Created by falkTX -# - -include ../Makefile.mk - -BUILD_C_FLAGS += -D_GNU_SOURCE -I. -BUILD_C_FLAGS += -fvisibility=hidden -fPIC -std=gnu99 -Werror -BUILD_C_FLAGS += $(shell pkg-config --cflags jack) - -LINK_FLAGS += -fPIC -shared -lm -lpthread -LINK_FLAGS += $(shell pkg-config --libs jack) - -OBJS = \ - caitlib.o \ - memory_atomic.o \ - -# -------------------------------------------------------------- - -all: caitlib.so - -caitlib.so: $(OBJS) - $(CC) $^ $(LINK_FLAGS) -o $@ && $(STRIP) $@ - -doxygen: caitlib.doxygen - doxygen $< - -# -------------------------------------------------------------- - -.c.o: - $(CC) -c $< $(BUILD_C_FLAGS) -o $@ - -clean: - rm -f $(OBJS) *.so *.dll diff --git a/c++/caitlib/caitlib.c b/c++/caitlib/caitlib.c deleted file mode 100644 index b12d1aa..0000000 --- a/c++/caitlib/caitlib.c +++ /dev/null @@ -1,697 +0,0 @@ -/* - * Caitlib - * Copyright (C) 2007 Nedko Arnaudov - * Copyright (C) 2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "caitlib.h" -#include "list.h" -#include "memory_atomic.h" - -#define MAX_EVENT_DATA_SIZE 100 -#define MIN_PREALLOCATED_EVENT_COUNT 100 -#define MAX_PREALLOCATED_EVENT_COUNT 1000 - -//#define USE_LIST_HEAD_OUTS // incomplete - -// ------------------------------------------------------------------------------------------ - -typedef struct list_head ListHead; -typedef pthread_mutex_t Mutex; - -typedef struct _RawMidiEvent { - ListHead siblings; - - jack_midi_data_t data[MAX_EVENT_DATA_SIZE]; - size_t dataSize; - jack_nframes_t time; - double value; // used for special events -} RawMidiEvent; - -typedef struct _CaitlibOutPort { -#ifdef USE_LIST_HEAD_OUTS - ListHead siblings; -#endif - uint32_t id; - ListHead queue; - jack_port_t* port; -} CaitlibOutPort; - -typedef struct _CaitlibInstance { - bool doProcess, wantEvents; - - jack_client_t* client; - jack_port_t* midiIn; - -#ifdef USE_LIST_HEAD_OUTS - ListHead outPorts; -#else - uint32_t midiOutCount; - CaitlibOutPort** midiOuts; -#endif - - ListHead inQueue; - ListHead inQueuePendingRT; - Mutex mutex; - - rtsafe_memory_pool_handle mempool; -} CaitlibInstance; - -// ------------------------------------------------------------------------------------------ - -#define handlePtr ((CaitlibInstance*)ptr) - -static -int jack_process(jack_nframes_t nframes, void* ptr) -{ - if (! handlePtr->doProcess) - return 0; - - void* portBuffer; - RawMidiEvent* eventPtr; - - jack_position_t transportPos; - jack_transport_state_t transportState = jack_transport_query(handlePtr->client, &transportPos); - - if (transportPos.unique_1 != transportPos.unique_2) - transportPos.frame = 0; - - // MIDI In - if (handlePtr->wantEvents) - { - jack_midi_event_t inEvent; - jack_nframes_t inEventCount; - - portBuffer = jack_port_get_buffer(handlePtr->midiIn, nframes); - inEventCount = jack_midi_get_event_count(portBuffer); - - for (jack_nframes_t i = 0 ; i < inEventCount; i++) - { - if (jack_midi_event_get(&inEvent, portBuffer, i) != 0) - break; - - if (inEvent.size > MAX_EVENT_DATA_SIZE) - continue; - - /* allocate memory for buffer copy */ - eventPtr = rtsafe_memory_pool_allocate(handlePtr->mempool); - if (eventPtr == NULL) - { - //LOG_ERROR("Ignored midi event with size %u because memory allocation failed.", (unsigned int)inEvent.size); - continue; - } - - /* copy buffer data */ - memcpy(eventPtr->data, inEvent.buffer, inEvent.size); - eventPtr->dataSize = inEvent.size; - eventPtr->time = transportPos.frame + inEvent.time; - - /* Add event buffer to inQueuePendingRT list */ - list_add(&eventPtr->siblings, &handlePtr->inQueuePendingRT); - } - } - - if (pthread_mutex_trylock(&handlePtr->mutex) != 0) - return 0; - - if (handlePtr->wantEvents) - list_splice_init(&handlePtr->inQueuePendingRT, &handlePtr->inQueue); - -#ifdef USE_LIST_HEAD_OUTS - if (transportState == JackTransportRolling) - { - } -#else - // MIDI Out - if (transportState == JackTransportRolling && handlePtr->midiOutCount > 0) - { - ListHead* entryPtr; - CaitlibOutPort* outPortPtr; - - for (uint32_t i = 0; i < handlePtr->midiOutCount; i++) - { - outPortPtr = handlePtr->midiOuts[i]; - portBuffer = jack_port_get_buffer(outPortPtr->port, nframes); - jack_midi_clear_buffer(portBuffer); - - list_for_each(entryPtr, &outPortPtr->queue) - { - eventPtr = list_entry(entryPtr, RawMidiEvent, siblings); - - if (transportPos.frame > eventPtr->time || transportPos.frame + nframes <= eventPtr->time) - continue; - - if (jack_midi_event_write(portBuffer, eventPtr->time - transportPos.frame, eventPtr->data, eventPtr->dataSize) != 0) - break; - } - } - } -#endif - - pthread_mutex_unlock(&handlePtr->mutex); - - return 0; -} - -#undef handlePtr - -// ------------------------------------------------------------------------------------------ -// Initialization - -CaitlibHandle caitlib_init(const char* instanceName) -{ - CaitlibInstance* handlePtr = (CaitlibInstance*)malloc(sizeof(CaitlibInstance)); - - if (handlePtr == NULL) - goto fail; - - handlePtr->doProcess = true; - handlePtr->wantEvents = false; - -#ifdef USE_LIST_HEAD_OUTS - INIT_LIST_HEAD(&handlePtr->outPorts); -#else - handlePtr->midiOuts = NULL; - handlePtr->midiOutCount = 0; -#endif - - INIT_LIST_HEAD(&handlePtr->inQueue); - INIT_LIST_HEAD(&handlePtr->inQueuePendingRT); - - if (! rtsafe_memory_pool_create(sizeof(RawMidiEvent), MIN_PREALLOCATED_EVENT_COUNT, MAX_PREALLOCATED_EVENT_COUNT, &handlePtr->mempool)) - goto fail_free; - - pthread_mutex_init(&handlePtr->mutex, NULL); - - handlePtr->client = jack_client_open(instanceName, JackNullOption, 0); - - if (handlePtr->client == NULL) - goto fail_destroyMutex; - - handlePtr->midiIn = jack_port_register(handlePtr->client, "midi-in", JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); - - if (handlePtr->midiIn == NULL) - goto fail_closeJack; - - if (jack_set_process_callback(handlePtr->client, jack_process, handlePtr) != 0) - goto fail_closeJack; - - if (jack_activate(handlePtr->client) != 0) - goto fail_closeJack; - - return handlePtr; - -fail_closeJack: - jack_client_close(handlePtr->client); - -fail_destroyMutex: - pthread_mutex_destroy(&handlePtr->mutex); - -//fail_destroy_pool: - rtsafe_memory_pool_destroy(handlePtr->mempool); - -fail_free: - free(handlePtr); - -fail: - return NULL; -} - -#define handlePtr ((CaitlibInstance*)handle) - -void caitlib_close(CaitlibHandle handle) -{ - // wait for jack processing to end - handlePtr->doProcess = false; - pthread_mutex_lock(&handlePtr->mutex); - - if (handlePtr->client) - { -#ifdef USE_LIST_HEAD_OUTS - ListHead* entryPtr; - CaitlibOutPort* outPortPtr; -#endif - - jack_deactivate(handlePtr->client); - jack_port_unregister(handlePtr->client, handlePtr->midiIn); - -#ifdef USE_LIST_HEAD_OUTS - list_for_each(entryPtr, &handlePtr->outPorts) - { - outPortPtr = list_entry(entryPtr, CaitlibOutPort, siblings); - jack_port_unregister(handlePtr->client, outPortPtr->port); - } -#else - for (uint32_t i = 0; i < handlePtr->midiOutCount; i++) - { - jack_port_unregister(handlePtr->client, handlePtr->midiOuts[i]->port); - free(handlePtr->midiOuts[i]); - } -#endif - - jack_client_close(handlePtr->client); - } - - pthread_mutex_unlock(&handlePtr->mutex); - pthread_mutex_destroy(&handlePtr->mutex); - - rtsafe_memory_pool_destroy(handlePtr->mempool); - - free(handlePtr); -} - -uint32_t caitlib_create_port(CaitlibHandle handle, const char* portName) -{ - uint32_t nextId = 0; - - // wait for jack processing to end - handlePtr->doProcess = false; - pthread_mutex_lock(&handlePtr->mutex); - - // re-allocate pointers (midiOutCount + 1) and find next available ID - { -#ifdef USE_LIST_HEAD_OUTS - ListHead* entryPtr; - CaitlibOutPort* outPortPtr; - - list_for_each(entryPtr, &handlePtr->outPorts) - { - outPortPtr = list_entry(entryPtr, CaitlibOutPort, siblings); - - if (outPortPtr->id == nextId) - { - nextId++; - continue; - } - } -#else - CaitlibOutPort* oldMidiOuts[handlePtr->midiOutCount]; - - for (uint32_t i = 0; i < handlePtr->midiOutCount; i++) - { - oldMidiOuts[i] = handlePtr->midiOuts[i]; - - if (handlePtr->midiOuts[i]->id == nextId) - nextId++; - } - - if (handlePtr->midiOuts) - free(handlePtr->midiOuts); - - handlePtr->midiOuts = (CaitlibOutPort**)malloc(sizeof(CaitlibOutPort*) * (handlePtr->midiOutCount+1)); - - for (uint32_t i = 0; i < handlePtr->midiOutCount; i++) - handlePtr->midiOuts[i] = oldMidiOuts[i]; -#endif - } - - // we can continue normal operation now - pthread_mutex_unlock(&handlePtr->mutex); - handlePtr->doProcess = true; - -#ifdef USE_LIST_HEAD_OUTS -#else - // create new port - { - CaitlibOutPort* newPort = (CaitlibOutPort*)malloc(sizeof(CaitlibOutPort)); - - newPort->id = nextId; - newPort->port = jack_port_register(handlePtr->client, portName, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); - INIT_LIST_HEAD(&newPort->queue); - - handlePtr->midiOuts[handlePtr->midiOutCount++] = newPort; - } -#endif - - return nextId; -} - -void caitlib_destroy_port(CaitlibHandle handle, uint32_t port) -{ - // wait for jack processing to end - handlePtr->doProcess = false; - pthread_mutex_lock(&handlePtr->mutex); - -#ifdef USE_LIST_HEAD_OUTS -#else - // re-allocate pointers (midiOutCount - 1) - { - CaitlibOutPort* oldMidiOuts[handlePtr->midiOutCount]; - - for (uint32_t i = 0; i < handlePtr->midiOutCount; i++) - oldMidiOuts[i] = handlePtr->midiOuts[i]; - - if (handlePtr->midiOuts) - free(handlePtr->midiOuts); - - if (handlePtr->midiOutCount == 1) - { - handlePtr->midiOuts = NULL; - } - else - { - handlePtr->midiOuts = (CaitlibOutPort**)malloc(sizeof(CaitlibOutPort*) * (handlePtr->midiOutCount-1)); - - for (uint32_t i = 0, j = 0; i < handlePtr->midiOutCount; i++) - { - if (oldMidiOuts[i]->id != port) - handlePtr->midiOuts[j++] = oldMidiOuts[i]; - } - } - - handlePtr->midiOutCount--; - } -#endif - - pthread_mutex_unlock(&handlePtr->mutex); - handlePtr->doProcess = true; - - return; - (void)port; -} - -// ------------------------------------------------------------------------------------------ -// Input - -void caitlib_want_events(CaitlibHandle handle, bool yesNo) -{ - pthread_mutex_lock(&handlePtr->mutex); - handlePtr->wantEvents = yesNo; - pthread_mutex_unlock(&handlePtr->mutex); -} - -MidiEvent* caitlib_get_event(CaitlibHandle handle) -{ - static MidiEvent midiEvent; - - ListHead* nodePtr; - RawMidiEvent* rawEventPtr; - - pthread_mutex_lock(&handlePtr->mutex); - if (list_empty(&handlePtr->inQueue)) - { - pthread_mutex_unlock(&handlePtr->mutex); - return NULL; - } - - nodePtr = handlePtr->inQueue.prev; - - list_del(nodePtr); - - rawEventPtr = list_entry(nodePtr, RawMidiEvent, siblings); - - pthread_mutex_unlock(&handlePtr->mutex); - - midiEvent.channel = rawEventPtr->data[0] & 0x0F; - midiEvent.time = rawEventPtr->time; - - // note off - if (rawEventPtr->dataSize == 3 && (rawEventPtr->data[0] & 0xF0) == MIDI_EVENT_TYPE_NOTE_OFF) - { - midiEvent.type = MIDI_EVENT_TYPE_NOTE_OFF; - midiEvent.data.note.note = rawEventPtr->data[1]; - midiEvent.data.note.velocity = rawEventPtr->data[2]; - } - - // note on - else if (rawEventPtr->dataSize == 3 && (rawEventPtr->data[0] & 0xF0) == MIDI_EVENT_TYPE_NOTE_ON) - { - midiEvent.type = MIDI_EVENT_TYPE_NOTE_ON; - midiEvent.data.note.note = rawEventPtr->data[1]; - midiEvent.data.note.velocity = rawEventPtr->data[2]; - } - - // aftertouch - else if (rawEventPtr->dataSize == 3 && (rawEventPtr->data[0] & 0xF0) == MIDI_EVENT_TYPE_AFTER_TOUCH) - { - midiEvent.type = MIDI_EVENT_TYPE_AFTER_TOUCH; - midiEvent.data.note.note = rawEventPtr->data[1]; - midiEvent.data.note.velocity = rawEventPtr->data[2]; - } - - // control - else if (rawEventPtr->dataSize == 3 && (rawEventPtr->data[0] & 0xF0) == MIDI_EVENT_TYPE_CONTROL) - { - midiEvent.type = MIDI_EVENT_TYPE_CONTROL; - midiEvent.data.control.controller = rawEventPtr->data[1]; - midiEvent.data.control.value = rawEventPtr->data[2]; - } - - // program - else if (rawEventPtr->dataSize == 2 && (rawEventPtr->data[0] & 0xF0) == MIDI_EVENT_TYPE_PROGRAM) - { - midiEvent.type = MIDI_EVENT_TYPE_PROGRAM; - midiEvent.data.program.value = rawEventPtr->data[1]; - } - - // channel pressure - else if (rawEventPtr->dataSize == 2 && (rawEventPtr->data[0] & 0xF0) == MIDI_EVENT_TYPE_CHANNEL_PRESSURE) - { - midiEvent.type = MIDI_EVENT_TYPE_CHANNEL_PRESSURE; - midiEvent.data.pressure.value = rawEventPtr->data[1]; - } - - // pitch wheel - else if (rawEventPtr->dataSize == 3 && (rawEventPtr->data[0] & 0xF0) == MIDI_EVENT_TYPE_PITCH_WHEEL) - { - midiEvent.type = MIDI_EVENT_TYPE_PITCH_WHEEL; - midiEvent.data.pitchwheel.value = ((rawEventPtr->data[2] << 7) | rawEventPtr->data[1]) - 8192; - } - - else - { - midiEvent.type = MIDI_EVENT_TYPE_NULL; - } - - rtsafe_memory_pool_deallocate(handlePtr->mempool, rawEventPtr); - - return &midiEvent; -} - -// ------------------------------------------------------------------------------------------ -// Output (utils) - -void caitlib_midi_encode_control(RawMidiEvent* eventPtr, uint8_t channel, uint8_t control, uint8_t value) -{ - eventPtr->data[0] = MIDI_EVENT_TYPE_CONTROL | (channel & 0x0F); - eventPtr->data[1] = control; - eventPtr->data[2] = value; - eventPtr->dataSize = 3; -} - -void caitlib_midi_encode_note_on(RawMidiEvent* eventPtr, uint8_t channel, uint8_t note, uint8_t velocity) -{ - eventPtr->data[0] = MIDI_EVENT_TYPE_NOTE_ON | (channel & 0x0F); - eventPtr->data[1] = note; - eventPtr->data[2] = velocity; - eventPtr->dataSize = 3; -} - -void caitlib_midi_encode_note_off(RawMidiEvent* eventPtr, uint8_t channel, uint8_t note, uint8_t velocity) -{ - eventPtr->data[0] = MIDI_EVENT_TYPE_NOTE_OFF | (channel & 0x0F); - eventPtr->data[1] = note; - eventPtr->data[2] = velocity; - eventPtr->dataSize = 3; -} - -void caitlib_midi_encode_aftertouch(RawMidiEvent* eventPtr, uint8_t channel, uint8_t note, uint8_t pressure) -{ - eventPtr->data[0] = MIDI_EVENT_TYPE_AFTER_TOUCH | (channel & 0x0F); - eventPtr->data[1] = note; - eventPtr->data[2] = pressure; - eventPtr->dataSize = 3; -} - -void caitlib_midi_encode_channel_pressure(RawMidiEvent* eventPtr, uint8_t channel, uint8_t pressure) -{ - eventPtr->data[0] = MIDI_EVENT_TYPE_CHANNEL_PRESSURE | (channel & 0x0F); - eventPtr->data[1] = pressure; - eventPtr->dataSize = 2; -} - -void caitlib_midi_encode_program(RawMidiEvent* eventPtr, uint8_t channel, uint8_t program) -{ - eventPtr->data[0] = MIDI_EVENT_TYPE_PROGRAM | (channel & 0x0F); - eventPtr->data[1] = program; - eventPtr->dataSize = 2; -} - -void caitlib_midi_encode_pitchwheel(RawMidiEvent* eventPtr, uint8_t channel, int16_t pitchwheel) -{ - pitchwheel += 8192; - eventPtr->data[0] = MIDI_EVENT_TYPE_PITCH_WHEEL | (channel & 0x0F); - eventPtr->data[1] = pitchwheel & 0x7F; - eventPtr->data[2] = pitchwheel >> 7; - eventPtr->dataSize = 3; -} - -// ------------------------------------------------------------------------------------------ -// Output - -void caitlib_put_event(CaitlibHandle handle, uint32_t port, const MidiEvent* event) -{ -#ifdef USE_LIST_HEAD_OUTS - ListHead* entryPtr; -#endif - RawMidiEvent* eventPtr; - CaitlibOutPort* outPortPtr; - bool portFound = false; - - eventPtr = rtsafe_memory_pool_allocate_sleepy(handlePtr->mempool); - eventPtr->time = event->time; - - switch (event->type) - { - case MIDI_EVENT_TYPE_CONTROL: - caitlib_midi_encode_control(eventPtr, event->channel, event->data.control.controller, event->data.control.value); - break; - case MIDI_EVENT_TYPE_NOTE_ON: - caitlib_midi_encode_note_on(eventPtr, event->channel, event->data.note.note, event->data.note.velocity); - break; - case MIDI_EVENT_TYPE_NOTE_OFF: - caitlib_midi_encode_note_off(eventPtr, event->channel, event->data.note.note, event->data.note.velocity); - break; - case MIDI_EVENT_TYPE_AFTER_TOUCH: - caitlib_midi_encode_aftertouch(eventPtr, event->channel, event->data.note.note, event->data.note.velocity); - break; - case MIDI_EVENT_TYPE_CHANNEL_PRESSURE: - caitlib_midi_encode_channel_pressure(eventPtr, event->channel, event->data.pressure.value); - break; - case MIDI_EVENT_TYPE_PROGRAM: - caitlib_midi_encode_program(eventPtr, event->channel, event->data.program.value); - break; - case MIDI_EVENT_TYPE_PITCH_WHEEL: - caitlib_midi_encode_pitchwheel(eventPtr, event->channel, event->data.pitchwheel.value); - break; - default: - return; - } - - pthread_mutex_lock(&handlePtr->mutex); - -#ifdef USE_LIST_HEAD_OUTS - list_for_each(entryPtr, &handlePtr->outPorts) - { - outPortPtr = list_entry(entryPtr, CaitlibOutPort, siblings); - - if (outPortPtr->id == port) - { - list_add_tail(&eventPtr->siblings, &outPortPtr->queue); - break; - } - } -#else - for (uint32_t i = 0; i < handlePtr->midiOutCount; i++) - { - outPortPtr = handlePtr->midiOuts[i]; - - if (outPortPtr->id == port) - { - portFound = true; - list_add_tail(&eventPtr->siblings, &outPortPtr->queue); - break; - } - } -#endif - - if (! portFound) - printf("caitlib_put_event(%p, %i, %p) - failed to find port", handle, port, event); - - pthread_mutex_unlock(&handlePtr->mutex); -} - -void caitlib_put_control(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t control, uint8_t value) -{ - MidiEvent event; - event.type = MIDI_EVENT_TYPE_CONTROL; - event.channel = channel; - event.time = time; - event.data.control.controller = control; - event.data.control.value = value; - caitlib_put_event(handle, port, &event); -} - -void caitlib_put_note_on(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t note, uint8_t velocity) -{ - MidiEvent event; - event.type = MIDI_EVENT_TYPE_NOTE_ON; - event.channel = channel; - event.time = time; - event.data.note.note = note; - event.data.note.velocity = velocity; - caitlib_put_event(handle, port, &event); -} - -void caitlib_put_note_off(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t note, uint8_t velocity) -{ - MidiEvent event; - event.type = MIDI_EVENT_TYPE_NOTE_OFF; - event.channel = channel; - event.time = time; - event.data.note.note = note; - event.data.note.velocity = velocity; - caitlib_put_event(handle, port, &event); -} - -void caitlib_put_aftertouch(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t note, uint8_t pressure) -{ - MidiEvent event; - event.type = MIDI_EVENT_TYPE_AFTER_TOUCH; - event.channel = channel; - event.time = time; - event.data.note.note = note; - event.data.note.velocity = pressure; - caitlib_put_event(handle, port, &event); -} - -void caitlib_put_channel_pressure(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t pressure) -{ - MidiEvent event; - event.type = MIDI_EVENT_TYPE_CHANNEL_PRESSURE; - event.channel = channel; - event.time = time; - event.data.pressure.value = pressure; - caitlib_put_event(handle, port, &event); -} - -void caitlib_put_program(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t program) -{ - MidiEvent event; - event.type = MIDI_EVENT_TYPE_PROGRAM; - event.channel = channel; - event.time = time; - event.data.program.value = program; - caitlib_put_event(handle, port, &event); -} - -void caitlib_put_pitchwheel(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, int16_t value) -{ - MidiEvent event; - event.type = MIDI_EVENT_TYPE_PITCH_WHEEL; - event.channel = channel; - event.time = time; - event.data.pitchwheel.value = value; - caitlib_put_event(handle, port, &event); -} diff --git a/c++/caitlib/caitlib.doxygen b/c++/caitlib/caitlib.doxygen deleted file mode 100644 index 994d466..0000000 --- a/c++/caitlib/caitlib.doxygen +++ /dev/null @@ -1,287 +0,0 @@ -# Doxyfile 1.7.6.1 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "Caitlib" -PROJECT_NUMBER = -PROJECT_BRIEF = -PROJECT_LOGO = -OUTPUT_DIRECTORY = ../../doc/caitlib -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 4 -ALIASES = -TCL_SUBST = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -EXTENSION_MAPPING = -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -IDL_PROPERTY_SUPPORT = YES -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -INLINE_GROUPED_CLASSES = NO -INLINE_SIMPLE_STRUCTS = NO -TYPEDEF_HIDES_STRUCT = NO -SYMBOL_CACHE_SIZE = 0 -LOOKUP_CACHE_SIZE = 0 -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -EXTRACT_ANON_NSPACES = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -FORCE_LOCAL_INCLUDES = NO -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -SORT_BRIEF_DOCS = NO -SORT_MEMBERS_CTORS_1ST = NO -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -STRICT_PROTO_MATCHING = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO -SHOW_FILES = YES -SHOW_NAMESPACES = YES -FILE_VERSION_FILTER = -LAYOUT_FILE = -CITE_BIB_FILES = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = -RECURSIVE = NO -EXCLUDE = caitlib.c list.h memory_atomic.h memory_atomic.c -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -FILTER_SOURCE_PATTERNS = -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = . -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_EXTRA_FILES = -HTML_COLORSTYLE_HUE = 220 -HTML_COLORSTYLE_SAT = 100 -HTML_COLORSTYLE_GAMMA = 80 -HTML_TIMESTAMP = YES -HTML_ALIGN_MEMBERS = YES -HTML_DYNAMIC_SECTIONS = NO -GENERATE_DOCSET = NO -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = org.doxygen.Project -DOCSET_PUBLISHER_ID = org.doxygen.Publisher -DOCSET_PUBLISHER_NAME = Publisher -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -CHM_INDEX_ENCODING = -BINARY_TOC = NO -TOC_EXPAND = NO -GENERATE_QHP = NO -QCH_FILE = -QHP_NAMESPACE = org.doxygen.Project -QHP_VIRTUAL_FOLDER = doc -QHP_CUST_FILTER_NAME = -QHP_CUST_FILTER_ATTRS = -QHP_SECT_FILTER_ATTRS = -QHG_LOCATION = -GENERATE_ECLIPSEHELP = NO -ECLIPSE_DOC_ID = org.doxygen.Project -DISABLE_INDEX = NO -GENERATE_TREEVIEW = NO -ENUM_VALUES_PER_LINE = 4 -USE_INLINE_TREES = NO -TREEVIEW_WIDTH = 250 -EXT_LINKS_IN_WINDOW = NO -FORMULA_FONTSIZE = 10 -FORMULA_TRANSPARENT = YES -USE_MATHJAX = NO -MATHJAX_RELPATH = http://www.mathjax.org/mathjax -MATHJAX_EXTENSIONS = -SEARCHENGINE = YES -SERVER_BASED_SEARCH = NO -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4 -EXTRA_PACKAGES = -LATEX_HEADER = -LATEX_FOOTER = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -LATEX_SOURCE_CODE = NO -LATEX_BIB_STYLE = plain -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = DOXYGEN -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -MSCGEN_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -DOT_NUM_THREADS = 0 -DOT_FONTNAME = Helvetica -DOT_FONTSIZE = 10 -DOT_FONTPATH = -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -INTERACTIVE_SVG = NO -DOT_PATH = -DOTFILE_DIRS = -MSCFILE_DIRS = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = YES -GENERATE_LEGEND = YES -DOT_CLEANUP = YES diff --git a/c++/caitlib/caitlib.h b/c++/caitlib/caitlib.h deleted file mode 100644 index b5c804d..0000000 --- a/c++/caitlib/caitlib.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Caitlib - * Copyright (C) 2007 Nedko Arnaudov - * Copyright (C) 2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#ifndef CAITLIB_INCLUDED -#define CAITLIB_INCLUDED - -#ifdef __cplusplus -extern "C" { -#else -# include -#endif - -#include - -#ifdef _WIN32 -# define CAITLIB_EXPORT __declspec (dllexport) -#else -# define CAITLIB_EXPORT __attribute__ ((visibility("default"))) -#endif - -/*! - * @defgroup CaitlibAPI Caitlib API - * - * The Caitlib API - * - * @{ - */ - -/*! - * Native handle for all Caitlib calls. - */ -typedef void* CaitlibHandle; - -/*! - * @defgroup MidiEventType MidiEvent Type - * @{ - */ -#define MIDI_EVENT_TYPE_NULL 0x00 //!< Null Event. -#define MIDI_EVENT_TYPE_NOTE_OFF 0x80 //!< Note-Off Event, uses Note data. -#define MIDI_EVENT_TYPE_NOTE_ON 0x90 //!< Note-On Event, uses Note data. -#define MIDI_EVENT_TYPE_AFTER_TOUCH 0xA0 //!< [Key] AfterTouch Event, uses Note data. -#define MIDI_EVENT_TYPE_CONTROL 0xB0 //!< Control Event, uses Control data. -#define MIDI_EVENT_TYPE_PROGRAM 0xC0 //!< Program Event, uses Program data. -#define MIDI_EVENT_TYPE_CHANNEL_PRESSURE 0xD0 //!< Channel Pressure Event, uses Pressure data. -#define MIDI_EVENT_TYPE_PITCH_WHEEL 0xE0 //!< PitchWheel Event, uses PitchWheel data. -#define MIDI_EVENT_TYPE_TIME 0xF1 //!< Time Event, uses Time Data. -/**@}*/ - -/*! - * MidiEvent in Caitlib - */ -typedef struct _MidiEvent -{ - /*! - * MidiEvent Type - */ - uint16_t type; - - /*! - * MidiEvent Channel (0 - 16) - */ - uint8_t channel; - - /*! - * MidiEvent Data (values depend on type). - * \note Time event types ignore channel value. - */ - union MidiEventData { - struct MidiEventControl { - uint8_t controller; - uint8_t value; - } control; - - struct MidiEventNote { - uint8_t note; - uint8_t velocity; - } note; - - struct MidiEventPressure { - uint8_t value; - } pressure; - - struct MidiEventProgram { - uint8_t value; - } program; - - struct MidiEventPitchWheel { - int16_t value; - } pitchwheel; - - struct MidiEventTime { - double bpm; - uint8_t sigNum; - uint8_t sigDenum; - } time; - -#ifndef DOXYGEN - // padding for future events - struct _MidiEventPadding { - uint8_t pad[128]; - } __padding; -#endif - } data; - - /*! - * MidiEvent Time (in frames) - */ - uint32_t time; - -} MidiEvent; - -// ------------------------------------------------------------------------------------------ - -/*! - * @defgroup Initialization - * - * Functions for initialization and destruction of Caitlib instances. - * @{ - */ - -/*! - * Initialize a new Caitlib instance with name \a instanceName.\n - * Must be closed when no longer needed with caitlib_close(). - * - * \note MIDI Input is disabled by default, call caitlib_want_events() to enable them. - * \note There are no MIDI Output ports by default, call caitlib_create_port() for that. - */ -CAITLIB_EXPORT -CaitlibHandle caitlib_init(const char* instanceName); - -/*! - * Close a previously opened Caitlib instance.\n - */ -CAITLIB_EXPORT -void caitlib_close(CaitlibHandle handle); - -/*! - * Create a new MIDI Output port with name \a portName.\n - * The return value is the ID for the port, which must be passed for any functions in the Output group.\n - * The ID will be >= 0 for a valid port, or -1 if an error occurred. - */ -CAITLIB_EXPORT -uint32_t caitlib_create_port(CaitlibHandle handle, const char* portName); - -/*! - * Close a previously opened Caitlib instance.\n - * There's no need to call this function before caitlib_close(). - */ -CAITLIB_EXPORT -void caitlib_destroy_port(CaitlibHandle handle, uint32_t port); - -/**@}*/ - -// ------------------------------------------------------------------------------------------ - -/*! - * @defgroup Input - * - * Functions for MIDI Input handling. - * @{ - */ - -/*! - * Tell a Caitlib instance wherever if we're interested in MIDI Input.\n - * By default MIDI Input is disabled.\n - * It's safe to call this function multiple times during the lifetime of an instance. - */ -CAITLIB_EXPORT -void caitlib_want_events(CaitlibHandle handle, bool yesNo); - -/*! - * Get a MidiEvent from a Caitlib instance buffer.\n - * When there are no more messages in the buffer, this function returns NULL. - */ -CAITLIB_EXPORT -MidiEvent* caitlib_get_event(CaitlibHandle handle); - -/**@}*/ - -// ------------------------------------------------------------------------------------------ - -/*! - * @defgroup Output - * - * Functions for putting data into Caitlib instances (MIDI Output). - * @{ - */ - -/*! - * Put a MIDI event into a Caitlib instance port. - */ -CAITLIB_EXPORT -void caitlib_put_event(CaitlibHandle handle, uint32_t port, const MidiEvent* event); - -/*! - * Put a MIDI Control event into a Caitlib instance port. - */ -CAITLIB_EXPORT -void caitlib_put_control(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t controller, uint8_t value); - -/*! - * Put a MIDI Note On event into a Caitlib instance port. - */ -CAITLIB_EXPORT -void caitlib_put_note_on(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t note, uint8_t velocity); - -/*! - * Put a MIDI Note Off event into a Caitlib instance port. - */ -CAITLIB_EXPORT -void caitlib_put_note_off(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t note, uint8_t velocity); - -/*! - * Put a MIDI AfterTouch event into a Caitlib instance port. - */ -CAITLIB_EXPORT -void caitlib_put_aftertouch(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t note, uint8_t pressure); - -/*! - * Put a MIDI Channel Pressure event into a Caitlib instance port. - */ -CAITLIB_EXPORT -void caitlib_put_channel_pressure(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t pressure); - -/*! - * Put a MIDI Program event into a Caitlib instance port. - */ -CAITLIB_EXPORT -void caitlib_put_program(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, uint8_t program); - -/*! - * Put a MIDI PitchWheel event into a Caitlib instance port. - */ -CAITLIB_EXPORT -void caitlib_put_pitchwheel(CaitlibHandle handle, uint32_t port, uint32_t time, uint8_t channel, int16_t value); - -/*! - * Put a MIDI Time event into a Caitlib instance. - */ -CAITLIB_EXPORT -void caitlib_put_time(CaitlibHandle handle, uint32_t time, double bpm, uint8_t sigNum, uint8_t sigDenum); - -/**@}*/ - -// ------------------------------------------------------------------------------------------ - -/**@}*/ - -#ifdef __cplusplus -} -#endif - -#endif // CAITLIB_INCLUDED diff --git a/c++/caitlib/caitlib.pro b/c++/caitlib/caitlib.pro deleted file mode 100644 index b8e291a..0000000 --- a/c++/caitlib/caitlib.pro +++ /dev/null @@ -1,33 +0,0 @@ -# QtCreator project file - -CONFIG = debug -CONFIG += link_pkgconfig warn_on # plugin shared - -DEFINES = DEBUG -DEFINES += QTCREATOR_TEST - -DEFINES += _GNU_SOURCE - -PKGCONFIG = jack - -TARGET = caitlib -TEMPLATE = app # lib -VERSION = 0.0.1 - -SOURCES = \ - caitlib.c \ - memory_atomic.c - -SOURCES += \ - test.c - -HEADERS = \ - caitlib.h - -INCLUDEPATH = . - -QMAKE_CFLAGS *= -fvisibility=hidden -fPIC -Wextra -Werror -std=gnu99 - -unix { -LIBS = -lm -lpthread -} diff --git a/c++/caitlib/list.h b/c++/caitlib/list.h deleted file mode 100644 index fee6e73..0000000 --- a/c++/caitlib/list.h +++ /dev/null @@ -1,874 +0,0 @@ -/* -*- Mode: C ; c-basic-offset: 2 -*- */ -/***************************************************************************** - * - * Linux kernel header adapted for user-mode - * The 2.6.17-rt1 version was used. - * - * Original copyright holders of this code are unknown, they were not - * mentioned in the original file. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - *****************************************************************************/ - -#ifndef _LINUX_LIST_H -#define _LINUX_LIST_H - -#include - -#if !defined(offsetof) -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) -#endif - -/** - * container_of - cast a member of a structure out to the containing structure - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - -#define prefetch(x) (x = x) - -/* - * These are non-NULL pointers that will result in page faults - * under normal circumstances, used to verify that nobody uses - * non-initialized list entries. - */ -#define LIST_POISON1 ((void *) 0x00100100) -#define LIST_POISON2 ((void *) 0x00200200) - -/* - * Simple doubly linked list implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -static inline void INIT_LIST_HEAD(struct list_head *list) -{ - list->next = list; - list->prev = list; -} - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static inline void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - -/** - * list_add_tail - add a new entry - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static inline void list_add_tail(struct list_head *new, struct list_head *head) -{ - __list_add(new, head->prev, head); -} - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_add_rcu(struct list_head * new, - struct list_head * prev, struct list_head * next) -{ - new->next = next; - new->prev = prev; -// smp_wmb(); - next->prev = new; - prev->next = new; -} - -/** - * list_add_rcu - add a new entry to rcu-protected list - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - * - * The caller must take whatever precautions are necessary - * (such as holding appropriate locks) to avoid racing - * with another list-mutation primitive, such as list_add_rcu() - * or list_del_rcu(), running on this same list. - * However, it is perfectly legal to run concurrently with - * the _rcu list-traversal primitives, such as - * list_for_each_entry_rcu(). - */ -static inline void list_add_rcu(struct list_head *new, struct list_head *head) -{ - __list_add_rcu(new, head, head->next); -} - -/** - * list_add_tail_rcu - add a new entry to rcu-protected list - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - * - * The caller must take whatever precautions are necessary - * (such as holding appropriate locks) to avoid racing - * with another list-mutation primitive, such as list_add_tail_rcu() - * or list_del_rcu(), running on this same list. - * However, it is perfectly legal to run concurrently with - * the _rcu list-traversal primitives, such as - * list_for_each_entry_rcu(). - */ -static inline void list_add_tail_rcu(struct list_head *new, - struct list_head *head) -{ - __list_add_rcu(new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_del(struct list_head * prev, struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * Note: list_empty on entry does not return true after this, the entry is - * in an undefined state. - */ -static inline void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->next = LIST_POISON1; - entry->prev = LIST_POISON2; -} - -/** - * list_del_rcu - deletes entry from list without re-initialization - * @entry: the element to delete from the list. - * - * Note: list_empty on entry does not return true after this, - * the entry is in an undefined state. It is useful for RCU based - * lockfree traversal. - * - * In particular, it means that we can not poison the forward - * pointers that may still be used for walking the list. - * - * The caller must take whatever precautions are necessary - * (such as holding appropriate locks) to avoid racing - * with another list-mutation primitive, such as list_del_rcu() - * or list_add_rcu(), running on this same list. - * However, it is perfectly legal to run concurrently with - * the _rcu list-traversal primitives, such as - * list_for_each_entry_rcu(). - * - * Note that the caller is not permitted to immediately free - * the newly deleted entry. Instead, either synchronize_rcu() - * or call_rcu() must be used to defer freeing until an RCU - * grace period has elapsed. - */ -static inline void list_del_rcu(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->prev = LIST_POISON2; -} - -/* - * list_replace_rcu - replace old entry by new one - * @old : the element to be replaced - * @new : the new element to insert - * - * The old entry will be replaced with the new entry atomically. - */ -static inline void list_replace_rcu(struct list_head *old, - struct list_head *new) -{ - new->next = old->next; - new->prev = old->prev; -// smp_wmb(); - new->next->prev = new; - new->prev->next = new; - old->prev = LIST_POISON2; -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -static inline void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_move - delete from one list and add as another's head - * @list: the entry to move - * @head: the head that will precede our entry - */ -static inline void list_move(struct list_head *list, struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add(list, head); -} - -/** - * list_move_tail - delete from one list and add as another's tail - * @list: the entry to move - * @head: the head that will follow our entry - */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add_tail(list, head); -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -static inline int list_empty(const struct list_head *head) -{ - return head->next == head; -} - -/** - * list_empty_careful - tests whether a list is - * empty _and_ checks that no other CPU might be - * in the process of still modifying either member - * - * NOTE: using list_empty_careful() without synchronization - * can only be safe if the only activity that can happen - * to the list entry is list_del_init(). Eg. it cannot be used - * if another CPU could re-list_add() it. - * - * @head: the list to test. - */ -static inline int list_empty_careful(const struct list_head *head) -{ - struct list_head *next = head->next; - return (next == head) && (next == head->prev); -} - -static inline void __list_splice(struct list_head *list, - struct list_head *head) -{ - struct list_head *first = list->next; - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -static inline void list_splice(struct list_head *list, struct list_head *head) -{ - if (!list_empty(list)) - __list_splice(list, head); -} - -/** - * list_splice_init - join two lists and reinitialise the emptied list. - * @list: the new list to add. - * @head: the place to add it in the first list. - * - * The list at @list is reinitialised - */ -static inline void list_splice_init(struct list_head *list, - struct list_head *head) -{ - if (!list_empty(list)) { - __list_splice(list, head); - INIT_LIST_HEAD(list); - } -} - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; prefetch(pos->next), pos != (head); \ - pos = pos->next) - -/** - * __list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - * - * This variant differs from list_for_each() in that it's the - * simplest possible list iteration code, no prefetching is done. - * Use this for code that knows the list to be very short (empty - * or 1 entry) most of the time. - */ -#define __list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_prev - iterate over a list backwards - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each_prev(pos, head) \ - for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \ - pos = pos->prev) - -/** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop counter. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - */ -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -/** - * list_for_each_entry - iterate over list of given type - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_reverse - iterate backwards over list of given type. - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ - prefetch(pos->member.prev), &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) - -/** - * list_prepare_entry - prepare a pos entry for use as a start point in - * list_for_each_entry_continue - * @pos: the type * to use as a start point - * @head: the head of the list - * @member: the name of the list_struct within the struct. - */ -#define list_prepare_entry(pos, head, member) \ - ((pos) ? : list_entry(head, typeof(*pos), member)) - -/** - * list_for_each_entry_continue - iterate over list of given type - * continuing after existing point - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_continue(pos, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member); \ - prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_from - iterate over list of given type - * continuing from existing point - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_from(pos, head, member) \ - for (; prefetch(pos->member.next), &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @pos: the type * to use as a loop counter. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -/** - * list_for_each_entry_safe_continue - iterate over list of given type - * continuing after existing point safe against removal of list entry - * @pos: the type * to use as a loop counter. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_safe_continue(pos, n, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -/** - * list_for_each_entry_safe_from - iterate over list of given type - * from existing point safe against removal of list entry - * @pos: the type * to use as a loop counter. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_safe_from(pos, n, head, member) \ - for (n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -/** - * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against - * removal of list entry - * @pos: the type * to use as a loop counter. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_safe_reverse(pos, n, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member), \ - n = list_entry(pos->member.prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.prev, typeof(*n), member)) - -/** - * list_for_each_rcu - iterate over an rcu-protected list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - * - * This list-traversal primitive may safely run concurrently with - * the _rcu list-mutation primitives such as list_add_rcu() - * as long as the traversal is guarded by rcu_read_lock(). - */ -#define list_for_each_rcu(pos, head) \ - for (pos = (head)->next; \ - prefetch(rcu_dereference(pos)->next), pos != (head); \ - pos = pos->next) - -#define __list_for_each_rcu(pos, head) \ - for (pos = (head)->next; \ - rcu_dereference(pos) != (head); \ - pos = pos->next) - -/** - * list_for_each_safe_rcu - iterate over an rcu-protected list safe - * against removal of list entry - * @pos: the &struct list_head to use as a loop counter. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - * - * This list-traversal primitive may safely run concurrently with - * the _rcu list-mutation primitives such as list_add_rcu() - * as long as the traversal is guarded by rcu_read_lock(). - */ -#define list_for_each_safe_rcu(pos, n, head) \ - for (pos = (head)->next; \ - n = rcu_dereference(pos)->next, pos != (head); \ - pos = n) - -/** - * list_for_each_entry_rcu - iterate over rcu list of given type - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * This list-traversal primitive may safely run concurrently with - * the _rcu list-mutation primitives such as list_add_rcu() - * as long as the traversal is guarded by rcu_read_lock(). - */ -#define list_for_each_entry_rcu(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - prefetch(rcu_dereference(pos)->member.next), \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - - -/** - * list_for_each_continue_rcu - iterate over an rcu-protected list - * continuing after existing point. - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - * - * This list-traversal primitive may safely run concurrently with - * the _rcu list-mutation primitives such as list_add_rcu() - * as long as the traversal is guarded by rcu_read_lock(). - */ -#define list_for_each_continue_rcu(pos, head) \ - for ((pos) = (pos)->next; \ - prefetch(rcu_dereference((pos))->next), (pos) != (head); \ - (pos) = (pos)->next) - -/* - * Double linked lists with a single pointer list head. - * Mostly useful for hash tables where the two pointer list head is - * too wasteful. - * You lose the ability to access the tail in O(1). - */ - -struct hlist_head { - struct hlist_node *first; -}; - -struct hlist_node { - struct hlist_node *next, **pprev; -}; - -#define HLIST_HEAD_INIT { .first = NULL } -#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } -#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) -static inline void INIT_HLIST_NODE(struct hlist_node *h) -{ - h->next = NULL; - h->pprev = NULL; -} - -static inline int hlist_unhashed(const struct hlist_node *h) -{ - return !h->pprev; -} - -static inline int hlist_empty(const struct hlist_head *h) -{ - return !h->first; -} - -static inline void __hlist_del(struct hlist_node *n) -{ - struct hlist_node *next = n->next; - struct hlist_node **pprev = n->pprev; - *pprev = next; - if (next) - next->pprev = pprev; -} - -static inline void hlist_del(struct hlist_node *n) -{ - __hlist_del(n); - n->next = LIST_POISON1; - n->pprev = LIST_POISON2; -} - -/** - * hlist_del_rcu - deletes entry from hash list without re-initialization - * @n: the element to delete from the hash list. - * - * Note: list_unhashed() on entry does not return true after this, - * the entry is in an undefined state. It is useful for RCU based - * lockfree traversal. - * - * In particular, it means that we can not poison the forward - * pointers that may still be used for walking the hash list. - * - * The caller must take whatever precautions are necessary - * (such as holding appropriate locks) to avoid racing - * with another list-mutation primitive, such as hlist_add_head_rcu() - * or hlist_del_rcu(), running on this same list. - * However, it is perfectly legal to run concurrently with - * the _rcu list-traversal primitives, such as - * hlist_for_each_entry(). - */ -static inline void hlist_del_rcu(struct hlist_node *n) -{ - __hlist_del(n); - n->pprev = LIST_POISON2; -} - -static inline void hlist_del_init(struct hlist_node *n) -{ - if (!hlist_unhashed(n)) { - __hlist_del(n); - INIT_HLIST_NODE(n); - } -} - -/* - * hlist_replace_rcu - replace old entry by new one - * @old : the element to be replaced - * @new : the new element to insert - * - * The old entry will be replaced with the new entry atomically. - */ -static inline void hlist_replace_rcu(struct hlist_node *old, - struct hlist_node *new) -{ - struct hlist_node *next = old->next; - - new->next = next; - new->pprev = old->pprev; -// smp_wmb(); - if (next) - new->next->pprev = &new->next; - *new->pprev = new; - old->pprev = LIST_POISON2; -} - -static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) -{ - struct hlist_node *first = h->first; - n->next = first; - if (first) - first->pprev = &n->next; - h->first = n; - n->pprev = &h->first; -} - - -/** - * hlist_add_head_rcu - adds the specified element to the specified hlist, - * while permitting racing traversals. - * @n: the element to add to the hash list. - * @h: the list to add to. - * - * The caller must take whatever precautions are necessary - * (such as holding appropriate locks) to avoid racing - * with another list-mutation primitive, such as hlist_add_head_rcu() - * or hlist_del_rcu(), running on this same list. - * However, it is perfectly legal to run concurrently with - * the _rcu list-traversal primitives, such as - * hlist_for_each_entry_rcu(), used to prevent memory-consistency - * problems on Alpha CPUs. Regardless of the type of CPU, the - * list-traversal primitive must be guarded by rcu_read_lock(). - */ -static inline void hlist_add_head_rcu(struct hlist_node *n, - struct hlist_head *h) -{ - struct hlist_node *first = h->first; - n->next = first; - n->pprev = &h->first; -// smp_wmb(); - if (first) - first->pprev = &n->next; - h->first = n; -} - -/* next must be != NULL */ -static inline void hlist_add_before(struct hlist_node *n, - struct hlist_node *next) -{ - n->pprev = next->pprev; - n->next = next; - next->pprev = &n->next; - *(n->pprev) = n; -} - -static inline void hlist_add_after(struct hlist_node *n, - struct hlist_node *next) -{ - next->next = n->next; - n->next = next; - next->pprev = &n->next; - - if(next->next) - next->next->pprev = &next->next; -} - -/** - * hlist_add_before_rcu - adds the specified element to the specified hlist - * before the specified node while permitting racing traversals. - * @n: the new element to add to the hash list. - * @next: the existing element to add the new element before. - * - * The caller must take whatever precautions are necessary - * (such as holding appropriate locks) to avoid racing - * with another list-mutation primitive, such as hlist_add_head_rcu() - * or hlist_del_rcu(), running on this same list. - * However, it is perfectly legal to run concurrently with - * the _rcu list-traversal primitives, such as - * hlist_for_each_entry_rcu(), used to prevent memory-consistency - * problems on Alpha CPUs. - */ -static inline void hlist_add_before_rcu(struct hlist_node *n, - struct hlist_node *next) -{ - n->pprev = next->pprev; - n->next = next; -// smp_wmb(); - next->pprev = &n->next; - *(n->pprev) = n; -} - -/** - * hlist_add_after_rcu - adds the specified element to the specified hlist - * after the specified node while permitting racing traversals. - * @prev: the existing element to add the new element after. - * @n: the new element to add to the hash list. - * - * The caller must take whatever precautions are necessary - * (such as holding appropriate locks) to avoid racing - * with another list-mutation primitive, such as hlist_add_head_rcu() - * or hlist_del_rcu(), running on this same list. - * However, it is perfectly legal to run concurrently with - * the _rcu list-traversal primitives, such as - * hlist_for_each_entry_rcu(), used to prevent memory-consistency - * problems on Alpha CPUs. - */ -static inline void hlist_add_after_rcu(struct hlist_node *prev, - struct hlist_node *n) -{ - n->next = prev->next; - n->pprev = &prev->next; -// smp_wmb(); - prev->next = n; - if (n->next) - n->next->pprev = &n->next; -} - -#define hlist_entry(ptr, type, member) container_of(ptr,type,member) - -#define hlist_for_each(pos, head) \ - for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ - pos = pos->next) - -#define hlist_for_each_safe(pos, n, head) \ - for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ - pos = n) - -/** - * hlist_for_each_entry - iterate over list of given type - * @tpos: the type * to use as a loop counter. - * @pos: the &struct hlist_node to use as a loop counter. - * @head: the head for your list. - * @member: the name of the hlist_node within the struct. - */ -#define hlist_for_each_entry(tpos, pos, head, member) \ - for (pos = (head)->first; \ - pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) - -/** - * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point - * @tpos: the type * to use as a loop counter. - * @pos: the &struct hlist_node to use as a loop counter. - * @member: the name of the hlist_node within the struct. - */ -#define hlist_for_each_entry_continue(tpos, pos, member) \ - for (pos = (pos)->next; \ - pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) - -/** - * hlist_for_each_entry_from - iterate over a hlist continuing from existing point - * @tpos: the type * to use as a loop counter. - * @pos: the &struct hlist_node to use as a loop counter. - * @member: the name of the hlist_node within the struct. - */ -#define hlist_for_each_entry_from(tpos, pos, member) \ - for (; pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) - -/** - * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @tpos: the type * to use as a loop counter. - * @pos: the &struct hlist_node to use as a loop counter. - * @n: another &struct hlist_node to use as temporary storage - * @head: the head for your list. - * @member: the name of the hlist_node within the struct. - */ -#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ - for (pos = (head)->first; \ - pos && ({ n = pos->next; 1; }) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = n) - -/** - * hlist_for_each_entry_rcu - iterate over rcu list of given type - * @tpos: the type * to use as a loop counter. - * @pos: the &struct hlist_node to use as a loop counter. - * @head: the head for your list. - * @member: the name of the hlist_node within the struct. - * - * This list-traversal primitive may safely run concurrently with - * the _rcu list-mutation primitives such as hlist_add_head_rcu() - * as long as the traversal is guarded by rcu_read_lock(). - */ -#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ - for (pos = (head)->first; \ - rcu_dereference(pos) && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) - -#endif diff --git a/c++/caitlib/memory_atomic.c b/c++/caitlib/memory_atomic.c deleted file mode 100644 index 3ef1856..0000000 --- a/c++/caitlib/memory_atomic.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C ; c-basic-offset: 2 -*- */ -/***************************************************************************** - * - * Non-sleeping memory allocation - * - * Copyright (C) 2006,2007 Nedko Arnaudov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - *****************************************************************************/ - -#include -#include - -#include "memory_atomic.h" -#include "list.h" - -#define TRUE 1 -#define FALSE 0 - -struct rtsafe_memory_pool -{ - size_t data_size; - size_t min_preallocated; - size_t max_preallocated; - - struct list_head used; - unsigned int used_count; - - struct list_head unused; - unsigned int unused_count; -}; - -#define RTSAFE_GROUPS_PREALLOCATE 1024 - -int -rtsafe_memory_pool_create( - size_t data_size, - size_t min_preallocated, - size_t max_preallocated, - rtsafe_memory_pool_handle * pool_handle_ptr) -{ - struct rtsafe_memory_pool * pool_ptr; - - assert(min_preallocated <= max_preallocated); - - pool_ptr = malloc(sizeof(struct rtsafe_memory_pool)); - if (pool_ptr == NULL) - { - return FALSE; - } - - pool_ptr->data_size = data_size; - pool_ptr->min_preallocated = min_preallocated; - pool_ptr->max_preallocated = max_preallocated; - - INIT_LIST_HEAD(&pool_ptr->used); - pool_ptr->used_count = 0; - - INIT_LIST_HEAD(&pool_ptr->unused); - pool_ptr->unused_count = 0; - - rtsafe_memory_pool_sleepy((rtsafe_memory_pool_handle)pool_ptr); - *pool_handle_ptr = pool_ptr; - - return TRUE; -} - -#define pool_ptr ((struct rtsafe_memory_pool *)pool_handle) - -void -rtsafe_memory_pool_destroy( - rtsafe_memory_pool_handle pool_handle) -{ - struct list_head * node_ptr; - - assert(pool_ptr->used_count == 0); /* called should deallocate all chunks prior releasing pool itself */ - assert(list_empty(&pool_ptr->used)); - - while (pool_ptr->unused_count != 0) - { - assert(!list_empty(&pool_ptr->unused)); - - node_ptr = pool_ptr->unused.next; - - list_del(node_ptr); - pool_ptr->unused_count--; - - free(node_ptr); - } - - assert(list_empty(&pool_ptr->unused)); - - free(pool_ptr); -} - -/* adjust unused list size */ -void -rtsafe_memory_pool_sleepy( - rtsafe_memory_pool_handle pool_handle) -{ - struct list_head * node_ptr; - - while (pool_ptr->unused_count < pool_ptr->min_preallocated) - { - node_ptr = malloc(sizeof(struct list_head) + pool_ptr->data_size); - if (node_ptr == NULL) - { - return; - } - - list_add_tail(node_ptr, &pool_ptr->unused); - pool_ptr->unused_count++; - } - - while (pool_ptr->unused_count > pool_ptr->max_preallocated) - { - assert(!list_empty(&pool_ptr->unused)); - - node_ptr = pool_ptr->unused.next; - - list_del(node_ptr); - pool_ptr->unused_count--; - - free(node_ptr); - } -} - -/* find entry in unused list, fail if it is empty */ -void * -rtsafe_memory_pool_allocate( - rtsafe_memory_pool_handle pool_handle) -{ - struct list_head * node_ptr; - - if (list_empty(&pool_ptr->unused)) - { - return NULL; - } - - node_ptr = pool_ptr->unused.next; - list_del(node_ptr); - pool_ptr->unused_count--; - pool_ptr->used_count++; - - return (node_ptr + 1); -} - -/* move from used to unused list */ -void -rtsafe_memory_pool_deallocate( - rtsafe_memory_pool_handle pool_handle, - void * data) -{ - list_add_tail((struct list_head *)data - 1, &pool_ptr->unused); - pool_ptr->used_count--; - pool_ptr->unused_count++; -} - -void * -rtsafe_memory_pool_allocate_sleepy( - rtsafe_memory_pool_handle pool_handle) -{ - void * data; - - do - { - rtsafe_memory_pool_sleepy(pool_handle); - data = rtsafe_memory_pool_allocate(pool_handle); - } - while (data == NULL); - - return data; -} - -/* max alloc is DATA_MIN * (2 ^ POOLS_COUNT) - DATA_SUB */ -#define DATA_MIN 1024 -#define DATA_SUB 100 /* alloc slightly smaller chunks in hope to not allocating additional page for control data */ - -struct rtsafe_memory_pool_generic -{ - size_t size; - rtsafe_memory_pool_handle pool; -}; - -struct rtsafe_memory -{ - struct rtsafe_memory_pool_generic * pools; - size_t pools_count; -}; - -int -rtsafe_memory_init( - size_t max_size, - size_t prealloc_min, - size_t prealloc_max, - rtsafe_memory_handle * handle_ptr) -{ - size_t i; - size_t size; - struct rtsafe_memory * memory_ptr; - - //LOG_DEBUG("rtsafe_memory_init() called."); - - memory_ptr = malloc(sizeof(struct rtsafe_memory)); - if (memory_ptr == NULL) - { - goto fail; - } - - size = DATA_MIN; - memory_ptr->pools_count = 1; - - while ((size << memory_ptr->pools_count) < max_size + DATA_SUB) - { - memory_ptr->pools_count++; - - if (memory_ptr->pools_count > sizeof(size_t) * 8) - { - assert(0); /* chances that caller really need such huge size are close to zero */ - goto fail_free; - } - } - - memory_ptr->pools = malloc(memory_ptr->pools_count * sizeof(struct rtsafe_memory_pool_generic)); - if (memory_ptr->pools == NULL) - { - goto fail_free; - } - - size = DATA_MIN; - - for (i = 0 ; i < memory_ptr->pools_count ; i++) - { - memory_ptr->pools[i].size = size - DATA_SUB; - - if (!rtsafe_memory_pool_create( - memory_ptr->pools[i].size, - prealloc_min, - prealloc_max, - &memory_ptr->pools[i].pool)) - { - while (i > 0) - { - i--; - rtsafe_memory_pool_destroy(memory_ptr->pools[i].pool); - } - - goto fail_free_pools; - } - - size = size << 1; - } - - *handle_ptr = (rtsafe_memory_handle)memory_ptr; - - return TRUE; - -fail_free_pools: - free(memory_ptr->pools); - -fail_free: - free(memory_ptr); - -fail: - return FALSE; -} - -#define memory_ptr ((struct rtsafe_memory *)handle_ptr) -void -rtsafe_memory_uninit( - rtsafe_memory_handle handle_ptr) -{ - unsigned int i; - - //LOG_DEBUG("rtsafe_memory_uninit() called."); - - for (i = 0 ; i < memory_ptr->pools_count ; i++) - { - //LOG_DEBUG("Destroying pool for size %u", (unsigned int)memory_ptr->pools[i].size); - rtsafe_memory_pool_destroy(memory_ptr->pools[i].pool); - } - - free(memory_ptr->pools); - - free(memory_ptr); -} - -void * -rtsafe_memory_allocate( - rtsafe_memory_handle handle_ptr, - size_t size) -{ - rtsafe_memory_pool_handle * data_ptr; - size_t i; - - //LOG_DEBUG("rtsafe_memory_allocate() called."); - - /* pool handle is stored just before user data to ease deallocation */ - size += sizeof(rtsafe_memory_pool_handle); - - for (i = 0 ; i < memory_ptr->pools_count ; i++) - { - if (size <= memory_ptr->pools[i].size) - { - //LOG_DEBUG("Using chunk with size %u.", (unsigned int)memory_ptr->pools[i].size); - data_ptr = rtsafe_memory_pool_allocate(memory_ptr->pools[i].pool); - if (data_ptr == NULL) - { - //LOG_DEBUG("rtsafe_memory_pool_allocate() failed."); - return FALSE; - } - - *data_ptr = memory_ptr->pools[i].pool; - - //LOG_DEBUG("rtsafe_memory_allocate() returning %p", (data_ptr + 1)); - return (data_ptr + 1); - } - } - - /* data size too big, increase POOLS_COUNT */ - //LOG_WARNING("Data size is too big"); - return FALSE; -} - -void -rtsafe_memory_sleepy( - rtsafe_memory_handle handle_ptr) -{ - unsigned int i; - - for (i = 0 ; i < memory_ptr->pools_count ; i++) - { - rtsafe_memory_pool_sleepy(memory_ptr->pools[i].pool); - } -} - -void -rtsafe_memory_deallocate( - void * data) -{ - //LOG_DEBUG("rtsafe_memory_deallocate(%p) called.", data); - rtsafe_memory_pool_deallocate( - *((rtsafe_memory_pool_handle *)data -1), - (rtsafe_memory_pool_handle *)data - 1); -} diff --git a/c++/caitlib/memory_atomic.h b/c++/caitlib/memory_atomic.h deleted file mode 100644 index ce2cf04..0000000 --- a/c++/caitlib/memory_atomic.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C ; c-basic-offset: 2 -*- */ -/***************************************************************************** - * - * Non-sleeping memory allocation - * - * Copyright (C) 2006,2007 Nedko Arnaudov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - *****************************************************************************/ - -#ifndef MEMORY_ATOMIC_H__7B572547_304D_4597_8808_990BE4476CC3__INCLUDED -#define MEMORY_ATOMIC_H__7B572547_304D_4597_8808_990BE4476CC3__INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif -#if 0 -} /* Adjust editor indent */ -#endif - -typedef void * rtsafe_memory_pool_handle; - -/* will sleep */ -int -rtsafe_memory_pool_create( - size_t data_size, /* chunk size */ - size_t min_preallocated, /* min chunks preallocated */ - size_t max_preallocated, /* max chunks preallocated */ - rtsafe_memory_pool_handle * pool_ptr); - -/* will sleep */ -void -rtsafe_memory_pool_destroy( - rtsafe_memory_pool_handle pool); - -/* may sleep */ -void -rtsafe_memory_pool_sleepy( - rtsafe_memory_pool_handle pool); - -/* will not sleep, returns NULL if no memory is available */ -void * -rtsafe_memory_pool_allocate( - rtsafe_memory_pool_handle pool); - -/* may sleep */ -void * -rtsafe_memory_pool_allocate_sleepy( - rtsafe_memory_pool_handle pool); - -/* will not sleep */ -void -rtsafe_memory_pool_deallocate( - rtsafe_memory_pool_handle pool, - void * data); - -typedef void * rtsafe_memory_handle; - -/* will sleep */ -int -rtsafe_memory_init( - size_t max_size, - size_t prealloc_min, - size_t prealloc_max, - rtsafe_memory_handle * handle_ptr); - -/* will not sleep */ -void * -rtsafe_memory_allocate( - rtsafe_memory_handle handle_ptr, - size_t size); - -void -rtsafe_memory_sleepy( - rtsafe_memory_handle handle_ptr); - -/* will not sleep */ -void -rtsafe_memory_deallocate( - void * data); - -void -rtsafe_memory_uninit( - rtsafe_memory_handle handle_ptr); - -#if 0 -{ /* Adjust editor indent */ -#endif -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* #ifndef MEMORY_ATOMIC_H__7B572547_304D_4597_8808_990BE4476CC3__INCLUDED */ diff --git a/c++/carla-backend/Makefile b/c++/carla-backend/Makefile deleted file mode 100644 index 6c31094..0000000 --- a/c++/carla-backend/Makefile +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/make -f -# Makefile for carla-backend # -# ------------------------------------- # -# Created by falkTX -# - -include ../Makefile.mk - -# -------------------------------------------------------------- - -BUILD_CXX_FLAGS += -I. -I../carla-engine -I../carla-includes -I../carla-native -I../carla-plugin -I../carla-utils -BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC -BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore) - -LINK_FLAGS += -fPIC -shared -ldl -lm -lGL -LINK_FLAGS += $(shell pkg-config --libs liblo QtCore QtGui) - -ifeq ($(CARLA_PLUGIN_SUPPORT),true) -BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST -endif - -ifeq ($(CARLA_RTAUDIO_SUPPORT),true) -BUILD_CXX_FLAGS += -DCARLA_ENGINE_RTAUDIO -endif - -ifeq ($(HAVE_JACK),true) -LINK_FLAGS += $(shell pkg-config --libs jack) -endif - -ifeq ($(HAVE_ALSA),true) -LINK_FLAGS += $(shell pkg-config --libs alsa) -endif - -ifeq ($(HAVE_PULSEAUDIO),true) -LINK_FLAGS += $(shell pkg-config --libs libpulse-simple) -endif - -ifeq ($(HAVE_SUIL),true) -LINK_FLAGS += $(shell pkg-config --libs suil-0) -endif - -ifeq ($(HAVE_FLUIDSYNTH),true) -BUILD_CXX_FLAGS += -DWANT_FLUIDSYNTH -LINK_FLAGS += $(shell pkg-config --libs fluidsynth) -endif - -ifeq ($(HAVE_LINUXSAMPLER),true) -BUILD_CXX_FLAGS += -DWANT_LINUXSAMPLER -LINK_FLAGS += $(shell pkg-config --libs linuxsampler) -endif - -ifeq ($(HAVE_ZYN_DEPS),true) -LINK_FLAGS += $(shell pkg-config --libs fftw3 mxml) -endif - -OBJS = \ - carla_backend_standalone.o \ - -OBJS += ../carla-engine/carla_engine.a -OBJS += ../carla-plugin/carla_plugin.a -OBJS += ../carla-native/carla_native.a - -# others -ifeq ($(CARLA_PLUGIN_SUPPORT),true) -OBJS += ../carla-lilv/carla_lilv.a -OBJS += ../carla-rtmempool/carla_rtmempool.a -endif - -# -------------------------------------------------------------- - -all: carla_backend.so - -doxygen: carla_backend.doxygen - doxygen $< - -carla_backend.dll: $(OBJS) -carla_backend.so: $(OBJS) - $(CXX) $^ $(LINK_FLAGS) -o $@ && $(STRIP) $@ - -carla_backend.dylib: $(OBJS) - $(CXX) $^ $(LINK_FLAGS) -bundle -o $@ && $(STRIP) $@ - -# -------------------------------------------------------------- - -../carla-engine/carla_engine.a: - $(MAKE) -C ../carla-engine - -../carla-lilv/carla_lilv.a: - $(MAKE) -C ../carla-lilv - -../carla-native/carla_native.a: - $(MAKE) -C ../carla-native - -../carla-plugin/carla_plugin.a: - $(MAKE) -C ../carla-plugin - -../carla-rtmempool/carla_rtmempool.a: - $(MAKE) -C ../carla-rtmempool - -# -------------------------------------------------------------- - -.cpp.o: - $(CXX) -c $< $(BUILD_CXX_FLAGS) -o $@ - -clean: - rm -f $(OBJS) *.dll *.dylib *.so diff --git a/c++/carla-backend/carla_backend.doxygen b/c++/carla-backend/carla_backend.doxygen deleted file mode 100644 index 55a9316..0000000 --- a/c++/carla-backend/carla_backend.doxygen +++ /dev/null @@ -1,287 +0,0 @@ -# Doxyfile 1.7.6.1 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "Carla Backend" -PROJECT_NUMBER = -PROJECT_BRIEF = -PROJECT_LOGO = -OUTPUT_DIRECTORY = ../../doc/carla-backend -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 4 -ALIASES = -TCL_SUBST = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -EXTENSION_MAPPING = -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -IDL_PROPERTY_SUPPORT = YES -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -INLINE_GROUPED_CLASSES = NO -INLINE_SIMPLE_STRUCTS = NO -TYPEDEF_HIDES_STRUCT = NO -SYMBOL_CACHE_SIZE = 0 -LOOKUP_CACHE_SIZE = 0 -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -EXTRACT_ANON_NSPACES = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -FORCE_LOCAL_INCLUDES = NO -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -SORT_BRIEF_DOCS = NO -SORT_MEMBERS_CTORS_1ST = NO -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -STRICT_PROTO_MATCHING = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO -SHOW_FILES = YES -SHOW_NAMESPACES = YES -FILE_VERSION_FILTER = -LAYOUT_FILE = -CITE_BIB_FILES = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = -RECURSIVE = NO -EXCLUDE = carla_backend_standalone.cpp -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -FILTER_SOURCE_PATTERNS = -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = . -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_EXTRA_FILES = -HTML_COLORSTYLE_HUE = 220 -HTML_COLORSTYLE_SAT = 100 -HTML_COLORSTYLE_GAMMA = 80 -HTML_TIMESTAMP = YES -HTML_ALIGN_MEMBERS = YES -HTML_DYNAMIC_SECTIONS = NO -GENERATE_DOCSET = NO -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = org.doxygen.Project -DOCSET_PUBLISHER_ID = org.doxygen.Publisher -DOCSET_PUBLISHER_NAME = Publisher -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -CHM_INDEX_ENCODING = -BINARY_TOC = NO -TOC_EXPAND = NO -GENERATE_QHP = NO -QCH_FILE = -QHP_NAMESPACE = org.doxygen.Project -QHP_VIRTUAL_FOLDER = doc -QHP_CUST_FILTER_NAME = -QHP_CUST_FILTER_ATTRS = -QHP_SECT_FILTER_ATTRS = -QHG_LOCATION = -GENERATE_ECLIPSEHELP = NO -ECLIPSE_DOC_ID = org.doxygen.Project -DISABLE_INDEX = NO -GENERATE_TREEVIEW = NO -ENUM_VALUES_PER_LINE = 4 -USE_INLINE_TREES = NO -TREEVIEW_WIDTH = 250 -EXT_LINKS_IN_WINDOW = NO -FORMULA_FONTSIZE = 10 -FORMULA_TRANSPARENT = YES -USE_MATHJAX = NO -MATHJAX_RELPATH = http://www.mathjax.org/mathjax -MATHJAX_EXTENSIONS = -SEARCHENGINE = YES -SERVER_BASED_SEARCH = NO -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4 -EXTRA_PACKAGES = -LATEX_HEADER = -LATEX_FOOTER = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -LATEX_SOURCE_CODE = NO -LATEX_BIB_STYLE = plain -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = DOXYGEN -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -MSCGEN_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -DOT_NUM_THREADS = 0 -DOT_FONTNAME = Helvetica -DOT_FONTSIZE = 10 -DOT_FONTPATH = -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -INTERACTIVE_SVG = NO -DOT_PATH = -DOTFILE_DIRS = -MSCFILE_DIRS = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = YES -GENERATE_LEGEND = YES -DOT_CLEANUP = YES diff --git a/c++/carla-backend/carla_backend.hpp b/c++/carla-backend/carla_backend.hpp deleted file mode 100644 index a864da3..0000000 --- a/c++/carla-backend/carla_backend.hpp +++ /dev/null @@ -1,581 +0,0 @@ -/* - * Carla Backend - * Copyright (C) 2011-2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#ifndef CARLA_BACKEND_HPP -#define CARLA_BACKEND_HPP - -#include "carla_defines.hpp" - -#include - -#define CARLA_BACKEND_START_NAMESPACE namespace CarlaBackend { -#define CARLA_BACKEND_END_NAMESPACE } -#define CARLA_BACKEND_USE_NAMESPACE using namespace CarlaBackend; - -CARLA_BACKEND_START_NAMESPACE - -#define STR_MAX 0xFF - -/*! - * @defgroup CarlaBackendAPI Carla Backend API - * - * The Carla Backend API - * - * @{ - */ - -#ifdef BUILD_BRIDGE -const unsigned short MAX_PLUGINS = 1; -#else -const unsigned short MAX_PLUGINS = 99; //!< Maximum number of loadable plugins -#endif -const unsigned int MAX_PARAMETERS = 200; //!< Default value for the maximum number of parameters allowed.\see OPTION_MAX_PARAMETERS - -/*! - * @defgroup PluginHints Plugin Hints - * - * Various plugin hints. - * \see CarlaPlugin::hints() - * @{ - */ -#ifndef BUILD_BRIDGE -const unsigned int PLUGIN_IS_BRIDGE = 0x001; //!< Plugin is a bridge (ie, BridgePlugin). This hint is required because "bridge" itself is not a plugin type. -#endif -const unsigned int PLUGIN_IS_SYNTH = 0x002; //!< Plugin is a synthesizer (produces sound). -const unsigned int PLUGIN_HAS_GUI = 0x004; //!< Plugin has its own custom GUI. -const unsigned int PLUGIN_USES_CHUNKS = 0x008; //!< Plugin uses chunks to save internal data.\see CarlaPlugin::chunkData() -const unsigned int PLUGIN_USES_SINGLE_THREAD = 0x010; //!< Plugin needs a single thread for both DSP processing and UI events. -const unsigned int PLUGIN_CAN_DRYWET = 0x020; //!< Plugin can make use of Dry/Wet controls. -const unsigned int PLUGIN_CAN_VOLUME = 0x040; //!< Plugin can make use of Volume controls. -const unsigned int PLUGIN_CAN_BALANCE = 0x080; //!< Plugin can make use of Left & Right Balance controls. -const unsigned int PLUGIN_CAN_FORCE_STEREO = 0x100; //!< Plugin can be used in forced-stereo mode. -/**@}*/ - -/*! - * @defgroup ParameterHints Parameter Hints - * - * Various parameter hints. - * \see CarlaPlugin::parameterData() - * @{ - */ -const unsigned int PARAMETER_IS_BOOLEAN = 0x01; //!< Parameter value is of boolean type (always at minimum or maximum). -const unsigned int PARAMETER_IS_INTEGER = 0x02; //!< Parameter values are always integer. -const unsigned int PARAMETER_IS_LOGARITHMIC = 0x04; //!< Parameter is logarithmic (informative only, not really implemented). -const unsigned int PARAMETER_IS_ENABLED = 0x08; //!< Parameter is enabled and will be shown in the host built-in editor. -const unsigned int PARAMETER_IS_AUTOMABLE = 0x10; //!< Parameter is automable (realtime safe) -const unsigned int PARAMETER_USES_SAMPLERATE = 0x20; //!< Parameter needs sample rate to work (value and ranges are multiplied by SR, and divided by SR on save). -const unsigned int PARAMETER_USES_SCALEPOINTS = 0x40; //!< Parameter uses scalepoints to define internal values in a meaninful way. -const unsigned int PARAMETER_USES_CUSTOM_TEXT = 0x80; //!< Parameter uses custom text for displaying its value.\see CarlaPlugin::getParameterText() -/**@}*/ - -/*! - * @defgroup CustomDataTypes Custom Data types - * - * The type defines how the \param value in CustomData is stored. - * - * Types are valid URIs.\n - * Any non-string type is saved in a base64 encoded format. - */ -const char* const CUSTOM_DATA_INVALID = nullptr; //!< Null/Invalid data. -const char* const CUSTOM_DATA_CHUNK = "http://kxstudio.sf.net/ns/carla/chunk"; //!< Carla Chunk -const char* const CUSTOM_DATA_STRING = "http://kxstudio.sf.net/ns/carla/string"; //!< Carla String -/**@}*/ - -/*! - * @defgroup BridgeMessages Bridge Messages - * - * Various bridge related messages, used as configure(, value). - * \note This is for internal use only. - * @{ - */ -const char* const CARLA_BRIDGE_MSG_HIDE_GUI = "CarlaBridgeHideGUI"; //!< Plugin -> Host call, tells host GUI is now hidden -const char* const CARLA_BRIDGE_MSG_SAVED = "CarlaBridgeSaved"; //!< Plugin -> Host call, tells host state is saved -const char* const CARLA_BRIDGE_MSG_SAVE_NOW = "CarlaBridgeSaveNow"; //!< Host -> Plugin call, tells plugin to save state now -const char* const CARLA_BRIDGE_MSG_SET_CHUNK = "CarlaBridgeSetChunk"; //!< Host -> Plugin call, tells plugin to set chunk in file \a value -const char* const CARLA_BRIDGE_MSG_SET_CUSTOM = "CarlaBridgeSetCustom"; //!< Host -> Plugin call, tells plugin to set a custom data set using \a value ("type·key·rvalue").\n If \a type is 'chunk' or 'binary' \a rvalue refers to chunk file. -/**@}*/ - -/*! - * The binary type of a plugin. - */ -enum BinaryType { - BINARY_NONE = 0, //!< Null binary type. - BINARY_POSIX32 = 1, //!< POSIX 32bit. - BINARY_POSIX64 = 2, //!< POSIX 64bit. - BINARY_WIN32 = 3, //!< Windows 32bit. - BINARY_WIN64 = 4, //!< Windows 64bit. - BINARY_OTHER = 5 //!< Other. -}; - -/*! - * All the available plugin types, as provided by subclasses of CarlaPlugin.\n - * \note Some plugin classes might provide more than 1 plugin type. - */ -enum PluginType { - PLUGIN_NONE = 0, //!< Null plugin type. - PLUGIN_INTERNAL = 1, //!< Internal plugin.\see NativePlugin - PLUGIN_LADSPA = 2, //!< LADSPA plugin.\see LadspaPlugin - PLUGIN_DSSI = 3, //!< DSSI plugin.\see DssiPlugin - PLUGIN_LV2 = 4, //!< LV2 plugin.\see Lv2Plugin - PLUGIN_VST = 5, //!< VST plugin.\see VstPlugin - PLUGIN_GIG = 6, //!< GIG sound kit, implemented via LinuxSampler.\see LinuxSamplerPlugin - PLUGIN_SF2 = 7, //!< SF2 sound kit (aka SoundFont), implemented via FluidSynth.\see FluidSynthPlugin - PLUGIN_SFZ = 8 //!< SFZ sound kit, implemented via LinuxSampler.\see LinuxSamplerPlugin -}; - -/*! - * Plugin category, describing the funtionality of a plugin.\n - * When a plugin fails to tell his own category, one is atributted to it based on its name. - */ -enum PluginCategory { - PLUGIN_CATEGORY_NONE = 0, //!< Null plugin category. - PLUGIN_CATEGORY_SYNTH = 1, //!< A synthesizer or generator. - PLUGIN_CATEGORY_DELAY = 2, //!< A delay or reverberator. - PLUGIN_CATEGORY_EQ = 3, //!< An equalizer. - PLUGIN_CATEGORY_FILTER = 4, //!< A filter. - PLUGIN_CATEGORY_DYNAMICS = 5, //!< A 'dynamic' plugin (amplifier, compressor, gate, etc). - PLUGIN_CATEGORY_MODULATOR = 6, //!< A 'modulator' plugin (chorus, flanger, phaser, etc). - PLUGIN_CATEGORY_UTILITY = 7, //!< An 'utility' plugin (analyzer, converter, mixer, etc). - PLUGIN_CATEGORY_OTHER = 8 //!< Misc plugin (used to check if the plugin has a category). -}; - -/*! - * Plugin parameter type. - */ -enum ParameterType { - PARAMETER_UNKNOWN = 0, //!< Null parameter type. - PARAMETER_INPUT = 1, //!< Input parameter. - PARAMETER_OUTPUT = 2, //!< Ouput parameter. - PARAMETER_LATENCY = 3, //!< Special latency parameter, used in LADSPA, DSSI and LV2 plugins. - PARAMETER_SAMPLE_RATE = 4, //!< Special sample-rate parameter, used in LADSPA, DSSI and LV2 plugins. - PARAMETER_LV2_FREEWHEEL = 5, //!< Special LV2 Plugin parameter used to report freewheel (offline) mode. - PARAMETER_LV2_TIME = 6 //!< Special LV2 Plugin parameter used to report time information. -}; - -/*! - * Internal parameter indexes.\n - * These are special parameters used internally, plugins do not know about their existence. - */ -enum InternalParametersIndex { - PARAMETER_NULL = -1, //!< Null parameter. - PARAMETER_ACTIVE = -2, //!< Active parameter, can only be 'true' or 'false'; default is 'false'. - PARAMETER_DRYWET = -3, //!< Dry/Wet parameter, range 0.0...1.0; default is 1.0. - PARAMETER_VOLUME = -4, //!< Volume parameter, range 0.0...1.27; default is 1.0. - PARAMETER_BALANCE_LEFT = -5, //!< Balance-Left parameter, range -1.0...1.0; default is -1.0. - PARAMETER_BALANCE_RIGHT = -6 //!< Balance-Right parameter, range -1.0...1.0; default is 1.0. -}; - -/*! - * Plugin custom GUI type. - * \see OPTION_PREFER_UI_BRIDGES - */ -enum GuiType { - GUI_NONE = 0, //!< Null type, plugin has no custom GUI. - GUI_INTERNAL_QT4 = 1, //!< Qt4 type, handled internally. - GUI_INTERNAL_COCOA = 2, //!< Reparented MacOS native type, handled internally. - GUI_INTERNAL_HWND = 3, //!< Reparented Windows native type, handled internally. - GUI_INTERNAL_X11 = 4, //!< Reparented X11 native type, handled internally. - GUI_EXTERNAL_LV2 = 5, //!< External LV2-UI type, handled internally. - GUI_EXTERNAL_SUIL = 6, //!< SUIL type, currently used only for lv2 gtk2 direct-access UIs.\note This type will be removed in the future! - GUI_EXTERNAL_OSC = 7 //!< External, osc-bridge controlled, UI. -}; - -/*! - * Options used in the set_option() call.\n - * These options must be set before calling engine_init() or after engine_close(). - */ -enum OptionsType { - /*! - * Try to set the current process name.\n - * \note Not available on all platforms. - */ - OPTION_PROCESS_NAME = 0, - - /*! - * Set the engine processing mode.\n - * Default is PROCESS_MODE_MULTIPLE_CLIENTS. - * \see ProcessMode - */ - OPTION_PROCESS_MODE = 1, - - /*! - * High-Precision processing mode.\n - * When enabled, audio will be processed by blocks of 8 samples at a time, indenpendently of the buffer size.\n - * Default is off.\n - * EXPERIMENTAL! - */ - OPTION_PROCESS_HIGH_PRECISION = 2, - - /*! - * Maximum number of parameters allowed.\n - * Default is MAX_PARAMETERS. - */ - OPTION_MAX_PARAMETERS = 3, - - /*! - * Prefered buffer size, currently unused. - */ - OPTION_PREFERRED_BUFFER_SIZE = 4, - - /*! - * Prefered sample rate, currently unused. - */ - OPTION_PREFERRED_SAMPLE_RATE = 5, - - /*! - * Force mono plugins as stereo, by running 2 instances at the same time.\n - * Not supported in VST plugins. - */ - OPTION_FORCE_STEREO = 6, - - /*! - * Use (unofficial) dssi-vst chunks feature.\n - * Default is no.\n - * EXPERIMENTAL! - */ - OPTION_USE_DSSI_VST_CHUNKS = 7, - - /*! - * Use plugin bridges whenever possible.\n - * Default is no, and not recommended at this point!. - * EXPERIMENTAL! - */ - OPTION_PREFER_PLUGIN_BRIDGES = 8, - - /*! - * Use OSC-UI bridges whenever possible, otherwise UIs will be handled in the main thread.\n - * Default is yes. - */ - OPTION_PREFER_UI_BRIDGES = 9, - - /*! - * Timeout value in ms for how much to wait for OSC-UIs to respond.\n - * Default is 4000 ms (4 secs). - */ - OPTION_OSC_UI_TIMEOUT = 10, - - /*! - * Set path to the POSIX 32bit plugin bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_POSIX32 = 11, - - /*! - * Set path to the POSIX 64bit plugin bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_POSIX64 = 12, - - /*! - * Set path to the Windows 32bit plugin bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_WIN32 = 13, - - /*! - * Set path to the Windows 64bit plugin bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_WIN64 = 14, - - /*! - * Set path to the LV2 Gtk2 UI bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_LV2_GTK2 = 15, - - /*! - * Set path to the LV2 Gtk3 UI bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_LV2_GTK3 = 16, - - /*! - * Set path to the LV2 Qt4 UI bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_LV2_QT4 = 17, - - /*! - * Set path to the LV2 Qt5 UI bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_LV2_QT5 = 18, - - /*! - * Set path to the LV2 Cocoa UI bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_LV2_COCOA = 19, - - /*! - * Set path to the LV2 Windows UI bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_LV2_WINDOWS = 20, - - /*! - * Set path to the LV2 X11 UI bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_LV2_X11 = 21, - - /*! - * Set path to the VST Cocoa UI bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_VST_COCOA = 22, - - /*! - * Set path to the VST HWND UI bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_VST_HWND = 23, - - /*! - * Set path to the VST X11 UI bridge executable.\n - * Default unset. - */ - OPTION_PATH_BRIDGE_VST_X11 = 24 -}; - -/*! - * Opcodes sent from the engine callback, as defined by CallbackFunc. - * - * \see set_callback_function() - */ -enum CallbackType { - /*! - * Debug.\n - * This opcode is undefined and used only for testing purposes. - */ - CALLBACK_DEBUG = 0, - - /*! - * A parameter has been changed. - * - * \param value1 Parameter index - * \param value3 Value - */ - CALLBACK_PARAMETER_VALUE_CHANGED = 1, - - /*! - * A parameter's MIDI channel has been changed. - * - * \param value1 Parameter index - * \param value2 MIDI channel - */ - CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED = 2, - - /*! - * A parameter's MIDI CC has been changed. - * - * \param value1 Parameter index - * \param value2 MIDI CC - */ - CALLBACK_PARAMETER_MIDI_CC_CHANGED = 3, - - /*! - * The current program has has been changed. - * - * \param value1 Program index - */ - CALLBACK_PROGRAM_CHANGED = 4, - - /*! - * The current MIDI program has been changed. - * - * \param value1 MIDI bank - * \param value2 MIDI program - */ - CALLBACK_MIDI_PROGRAM_CHANGED = 5, - - /*! - * A note has been pressed. - * - * \param value1 Channel - * \param value2 Note - * \param value3 Velocity - */ - CALLBACK_NOTE_ON = 6, - - /*! - * A note has been released. - * - * \param value1 Channel - * \param value2 Note - */ - CALLBACK_NOTE_OFF = 7, - - /*! - * The plugin's custom GUI state has changed. - * - * \param value1 State, as follows:.\n - * 0: GUI has been closed or hidden\n - * 1: GUI has been shown\n - * -1: GUI has crashed and should not be shown again\n - */ - CALLBACK_SHOW_GUI = 8, - - /*! - * The plugin's custom GUI has been resized. - * - * \param value1 Width - * \param value2 Height - */ - CALLBACK_RESIZE_GUI = 9, - - /*! - * The plugin needs update. - */ - CALLBACK_UPDATE = 10, - - /*! - * The plugin's data/information has changed. - */ - CALLBACK_RELOAD_INFO = 11, - - /*! - * The plugin's parameters have changed. - */ - CALLBACK_RELOAD_PARAMETERS = 12, - - /*! - * The plugin's programs have changed. - */ - CALLBACK_RELOAD_PROGRAMS = 13, - - /*! - * The plugin's state has changed. - */ - CALLBACK_RELOAD_ALL = 14, - - /*! - * Non-Session-Manager Announce message. - */ - CALLBACK_NSM_ANNOUNCE = 15, - - /*! - * Non-Session-Manager Open message #1. - */ - CALLBACK_NSM_OPEN1 = 16, - - /*! - * Non-Session-Manager Open message #2. - */ - CALLBACK_NSM_OPEN2 = 17, - - /*! - * Non-Session-Manager Save message. - */ - CALLBACK_NSM_SAVE = 18, - - /*! - * An error occurred, show last error to user. - */ - CALLBACK_ERROR = 19, - - /*! - * The engine has crashed or malfunctioned and will no longer work. - */ - CALLBACK_QUIT = 20 -}; - -/*! - * Engine process mode, changed using set_option(). - * - * \see OPTION_PROCESS_MODE - */ -enum ProcessMode { - PROCESS_MODE_SINGLE_CLIENT = 0, //!< Single client mode (dynamic input/outputs as needed by plugins) - PROCESS_MODE_MULTIPLE_CLIENTS = 1, //!< Multiple client mode (1 master client + 1 client per plugin) - PROCESS_MODE_CONTINUOUS_RACK = 2, //!< Single client, 'rack' mode. Processes plugins in order of id, with forced stereo. - PROCESS_MODE_PATCHBAY = 3 //!< Single client, 'patchbay' mode. -}; - -/*! - * Callback function the backend will call when something interesting happens. - * - * \see set_callback_function() - */ -typedef void (*CallbackFunc)(void* ptr, CallbackType action, unsigned short pluginId, int value1, int value2, double value3, const char* valueStr); - -struct ParameterData { - ParameterType type; - int32_t index; - int32_t rindex; - int32_t hints; - uint8_t midiChannel; - int16_t midiCC; - - ParameterData() - : type(PARAMETER_UNKNOWN), - index(-1), - rindex(-1), - hints(0), - midiChannel(0), - midiCC(-1) {} -}; - -struct ParameterRanges { - double def; - double min; - double max; - double step; - double stepSmall; - double stepLarge; - - ParameterRanges() - : def(0.0), - min(0.0), - max(1.0), - step(0.01), - stepSmall(0.0001), - stepLarge(0.1) {} -}; - -struct MidiProgramData { - uint32_t bank; - uint32_t program; - const char* name; - - MidiProgramData() - : bank(0), - program(0), - name(nullptr) {} -}; - -struct CustomData { - const char* type; - const char* key; - const char* value; - - CustomData() - : type(nullptr), - key(nullptr), - value(nullptr) {} -}; - -/**@}*/ - -// forward declarations of commonly used Carla classes -class CarlaEngine; -class CarlaPlugin; - -CARLA_BACKEND_END_NAMESPACE - -#endif // CARLA_BACKEND_HPP diff --git a/c++/carla-backend/carla_backend.pro b/c++/carla-backend/carla_backend.pro deleted file mode 100644 index 3d75a49..0000000 --- a/c++/carla-backend/carla_backend.pro +++ /dev/null @@ -1,54 +0,0 @@ -# QtCreator project file - -QT = core gui - -CONFIG = debug -CONFIG += link_pkgconfig qt warn_on - -DEFINES = DEBUG -DEFINES += QTCREATOR_TEST - -DEFINES += CARLA_ENGINE_RTAUDIO -DEFINES += WANT_LADSPA WANT_DSSI WANT_LV2 WANT_VST -DEFINES += WANT_FLUIDSYNTH WANT_LINUXSAMPLER - -PKGCONFIG = liblo -PKGCONFIG += jack -PKGCONFIG += alsa libpulse-simple -PKGCONFIG += suil-0 -PKGCONFIG += fluidsynth linuxsampler -PKGCONFIG += fftw3 mxml - -TARGET = carla_backend -TEMPLATE = app -VERSION = 0.5.0 - -SOURCES = \ - carla_backend_standalone.cpp - -HEADERS = \ - carla_backend.hpp \ - carla_backend_utils.hpp \ - carla_backend_standalone.hpp - -INCLUDEPATH = . \ - ../carla-engine \ - ../carla-includes \ - ../carla-native \ - ../carla-plugin \ - ../carla-utils - -LIBS = \ - ../carla-engine/carla_engine.a \ - ../carla-plugin/carla_plugin.a \ - ../carla-native/carla_native.a - -LIBS += \ - ../carla-lilv/carla_lilv.a \ - ../carla-rtmempool/carla_rtmempool.a - -QMAKE_CXXFLAGS *= -std=c++0x - -unix { -LIBS += -ldl -lm -} diff --git a/c++/carla-backend/carla_backend_standalone.cpp b/c++/carla-backend/carla_backend_standalone.cpp deleted file mode 100644 index afae8d7..0000000 --- a/c++/carla-backend/carla_backend_standalone.cpp +++ /dev/null @@ -1,1948 +0,0 @@ -/* - * Carla Backend - * Copyright (C) 2011-2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#include "carla_backend_standalone.hpp" -#include "carla_plugin.hpp" -#include "carla_native.h" - -// ------------------------------------------------------------------------------------------------------------------- - -// Single, standalone engine -struct CarlaBackendStandalone { - CarlaBackend::CarlaEngineOptions options; - CarlaBackend::CarlaEngine* engine; - CarlaBackend::CallbackFunc callback; - CarlaString lastError; - CarlaString procName; - bool started; - - CarlaBackendStandalone() - : engine(nullptr), - callback(nullptr), - started(false) {} - -} standalone; - -// ------------------------------------------------------------------------------------------------------------------- - -const char* get_extended_license_text() -{ - qDebug("CarlaBackendStandalone::get_extended_license_text()"); - - static CarlaString extendedLicenseText; - - if (extendedLicenseText.isEmpty()) - { - QString text("

This current Carla build is using the following features and 3rd-party code:

"); - text += "
    "; -#ifdef WANT_LADSPA - text += "
  • LADSPA plugin support, http://www.ladspa.org/
  • "; -#endif -#ifdef WANT_DSSI - text += "
  • DSSI plugin support, http://dssi.sourceforge.net/
  • "; -#endif -#ifdef WANT_LV2 - text += "
  • LV2 plugin support, http://lv2plug.in/
  • "; -#endif -#ifdef WANT_VST -# ifdef VESTIGE_HEADER - text += "
  • VST plugin support, using VeSTige header by Javier Serrano Polo
  • "; -# else - text += "
  • VST plugin support, using official VST SDK 2.4 (trademark of Steinberg Media Technologies GmbH)
  • "; -# endif -#endif -#ifdef WANT_ZYNADDSUBFX - text += "
  • ZynAddSubFX plugin code, http://zynaddsubfx.sf.net/
  • "; -#endif -#ifdef WANT_FLUIDSYNTH - text += "
  • FluidSynth library for SF2 support, http://www.fluidsynth.org/
  • "; -#endif -#ifdef WANT_LINUXSAMPLER - text += "
  • LinuxSampler library for GIG and SFZ support*, http://www.linuxsampler.org/
  • "; -#endif - text += "
  • liblo library for OSC support, http://liblo.sourceforge.net/
  • "; -#ifdef WANT_LV2 - text += "
  • serd, sord, sratom and lilv libraries for LV2 discovery, http://drobilla.net/software/lilv/
  • "; -#endif -#ifdef CARLA_ENGINE_RTAUDIO - text += "
  • RtAudio and RtMidi libraries for extra Audio and MIDI support, http://www.music.mcgill.ca/~gary/rtaudio/
  • "; -#endif - text += "
"; - -#ifdef WANT_LINUXSAMPLER - text += "

(*) Using LinuxSampler code in commercial hardware or software products is not allowed without prior written authorization by the authors.

"; -#endif - - extendedLicenseText = text.toUtf8().constData(); - } - - return extendedLicenseText; -} - -unsigned int get_engine_driver_count() -{ - qDebug("CarlaBackendStandalone::get_engine_driver_count()"); - - return CarlaBackend::CarlaEngine::getDriverCount(); -} - -const char* get_engine_driver_name(unsigned int index) -{ - qDebug("CarlaBackendStandalone::get_engine_driver_name(%i)", index); - - return CarlaBackend::CarlaEngine::getDriverName(index); -} - -// ------------------------------------------------------------------------------------------------------------------- - -unsigned int get_internal_plugin_count() -{ - qDebug("CarlaBackendStandalone::get_internal_plugin_count()"); - - return CarlaBackend::CarlaPlugin::getNativePluginCount(); -} - -const PluginInfo* get_internal_plugin_info(unsigned int pluginId) -{ - qDebug("CarlaBackendStandalone::get_internal_plugin_info(%i)", pluginId); - - static PluginInfo info; - - const PluginDescriptor* const nativePlugin = CarlaBackend::CarlaPlugin::getNativePluginDescriptor(pluginId); - - CARLA_ASSERT(nativePlugin); - - // as internal plugin, this must never fail - if (! nativePlugin) - return nullptr; - - info.type = CarlaBackend::PLUGIN_INTERNAL; - info.category = static_cast(nativePlugin->category); - info.hints = 0x0; - info.name = nativePlugin->name; - info.label = nativePlugin->label; - info.maker = nativePlugin->maker; - info.copyright = nativePlugin->copyright; - - if (nativePlugin->hints & PLUGIN_IS_SYNTH) - info.hints |= CarlaBackend::PLUGIN_IS_SYNTH; - if (nativePlugin->hints & PLUGIN_HAS_GUI) - info.hints |= CarlaBackend::PLUGIN_HAS_GUI; - if (nativePlugin->hints & PLUGIN_USES_SINGLE_THREAD) - info.hints |= CarlaBackend::PLUGIN_USES_SINGLE_THREAD; - - return &info; -} - -// ------------------------------------------------------------------------------------------------------------------- - -bool engine_init(const char* driverName, const char* clientName) -{ - qDebug("CarlaBackendStandalone::engine_init(\"%s\", \"%s\")", driverName, clientName); - CARLA_ASSERT(! standalone.engine); - - standalone.engine = CarlaBackend::CarlaEngine::newDriverByName(driverName); - - if (! standalone.engine) - { - standalone.lastError = "The seleted audio driver is not available!"; - return false; - } - -#ifndef Q_OS_WIN - // TODO: make this an option, put somewhere else - if (! getenv("WINE_RT")) - { - carla_setenv("WINE_RT", "15"); - carla_setenv("WINE_SVR_RT", "10"); - } -#endif - - standalone.engine->setCallback(standalone.callback, nullptr); - - standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_MODE, standalone.options.processMode, nullptr); - standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_HIGH_PRECISION, standalone.options.processHighPrecision, nullptr); - standalone.engine->setOption(CarlaBackend::OPTION_MAX_PARAMETERS, standalone.options.maxParameters, nullptr); - standalone.engine->setOption(CarlaBackend::OPTION_PREFERRED_BUFFER_SIZE, standalone.options.preferredBufferSize, nullptr); - standalone.engine->setOption(CarlaBackend::OPTION_PREFERRED_SAMPLE_RATE, standalone.options.preferredSampleRate, nullptr); - standalone.engine->setOption(CarlaBackend::OPTION_FORCE_STEREO, standalone.options.forceStereo, nullptr); - standalone.engine->setOption(CarlaBackend::OPTION_USE_DSSI_VST_CHUNKS, standalone.options.useDssiVstChunks, nullptr); - standalone.engine->setOption(CarlaBackend::OPTION_PREFER_PLUGIN_BRIDGES, standalone.options.preferPluginBridges, nullptr); - standalone.engine->setOption(CarlaBackend::OPTION_PREFER_UI_BRIDGES, standalone.options.preferUiBridges, nullptr); - standalone.engine->setOption(CarlaBackend::OPTION_OSC_UI_TIMEOUT, standalone.options.oscUiTimeout, nullptr); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_POSIX32, 0, standalone.options.bridge_posix32); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_POSIX64, 0, standalone.options.bridge_posix64); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN32, 0, standalone.options.bridge_win32); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN64, 0, standalone.options.bridge_win64); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK2, 0, standalone.options.bridge_lv2gtk2); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK3, 0, standalone.options.bridge_lv2gtk3); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT4, 0, standalone.options.bridge_lv2qt4); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT5, 0, standalone.options.bridge_lv2qt5); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_COCOA, 0, standalone.options.bridge_lv2cocoa); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_WINDOWS, 0, standalone.options.bridge_lv2win); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_X11, 0, standalone.options.bridge_lv2qt4); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_COCOA, 0, standalone.options.bridge_vstcocoa); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_HWND, 0, standalone.options.bridge_vsthwnd); - standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_X11, 0, standalone.options.bridge_vstx11); - - if (standalone.procName.isNotEmpty()) - standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_NAME, 0, standalone.procName); - - standalone.started = standalone.engine->init(clientName); - - if (standalone.started) - { - standalone.lastError = "no error"; - } - else if (standalone.engine) - { - delete standalone.engine; - standalone.engine = nullptr; - } - - return standalone.started; -} - -bool engine_close() -{ - qDebug("CarlaBackendStandalone::engine_close()"); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - { - standalone.lastError = "Engine is not started"; - return false; - } - - standalone.engine->aboutToClose(); - standalone.engine->removeAllPlugins(); - bool closed = standalone.engine->close(); - - standalone.started = false; - - // cleanup static data - get_plugin_info(0); - get_parameter_info(0, 0); - get_parameter_scalepoint_info(0, 0, 0); - get_chunk_data(0); - get_program_name(0, 0); - get_midi_program_name(0, 0); - get_real_plugin_name(0); - - delete standalone.engine; - standalone.engine = nullptr; - - return closed; -} - -bool is_engine_running() -{ - qDebug("CarlaBackendStandalone::is_engine_running()"); - - return standalone.engine && standalone.engine->isRunning(); -} - -// ------------------------------------------------------------------------------------------------------------------- - -short add_plugin(CarlaBackend::BinaryType btype, CarlaBackend::PluginType ptype, const char* filename, const char* const name, const char* label, void* extraStuff) -{ - qDebug("CarlaBackendStandalone::add_plugin(%s, %s, \"%s\", \"%s\", \"%s\", %p)", CarlaBackend::BinaryType2Str(btype), CarlaBackend::PluginType2Str(ptype), filename, name, label, extraStuff); - CARLA_ASSERT(standalone.engine); - - if (btype != CarlaBackend::BINARY_NATIVE && ! extraStuff) - { - switch (btype) - { - case CarlaBackend::BINARY_NONE: - case CarlaBackend::BINARY_OTHER: - break; - case CarlaBackend::BINARY_POSIX32: - extraStuff = (void*)(const char*)standalone.options.bridge_posix32; - break; - case CarlaBackend::BINARY_POSIX64: - extraStuff = (void*)(const char*)standalone.options.bridge_posix64; - break; - case CarlaBackend::BINARY_WIN32: - extraStuff = (void*)(const char*)standalone.options.bridge_win32; - break; - case CarlaBackend::BINARY_WIN64: - extraStuff = (void*)(const char*)standalone.options.bridge_win64; - break; - } - } - - if (standalone.engine && standalone.engine->isRunning()) - return standalone.engine->addPlugin(btype, ptype, filename, name, label, extraStuff); - - standalone.lastError = "Engine is not started"; - return -1; -} - -bool remove_plugin(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::remove_plugin(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - if (standalone.engine) - return standalone.engine->removePlugin(pluginId); - - standalone.lastError = "Engine is not started"; - return false; -} - -// ------------------------------------------------------------------------------------------------------------------- - -const PluginInfo* get_plugin_info(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_plugin_info(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - static PluginInfo info; - - // reset - info.type = CarlaBackend::PLUGIN_NONE; - info.category = CarlaBackend::PLUGIN_CATEGORY_NONE; - info.hints = 0x0; - info.binary = nullptr; - info.name = nullptr; - info.uniqueId = 0; - - // cleanup - if (info.label) - { - free((void*)info.label); - info.label = nullptr; - } - - if (info.maker) - { - free((void*)info.maker); - info.maker = nullptr; - } - - if (info.copyright) - { - free((void*)info.copyright); - info.copyright = nullptr; - } - - if (! standalone.engine) - return &info; - - if (! standalone.started) - return nullptr; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - char strBufLabel[STR_MAX] = { 0 }; - char strBufMaker[STR_MAX] = { 0 }; - char strBufCopyright[STR_MAX] = { 0 }; - - info.type = plugin->type(); - info.category = plugin->category(); - info.hints = plugin->hints(); - info.binary = plugin->filename(); - info.name = plugin->name(); - info.uniqueId = plugin->uniqueId(); - - plugin->getLabel(strBufLabel); - info.label = strdup(strBufLabel); - - plugin->getMaker(strBufMaker); - info.maker = strdup(strBufMaker); - - plugin->getCopyright(strBufCopyright); - info.copyright = strdup(strBufCopyright); - - return &info; - } - - qCritical("CarlaBackendStandalone::get_plugin_info(%i) - could not find plugin", pluginId); - return &info; -} - -const PortCountInfo* get_audio_port_count_info(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_audio_port_count_info(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - static PortCountInfo info; - - // reset - info.ins = 0; - info.outs = 0; - info.total = 0; - - if (! standalone.engine) - return &info; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - info.ins = plugin->audioInCount(); - info.outs = plugin->audioOutCount(); - info.total = info.ins + info.outs; - return &info; - } - - qCritical("CarlaBackendStandalone::get_audio_port_count_info(%i) - could not find plugin", pluginId); - return &info; -} - -const PortCountInfo* get_midi_port_count_info(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_midi_port_count_info(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - static PortCountInfo info; - - // reset - info.ins = 0; - info.outs = 0; - info.total = 0; - - if (! standalone.engine) - return &info; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - info.ins = plugin->midiInCount(); - info.outs = plugin->midiOutCount(); - info.total = info.ins + info.outs; - return &info; - } - - qCritical("CarlaBackendStandalone::get_midi_port_count_info(%i) - could not find plugin", pluginId); - return &info; -} - -const PortCountInfo* get_parameter_count_info(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_parameter_count_info(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - static PortCountInfo info; - - // reset - info.ins = 0; - info.outs = 0; - info.total = 0; - - if (! standalone.engine) - return &info; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - plugin->getParameterCountInfo(&info.ins, &info.outs, &info.total); - return &info; - } - - qCritical("CarlaBackendStandalone::get_parameter_count_info(%i) - could not find plugin", pluginId); - return &info; -} - -const ParameterInfo* get_parameter_info(unsigned short pluginId, uint32_t parameter_id) -{ - qDebug("CarlaBackendStandalone::get_parameter_info(%i, %i)", pluginId, parameter_id); - CARLA_ASSERT(standalone.engine); - - static ParameterInfo info; - - // reset - info.scalePointCount = 0; - - // cleanup - if (info.name) - { - free((void*)info.name); - info.name = nullptr; - } - - if (info.symbol) - { - free((void*)info.symbol); - info.symbol = nullptr; - } - - if (info.unit) - { - free((void*)info.unit); - info.unit = nullptr; - } - - if (! standalone.engine) - return &info; - - if (! standalone.started) - return nullptr; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (parameter_id < plugin->parameterCount()) - { - char strBufName[STR_MAX] = { 0 }; - char strBufSymbol[STR_MAX] = { 0 }; - char strBufUnit[STR_MAX] = { 0 }; - - info.scalePointCount = plugin->parameterScalePointCount(parameter_id); - - plugin->getParameterName(parameter_id, strBufName); - info.name = strdup(strBufName); - - plugin->getParameterSymbol(parameter_id, strBufSymbol); - info.symbol = strdup(strBufSymbol); - - plugin->getParameterUnit(parameter_id, strBufUnit); - info.unit = strdup(strBufUnit); - } - else - qCritical("CarlaBackendStandalone::get_parameter_info(%i, %i) - parameter_id out of bounds", pluginId, parameter_id); - - return &info; - } - - qCritical("CarlaBackendStandalone::get_parameter_info(%i, %i) - could not find plugin", pluginId, parameter_id); - return &info; -} - -const ScalePointInfo* get_parameter_scalepoint_info(unsigned short pluginId, uint32_t parameter_id, uint32_t scalepoint_id) -{ - qDebug("CarlaBackendStandalone::get_parameter_scalepoint_info(%i, %i, %i)", pluginId, parameter_id, scalepoint_id); - CARLA_ASSERT(standalone.engine); - - static ScalePointInfo info; - - // reset - info.value = 0.0; - - // cleanup - if (info.label) - { - free((void*)info.label); - info.label = nullptr; - } - - if (! standalone.engine) - return &info; - - if (! standalone.started) - return nullptr; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (parameter_id < plugin->parameterCount()) - { - if (scalepoint_id < plugin->parameterScalePointCount(parameter_id)) - { - char strBufLabel[STR_MAX] = { 0 }; - - info.value = plugin->getParameterScalePointValue(parameter_id, scalepoint_id); - - plugin->getParameterScalePointLabel(parameter_id, scalepoint_id, strBufLabel); - info.label = strdup(strBufLabel); - } - else - qCritical("CarlaBackendStandalone::get_parameter_scalepoint_info(%i, %i, %i) - scalepoint_id out of bounds", pluginId, parameter_id, scalepoint_id); - } - else - qCritical("CarlaBackendStandalone::get_parameter_scalepoint_info(%i, %i, %i) - parameter_id out of bounds", pluginId, parameter_id, parameter_id); - - return &info; - } - - qCritical("CarlaBackendStandalone::get_parameter_scalepoint_info(%i, %i, %i) - could not find plugin", pluginId, parameter_id, scalepoint_id); - return &info; -} - -const GuiInfo* get_gui_info(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_gui_info(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - static GuiInfo info; - - // reset - info.type = CarlaBackend::GUI_NONE; - info.resizable = false; - - if (! standalone.engine) - return &info; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - plugin->getGuiInfo(&info.type, &info.resizable); - return &info; - } - - qCritical("CarlaBackendStandalone::get_gui_info(%i) - could not find plugin", pluginId); - return &info; -} - -// ------------------------------------------------------------------------------------------------------------------- - -const CarlaBackend::ParameterData* get_parameter_data(unsigned short pluginId, uint32_t parameter_id) -{ - qDebug("CarlaBackendStandalone::get_parameter_data(%i, %i)", pluginId, parameter_id); - CARLA_ASSERT(standalone.engine); - - static CarlaBackend::ParameterData data; - - if (! standalone.engine) - return &data; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (parameter_id < plugin->parameterCount()) - return plugin->parameterData(parameter_id); - - qCritical("CarlaBackendStandalone::get_parameter_data(%i, %i) - parameter_id out of bounds", pluginId, parameter_id); - return &data; - } - - qCritical("CarlaBackendStandalone::get_parameter_data(%i, %i) - could not find plugin", pluginId, parameter_id); - return &data; -} - -const CarlaBackend::ParameterRanges* get_parameter_ranges(unsigned short pluginId, uint32_t parameter_id) -{ - qDebug("CarlaBackendStandalone::get_parameter_ranges(%i, %i)", pluginId, parameter_id); - CARLA_ASSERT(standalone.engine); - - static CarlaBackend::ParameterRanges ranges; - - if (! standalone.engine) - return &ranges; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (parameter_id < plugin->parameterCount()) - return plugin->parameterRanges(parameter_id); - - qCritical("CarlaBackendStandalone::get_parameter_ranges(%i, %i) - parameter_id out of bounds", pluginId, parameter_id); - return &ranges; - } - - qCritical("CarlaBackendStandalone::get_parameter_ranges(%i, %i) - could not find plugin", pluginId, parameter_id); - return &ranges; -} - -const CarlaBackend::MidiProgramData* get_midi_program_data(unsigned short pluginId, uint32_t midi_program_id) -{ - qDebug("CarlaBackendStandalone::get_midi_program_data(%i, %i)", pluginId, midi_program_id); - CARLA_ASSERT(standalone.engine); - - static CarlaBackend::MidiProgramData data; - - if (! standalone.engine) - return &data; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (midi_program_id < plugin->midiProgramCount()) - return plugin->midiProgramData(midi_program_id); - - qCritical("CarlaBackendStandalone::get_midi_program_data(%i, %i) - midi_program_id out of bounds", pluginId, midi_program_id); - return &data; - } - - qCritical("CarlaBackendStandalone::get_midi_program_data(%i, %i) - could not find plugin", pluginId, midi_program_id); - return &data; -} - -const CarlaBackend::CustomData* get_custom_data(unsigned short pluginId, uint32_t custom_data_id) -{ - qDebug("CarlaBackendStandalone::get_custom_data(%i, %i)", pluginId, custom_data_id); - CARLA_ASSERT(standalone.engine); - - static CarlaBackend::CustomData data; - - if (! standalone.engine) - return &data; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (custom_data_id < plugin->customDataCount()) - return plugin->customData(custom_data_id); - - qCritical("CarlaBackendStandalone::get_custom_data(%i, %i) - custom_data_id out of bounds", pluginId, custom_data_id); - return &data; - } - - qCritical("CarlaBackendStandalone::get_custom_data(%i, %i) - could not find plugin", pluginId, custom_data_id); - return &data; -} - -const char* get_chunk_data(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_chunk_data(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - static const char* chunk_data = nullptr; - - // cleanup - if (chunk_data) - { - free((void*)chunk_data); - chunk_data = nullptr; - } - - if (! standalone.engine) - return nullptr; - - if (! standalone.started) - return nullptr; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (plugin->hints() & CarlaBackend::PLUGIN_USES_CHUNKS) - { - void* data = nullptr; - const int32_t dataSize = plugin->chunkData(&data); - - if (data && dataSize >= 4) - { - const QByteArray chunk((const char*)data, dataSize); - chunk_data = strdup(chunk.toBase64().constData()); - } - else - qCritical("CarlaBackendStandalone::get_chunk_data(%i) - got invalid chunk data", pluginId); - } - else - qCritical("CarlaBackendStandalone::get_chunk_data(%i) - plugin does not support chunks", pluginId); - - return chunk_data; - } - - qCritical("CarlaBackendStandalone::get_chunk_data(%i) - could not find plugin", pluginId); - return nullptr; -} - -// ------------------------------------------------------------------------------------------------------------------- - -uint32_t get_parameter_count(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_parameter_count(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return 0; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->parameterCount(); - - qCritical("CarlaBackendStandalone::get_parameter_count(%i) - could not find plugin", pluginId); - return 0; -} - -uint32_t get_program_count(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_program_count(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return 0; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->programCount(); - - qCritical("CarlaBackendStandalone::get_program_count(%i) - could not find plugin", pluginId); - return 0; -} - -uint32_t get_midi_program_count(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_midi_program_count(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return 0; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->midiProgramCount(); - - qCritical("CarlaBackendStandalone::get_midi_program_count(%i) - could not find plugin", pluginId); - return 0; -} - -uint32_t get_custom_data_count(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_custom_data_count(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return 0; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->customDataCount(); - - qCritical("CarlaBackendStandalone::get_custom_data_count(%i) - could not find plugin", pluginId); - return 0; -} - -// ------------------------------------------------------------------------------------------------------------------- - -const char* get_parameter_text(unsigned short pluginId, uint32_t parameter_id) -{ - qDebug("CarlaBackendStandalone::get_parameter_text(%i, %i)", pluginId, parameter_id); - CARLA_ASSERT(standalone.engine); - - static char textBuf[STR_MAX]; - memset(textBuf, 0, sizeof(char)*STR_MAX); - - if (! standalone.engine) - return nullptr; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (parameter_id < plugin->parameterCount()) - { - plugin->getParameterText(parameter_id, textBuf); - return textBuf; - } - - qCritical("CarlaBackendStandalone::get_parameter_text(%i, %i) - parameter_id out of bounds", pluginId, parameter_id); - return nullptr; - } - - qCritical("CarlaBackendStandalone::get_parameter_text(%i, %i) - could not find plugin", pluginId, parameter_id); - return nullptr; -} - -const char* get_program_name(unsigned short pluginId, uint32_t program_id) -{ - qDebug("CarlaBackendStandalone::get_program_name(%i, %i)", pluginId, program_id); - CARLA_ASSERT(standalone.engine); - - static const char* program_name = nullptr; - - // cleanup - if (program_name) - { - free((void*)program_name); - program_name = nullptr; - } - - if (! standalone.engine) - return nullptr; - - if (! standalone.started) - return nullptr; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (program_id < plugin->programCount()) - { - char strBuf[STR_MAX] = { 0 }; - - plugin->getProgramName(program_id, strBuf); - program_name = strdup(strBuf); - - return program_name; - } - - qCritical("CarlaBackendStandalone::get_program_name(%i, %i) - program_id out of bounds", pluginId, program_id); - return nullptr; - } - - qCritical("CarlaBackendStandalone::get_program_name(%i, %i) - could not find plugin", pluginId, program_id); - return nullptr; -} - -const char* get_midi_program_name(unsigned short pluginId, uint32_t midi_program_id) -{ - qDebug("CarlaBackendStandalone::get_midi_program_name(%i, %i)", pluginId, midi_program_id); - CARLA_ASSERT(standalone.engine); - - static const char* midi_program_name = nullptr; - - // cleanup - if (midi_program_name) - { - free((void*)midi_program_name); - midi_program_name = nullptr; - } - - if (! standalone.engine) - return nullptr; - - if (! standalone.started) - return nullptr; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (midi_program_id < plugin->midiProgramCount()) - { - char strBuf[STR_MAX] = { 0 }; - - plugin->getMidiProgramName(midi_program_id, strBuf); - midi_program_name = strdup(strBuf); - - return midi_program_name; - } - - qCritical("CarlaBackendStandalone::get_midi_program_name(%i, %i) - program_id out of bounds", pluginId, midi_program_id); - return nullptr; - } - - qCritical("CarlaBackendStandalone::get_midi_program_name(%i, %i) - could not find plugin", pluginId, midi_program_id); - return nullptr; -} - -const char* get_real_plugin_name(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_real_plugin_name(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - static const char* real_plugin_name = nullptr; - - // cleanup - if (real_plugin_name) - { - free((void*)real_plugin_name); - real_plugin_name = nullptr; - } - - if (! standalone.engine) - return nullptr; - - if (! standalone.started) - return nullptr; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - char strBuf[STR_MAX] = { 0 }; - - plugin->getRealName(strBuf); - real_plugin_name = strdup(strBuf); - - return real_plugin_name; - } - - qCritical("CarlaBackendStandalone::get_real_plugin_name(%i) - could not find plugin", pluginId); - return nullptr; -} - -// ------------------------------------------------------------------------------------------------------------------- - -int32_t get_current_program_index(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_current_program_index(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return -1; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->currentProgram(); - - qCritical("CarlaBackendStandalone::get_current_program_index(%i) - could not find plugin", pluginId); - return -1; -} - -int32_t get_current_midi_program_index(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::get_current_midi_program_index(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return -1; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->currentMidiProgram(); - - qCritical("CarlaBackendStandalone::get_current_midi_program_index(%i) - could not find plugin", pluginId); - return -1; -} - -// ------------------------------------------------------------------------------------------------------------------- - -double get_default_parameter_value(unsigned short pluginId, uint32_t parameter_id) -{ - qDebug("CarlaBackendStandalone::get_default_parameter_value(%i, %i)", pluginId, parameter_id); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return 0.0; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (parameter_id < plugin->parameterCount()) - return plugin->parameterRanges(parameter_id)->def; - - qCritical("CarlaBackendStandalone::get_default_parameter_value(%i, %i) - parameter_id out of bounds", pluginId, parameter_id); - return 0.0; - } - - qCritical("CarlaBackendStandalone::get_default_parameter_value(%i, %i) - could not find plugin", pluginId, parameter_id); - return 0.0; -} - -double get_current_parameter_value(unsigned short pluginId, uint32_t parameter_id) -{ - qDebug("CarlaBackendStandalone::get_current_parameter_value(%i, %i)", pluginId, parameter_id); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return 0.0; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (parameter_id < plugin->parameterCount()) - return plugin->getParameterValue(parameter_id); - - qCritical("CarlaBackendStandalone::get_current_parameter_value(%i, %i) - parameter_id out of bounds", pluginId, parameter_id); - return 0.0; - } - - qCritical("CarlaBackendStandalone::get_current_parameter_value(%i, %i) - could not find plugin", pluginId, parameter_id); - return 0.0; -} - -// ------------------------------------------------------------------------------------------------------------------- - -double get_input_peak_value(unsigned short pluginId, unsigned short port_id) -{ - CARLA_ASSERT(standalone.engine); - CARLA_ASSERT(port_id == 1 || port_id == 2); - - if (! standalone.engine) - return 0.0; - -#if 0 - if (pluginId >= standalone.engine->maxPluginNumber()) - { - qCritical("CarlaBackendStandalone::get_input_peak_value(%i, %i) - invalid plugin value", pluginId, port_id); - return 0.0; - } -#endif - - if (port_id == 1 || port_id == 2) - return standalone.engine->getInputPeak(pluginId, port_id-1); - - qCritical("CarlaBackendStandalone::get_input_peak_value(%i, %i) - invalid port value", pluginId, port_id); - return 0.0; -} - -double get_output_peak_value(unsigned short pluginId, unsigned short port_id) -{ - CARLA_ASSERT(standalone.engine); - CARLA_ASSERT(port_id == 1 || port_id == 2); - - if (! standalone.engine) - return 0.0; - -#if 0 - if (pluginId >= standalone.engine->maxPluginNumber()) - { - qCritical("CarlaBackendStandalone::get_input_peak_value(%i, %i) - invalid plugin value", pluginId, port_id); - return 0.0; - } -#endif - - if (port_id == 1 || port_id == 2) - return standalone.engine->getOutputPeak(pluginId, port_id-1); - - qCritical("CarlaBackendStandalone::get_output_peak_value(%i, %i) - invalid port value", pluginId, port_id); - return 0.0; -} - -// ------------------------------------------------------------------------------------------------------------------- - -void set_active(unsigned short pluginId, bool onOff) -{ - qDebug("CarlaBackendStandalone::set_active(%i, %s)", pluginId, bool2str(onOff)); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->setActive(onOff, true, false); - - qCritical("CarlaBackendStandalone::set_active(%i, %s) - could not find plugin", pluginId, bool2str(onOff)); -} - -void set_drywet(unsigned short pluginId, double value) -{ - qDebug("CarlaBackendStandalone::set_drywet(%i, %g)", pluginId, value); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->setDryWet(value, true, false); - - qCritical("CarlaBackendStandalone::set_drywet(%i, %g) - could not find plugin", pluginId, value); -} - -void set_volume(unsigned short pluginId, double value) -{ - qDebug("CarlaBackendStandalone::set_volume(%i, %g)", pluginId, value); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->setVolume(value, true, false); - - qCritical("CarlaBackendStandalone::set_volume(%i, %g) - could not find plugin", pluginId, value); -} - -void set_balance_left(unsigned short pluginId, double value) -{ - qDebug("CarlaBackendStandalone::set_balance_left(%i, %g)", pluginId, value); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->setBalanceLeft(value, true, false); - - qCritical("CarlaBackendStandalone::set_balance_left(%i, %g) - could not find plugin", pluginId, value); -} - -void set_balance_right(unsigned short pluginId, double value) -{ - qDebug("CarlaBackendStandalone::set_balance_right(%i, %g)", pluginId, value); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->setBalanceRight(value, true, false); - - qCritical("CarlaBackendStandalone::set_balance_right(%i, %g) - could not find plugin", pluginId, value); -} - -// ------------------------------------------------------------------------------------------------------------------- - -void set_parameter_value(unsigned short pluginId, uint32_t parameter_id, double value) -{ - qDebug("CarlaBackendStandalone::set_parameter_value(%i, %i, %g)", pluginId, parameter_id, value); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (parameter_id < plugin->parameterCount()) - return plugin->setParameterValue(parameter_id, value, true, true, false); - - qCritical("CarlaBackendStandalone::set_parameter_value(%i, %i, %g) - parameter_id out of bounds", pluginId, parameter_id, value); - return; - } - - qCritical("CarlaBackendStandalone::set_parameter_value(%i, %i, %g) - could not find plugin", pluginId, parameter_id, value); -} - -void set_parameter_midi_channel(unsigned short pluginId, uint32_t parameter_id, uint8_t channel) -{ - qDebug("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i)", pluginId, parameter_id, channel); - CARLA_ASSERT(standalone.engine); - CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); - - if (channel >= MAX_MIDI_CHANNELS) - { - qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - invalid channel number", pluginId, parameter_id, channel); - return; - } - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (parameter_id < plugin->parameterCount()) - return plugin->setParameterMidiChannel(parameter_id, channel, true, false); - - qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - parameter_id out of bounds", pluginId, parameter_id, channel); - return; - } - - qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - could not find plugin", pluginId, parameter_id, channel); -} - -void set_parameter_midi_cc(unsigned short pluginId, uint32_t parameter_id, int16_t cc) -{ - qDebug("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i)", pluginId, parameter_id, cc); - CARLA_ASSERT(standalone.engine); - CARLA_ASSERT(cc >= -1 && cc <= 0x5F); - - if (cc < -1) - { - cc = -1; - } - else if (cc > 0x5F) // 95 - { - qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - invalid cc number", pluginId, parameter_id, cc); - return; - } - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (parameter_id < plugin->parameterCount()) - return plugin->setParameterMidiCC(parameter_id, cc, true, false); - - qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - parameter_id out of bounds", pluginId, parameter_id, cc); - return; - } - - qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - could not find plugin", pluginId, parameter_id, cc); -} - -void set_program(unsigned short pluginId, uint32_t program_id) -{ - qDebug("CarlaBackendStandalone::set_program(%i, %i)", pluginId, program_id); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (program_id < plugin->programCount()) - return plugin->setProgram(program_id, true, true, false, true); - - qCritical("CarlaBackendStandalone::set_program(%i, %i) - program_id out of bounds", pluginId, program_id); - return; - } - - qCritical("CarlaBackendStandalone::set_program(%i, %i) - could not find plugin", pluginId, program_id); -} - -void set_midi_program(unsigned short pluginId, uint32_t midi_program_id) -{ - qDebug("CarlaBackendStandalone::set_midi_program(%i, %i)", pluginId, midi_program_id); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (midi_program_id < plugin->midiProgramCount()) - return plugin->setMidiProgram(midi_program_id, true, true, false, true); - - qCritical("CarlaBackendStandalone::set_midi_program(%i, %i) - midi_program_id out of bounds", pluginId, midi_program_id); - return; - } - - qCritical("CarlaBackendStandalone::set_midi_program(%i, %i) - could not find plugin", pluginId, midi_program_id); -} - -// ------------------------------------------------------------------------------------------------------------------- - -void set_custom_data(unsigned short pluginId, const char* type, const char* key, const char* value) -{ - qDebug("CarlaBackendStandalone::set_custom_data(%i, \"%s\", \"%s\", \"%s\")", pluginId, type, key, value); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->setCustomData(type, key, value, true); - - qCritical("CarlaBackendStandalone::set_custom_data(%i, \"%s\", \"%s\", \"%s\") - could not find plugin", pluginId, type, key, value); -} - -void set_chunk_data(unsigned short pluginId, const char* chunk_data) -{ - qDebug("CarlaBackendStandalone::set_chunk_data(%i, \"%s\")", pluginId, chunk_data); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - { - if (plugin->hints() & CarlaBackend::PLUGIN_USES_CHUNKS) - return plugin->setChunkData(chunk_data); - - qCritical("CarlaBackendStandalone::set_chunk_data(%i, \"%s\") - plugin does not support chunks", pluginId, chunk_data); - return; - } - - qCritical("CarlaBackendStandalone::set_chunk_data(%i, \"%s\") - could not find plugin", pluginId, chunk_data); -} - -void set_gui_container(unsigned short pluginId, uintptr_t gui_addr) -{ - qDebug("CarlaBackendStandalone::set_gui_container(%i, " P_UINTPTR ")", pluginId, gui_addr); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->setGuiContainer((GuiContainer*)CarlaBackend::getPointerFromAddress(gui_addr)); - - qCritical("CarlaBackendStandalone::set_gui_container(%i, " P_UINTPTR ") - could not find plugin", pluginId, gui_addr); -} - -// ------------------------------------------------------------------------------------------------------------------- - -void show_gui(unsigned short pluginId, bool yesno) -{ - qDebug("CarlaBackendStandalone::show_gui(%i, %s)", pluginId, bool2str(yesno)); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->showGui(yesno); - - qCritical("CarlaBackendStandalone::show_gui(%i, %s) - could not find plugin", pluginId, bool2str(yesno)); -} - -void idle_guis() -{ - CARLA_ASSERT(standalone.engine); - - if (standalone.engine) - standalone.engine->idlePluginGuis(); -} - -// ------------------------------------------------------------------------------------------------------------------- - -void send_midi_note(unsigned short pluginId, uint8_t channel, uint8_t note, uint8_t velocity) -{ - qDebug("CarlaBackendStandalone::send_midi_note(%i, %i, %i, %i)", pluginId, channel, note, velocity); - CARLA_ASSERT(standalone.engine); - - if (! (standalone.engine && standalone.engine->isRunning())) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->sendMidiSingleNote(channel, note, velocity, true, true, false); - - qCritical("CarlaBackendStandalone::send_midi_note(%i, %i, %i, %i) - could not find plugin", pluginId, channel, note, velocity); -} - -void prepare_for_save(unsigned short pluginId) -{ - qDebug("CarlaBackendStandalone::prepare_for_save(%i)", pluginId); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return; - - CarlaBackend::CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId); - - if (plugin) - return plugin->prepareForSave(); - - qCritical("CarlaBackendStandalone::prepare_for_save(%i) - could not find plugin", pluginId); -} - -// ------------------------------------------------------------------------------------------------------------------- - -uint32_t get_buffer_size() -{ - qDebug("CarlaBackendStandalone::get_buffer_size()"); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return 0; - - return standalone.engine->getBufferSize(); -} - -double get_sample_rate() -{ - qDebug("CarlaBackendStandalone::get_sample_rate()"); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return 0.0; - - return standalone.engine->getSampleRate(); -} - -// ------------------------------------------------------------------------------------------------------------------- - -const char* get_last_error() -{ - qDebug("CarlaBackendStandalone::get_last_error()"); - - if (standalone.engine) - return standalone.engine->getLastError(); - - return standalone.lastError; -} - -const char* get_host_osc_url() -{ - qDebug("CarlaBackendStandalone::get_host_osc_url()"); - CARLA_ASSERT(standalone.engine); - - if (! standalone.engine) - return nullptr; - - return standalone.engine->getOscServerPathTCP(); -} - -// ------------------------------------------------------------------------------------------------------------------- - -void set_callback_function(CarlaBackend::CallbackFunc func) -{ - qDebug("CarlaBackendStandalone::set_callback_function(%p)", func); - - standalone.callback = func; - - if (standalone.engine) - standalone.engine->setCallback(func, nullptr); -} - -void set_option(CarlaBackend::OptionsType option, int value, const char* value_str) -{ - qDebug("CarlaBackendStandalone::set_option(%s, %i, \"%s\")", CarlaBackend::OptionsType2Str(option), value, value_str); - - if (standalone.engine) - standalone.engine->setOption(option, value, value_str); - - switch (option) - { - case CarlaBackend::OPTION_PROCESS_NAME: - standalone.procName = value_str; - break; - - case CarlaBackend::OPTION_PROCESS_MODE: - if (value < CarlaBackend::PROCESS_MODE_SINGLE_CLIENT || value > CarlaBackend::PROCESS_MODE_PATCHBAY) - return qCritical("CarlaBackendStandalone::set_option(%s, %i, \"%s\") - invalid value", OptionsType2Str(option), value, value_str); - - standalone.options.processMode = static_cast(value); - break; - - case CarlaBackend::OPTION_PROCESS_HIGH_PRECISION: - standalone.options.processHighPrecision = value; - break; - - case CarlaBackend::OPTION_MAX_PARAMETERS: - standalone.options.maxParameters = (value > 0) ? value : CarlaBackend::MAX_PARAMETERS; - break; - - case CarlaBackend::OPTION_PREFERRED_BUFFER_SIZE: - standalone.options.preferredBufferSize = value; - break; - - case CarlaBackend::OPTION_PREFERRED_SAMPLE_RATE: - standalone.options.preferredSampleRate = value; - break; - - case CarlaBackend::OPTION_FORCE_STEREO: - standalone.options.forceStereo = value; - break; - - case CarlaBackend::OPTION_USE_DSSI_VST_CHUNKS: - standalone.options.useDssiVstChunks = value; - break; - - case CarlaBackend::OPTION_PREFER_PLUGIN_BRIDGES: - standalone.options.preferPluginBridges = value; - break; - - case CarlaBackend::OPTION_PREFER_UI_BRIDGES: - standalone.options.preferUiBridges = value; - break; - - case CarlaBackend::OPTION_OSC_UI_TIMEOUT: - standalone.options.oscUiTimeout = value; - break; - - case CarlaBackend::OPTION_PATH_BRIDGE_POSIX32: - standalone.options.bridge_posix32 = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_POSIX64: - standalone.options.bridge_posix64 = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_WIN32: - standalone.options.bridge_win32 = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_WIN64: - standalone.options.bridge_win64 = value_str; - break; - - case CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK2: - standalone.options.bridge_lv2gtk2 = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK3: - standalone.options.bridge_lv2gtk3 = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT4: - standalone.options.bridge_lv2qt4 = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT5: - standalone.options.bridge_lv2qt5 = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_LV2_COCOA: - standalone.options.bridge_lv2cocoa = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_LV2_WINDOWS: - standalone.options.bridge_lv2win = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_LV2_X11: - standalone.options.bridge_lv2x11 = value_str; - break; - - case CarlaBackend::OPTION_PATH_BRIDGE_VST_COCOA: - standalone.options.bridge_vstcocoa = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_VST_HWND: - standalone.options.bridge_vsthwnd = value_str; - break; - case CarlaBackend::OPTION_PATH_BRIDGE_VST_X11: - standalone.options.bridge_vstx11 = value_str; - break; - } -} - -// ------------------------------------------------------------------------------------------------------------------- - -#define NSM_API_VERSION_MAJOR 1 -#define NSM_API_VERSION_MINOR 0 - -class CarlaNSM -{ -public: - CarlaNSM() - { - m_controlAddr = nullptr; - m_serverThread = nullptr; - m_isOpened = false; - m_isSaved = false; - } - - ~CarlaNSM() - { - if (m_controlAddr) - lo_address_free(m_controlAddr); - - if (m_serverThread) - { - lo_server_thread_stop(m_serverThread); - lo_server_thread_del_method(m_serverThread, "/reply", "ssss"); - lo_server_thread_del_method(m_serverThread, "/nsm/client/open", "sss"); - lo_server_thread_del_method(m_serverThread, "/nsm/client/save", ""); - lo_server_thread_free(m_serverThread); - } - } - - void announce(const char* const url, const int pid) - { - lo_address addr = lo_address_new_from_url(url); - int proto = lo_address_get_protocol(addr); - - if (! m_serverThread) - { - // create new OSC thread - m_serverThread = lo_server_thread_new_with_proto(nullptr, proto, error_handler); - - // register message handlers and start OSC thread - lo_server_thread_add_method(m_serverThread, "/reply", "ssss", _reply_handler, this); - lo_server_thread_add_method(m_serverThread, "/nsm/client/open", "sss", _nsm_open_handler, this); - lo_server_thread_add_method(m_serverThread, "/nsm/client/save", "", _nsm_save_handler, this); - lo_server_thread_start(m_serverThread); - } - - lo_send_from(addr, lo_server_thread_get_server(m_serverThread), LO_TT_IMMEDIATE, "/nsm/server/announce", "sssiii", - "Carla", ":switch:", "carla", NSM_API_VERSION_MAJOR, NSM_API_VERSION_MINOR, pid); - - lo_address_free(addr); - } - - void replyOpen() - { - m_isOpened = true; - } - - void replySave() - { - m_isSaved = true; - } - -protected: - int reply_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg) - { - qDebug("CarlaNSM::reply_handler(%s, %i, %p, %s, %p)", path, argc, argv, types, msg); - - m_controlAddr = lo_address_new_from_url(lo_address_get_url(lo_message_get_source(msg))); - - const char* const method = &argv[0]->s; - - if (strcmp(method, "/nsm/server/announce") == 0 && standalone.callback) - standalone.callback(nullptr, CarlaBackend::CALLBACK_NSM_ANNOUNCE, 0, 0, 0, 0.0, nullptr); // FIXME? - - return 0; - } - - int nsm_open_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg) - { - qDebug("CarlaNSM::nsm_open_handler(\"%s\", \"%s\", %p, %i, %p)", path, types, argv, argc, msg); - - if (! standalone.callback) - return 1; - - const char* const projectPath = &argv[0]->s; - const char* const clientId = &argv[2]->s; - - standalone.callback(nullptr, CarlaBackend::CALLBACK_NSM_OPEN1, 0, 0, 0, 0.0, clientId); - standalone.callback(nullptr, CarlaBackend::CALLBACK_NSM_OPEN2, 0, 0, 0, 0.0, projectPath); - - for (int i=0; i < 30 && ! m_isOpened; i++) - carla_msleep(100); - - if (m_controlAddr) - lo_send_from(m_controlAddr, lo_server_thread_get_server(m_serverThread), LO_TT_IMMEDIATE, "/reply", "ss", "/nsm/client/open", "OK"); - - return 0; - } - - int nsm_save_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg) - { - qDebug("CarlaNSM::nsm_save_handler(\"%s\", \"%s\", %p, %i, %p)", path, types, argv, argc, msg); - - if (! standalone.callback) - return 1; - - standalone.callback(nullptr, CarlaBackend::CALLBACK_NSM_SAVE, 0, 0, 0, 0.0, nullptr); - - for (int i=0; i < 30 && ! m_isSaved; i++) - carla_msleep(100); - - if (m_controlAddr) - lo_send_from(m_controlAddr, lo_server_thread_get_server(m_serverThread), LO_TT_IMMEDIATE, "/reply", "ss", "/nsm/client/save", "OK"); - - return 0; - } - -private: - lo_address m_controlAddr; - lo_server_thread m_serverThread; - bool m_isOpened, m_isSaved; - - static int _reply_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg, void* const data) - { - CARLA_ASSERT(data); - CarlaNSM* const _this_ = (CarlaNSM*)data; - return _this_->reply_handler(path, types, argv, argc, msg); - } - - static int _nsm_open_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg, void* const data) - { - CARLA_ASSERT(data); - CarlaNSM* const _this_ = (CarlaNSM*)data; - return _this_->nsm_open_handler(path, types, argv, argc, msg); - } - - static int _nsm_save_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg, void* const data) - { - CARLA_ASSERT(data); - CarlaNSM* const _this_ = (CarlaNSM*)data; - return _this_->nsm_save_handler(path, types, argv, argc, msg); - } - - static void error_handler(const int num, const char* const msg, const char* const path) - { - qCritical("CarlaNSM::error_handler(%i, \"%s\", \"%s\")", num, msg, path); - } -}; - -static CarlaNSM carlaNSM; - -void nsm_announce(const char* url, int pid) -{ - carlaNSM.announce(url, pid); -} - -void nsm_reply_open() -{ - carlaNSM.replyOpen(); -} - -void nsm_reply_save() -{ - carlaNSM.replySave(); -} - -// ------------------------------------------------------------------------------------------------------------------- - -#if 0 //def QTCREATOR_TEST - -#include -#include - -QDialog* vstGui = nullptr; - -void main_callback(void* ptr, CarlaBackend::CallbackType action, unsigned short pluginId, int value1, int value2, double value3) -{ - switch (action) - { - case CarlaBackend::CALLBACK_SHOW_GUI: - if (vstGui && ! value1) - vstGui->close(); - break; - case CarlaBackend::CALLBACK_RESIZE_GUI: - vstGui->setFixedSize(value1, value2); - break; - default: - break; - } - - Q_UNUSED(ptr); - Q_UNUSED(pluginId); - Q_UNUSED(value3); -} - -void run_tests_standalone(short idMax) -{ - for (short id = 0; id <= idMax; id++) - { - qDebug("------------------- TEST @%i: non-parameter calls --------------------", id); - get_plugin_info(id); - get_audio_port_count_info(id); - get_midi_port_count_info(id); - get_parameter_count_info(id); - get_gui_info(id); - get_chunk_data(id); - get_parameter_count(id); - get_program_count(id); - get_midi_program_count(id); - get_custom_data_count(id); - get_real_plugin_name(id); - get_current_program_index(id); - get_current_midi_program_index(id); - - qDebug("------------------- TEST @%i: parameter calls [-1] --------------------", id); - get_parameter_info(id, -1); - get_parameter_scalepoint_info(id, -1, -1); - get_parameter_data(id, -1); - get_parameter_ranges(id, -1); - get_midi_program_data(id, -1); - get_custom_data(id, -1); - get_parameter_text(id, -1); - get_program_name(id, -1); - get_midi_program_name(id, -1); - get_default_parameter_value(id, -1); - get_current_parameter_value(id, -1); - get_input_peak_value(id, -1); - get_output_peak_value(id, -1); - - qDebug("------------------- TEST @%i: parameter calls [0] --------------------", id); - get_parameter_info(id, 0); - get_parameter_scalepoint_info(id, 0, -1); - get_parameter_scalepoint_info(id, 0, 0); - get_parameter_data(id, 0); - get_parameter_ranges(id, 0); - get_midi_program_data(id, 0); - get_custom_data(id, 0); - get_parameter_text(id, 0); - get_program_name(id, 0); - get_midi_program_name(id, 0); - get_default_parameter_value(id, 0); - get_current_parameter_value(id, 0); - get_input_peak_value(id, 0); - get_input_peak_value(id, 1); - get_input_peak_value(id, 2); - get_output_peak_value(id, 0); - get_output_peak_value(id, 1); - get_output_peak_value(id, 2); - - qDebug("------------------- TEST @%i: set extra data --------------------", id); - set_custom_data(id, CarlaBackend::CUSTOM_DATA_STRING, "", ""); - set_chunk_data(id, nullptr); - set_gui_container(id, (uintptr_t)1); - - qDebug("------------------- TEST @%i: gui stuff --------------------", id); - show_gui(id, false); - show_gui(id, true); - show_gui(id, true); - - idle_guis(); - idle_guis(); - idle_guis(); - - qDebug("------------------- TEST @%i: other --------------------", id); - send_midi_note(id, 15, 127, 127); - send_midi_note(id, 0, 0, 0); - - prepare_for_save(id); - prepare_for_save(id); - prepare_for_save(id); - } -} - -int main(int argc, char* argv[]) -{ - using namespace CarlaBackend; - - // Qt app - QApplication app(argc, argv); - - // Qt gui (for vst) - vstGui = new QDialog(nullptr); - - // set callback and options - set_callback_function(main_callback); - set_option(OPTION_PREFER_UI_BRIDGES, 0, nullptr); - //set_option(OPTION_PROCESS_MODE, PROCESS_MODE_CONTINUOUS_RACK, nullptr); - - // start engine - if (! engine_init("JACK", "carla_demo")) - { - qCritical("failed to start backend engine, reason:\n%s", get_last_error()); - delete vstGui; - return 1; - } - - short id_ladspa = add_plugin(BINARY_NATIVE, PLUGIN_LADSPA, "/usr/lib/ladspa/LEET_eqbw2x2.so", "LADSPA plug name, test long name - " - "------- name ------------ name2 ----------- name3 ------------ name4 ------------ name5 ---------- name6", "leet_equalizer_bw2x2", nullptr); - - short id_dssi = add_plugin(BINARY_NATIVE, PLUGIN_DSSI, "/usr/lib/dssi/fluidsynth-dssi.so", "DSSI pname, short-utf8 _ \xAE", "FluidSynth-DSSI", (void*)"/usr/lib/dssi/fluidsynth-dssi/FluidSynth-DSSI_gtk"); - short id_native = add_plugin(BINARY_NATIVE, PLUGIN_INTERNAL, "", "ZynHere", "zynaddsubfx", nullptr); - - //short id_lv2 = add_plugin(BINARY_NATIVE, PLUGIN_LV2, "FILENAME", "HAHA name!!!", "http://studionumbersix.com/foo/lv2/yc20", nullptr); - - //short id_vst = add_plugin(BINARY_NATIVE, PLUGIN_LV2, "FILENAME", "HAHA name!!!", "http://studionumbersix.com/foo/lv2/yc20", nullptr); - - if (id_ladspa < 0 || id_dssi < 0 || id_native < 0) - { - qCritical("failed to start load plugins, reason:\n%s", get_last_error()); - delete vstGui; - return 1; - } - - //const GuiInfo* const guiInfo = get_gui_info(id); - //if (guiInfo->type == CarlaBackend::GUI_INTERNAL_QT4 || guiInfo->type == CarlaBackend::GUI_INTERNAL_X11) - //{ - // set_gui_data(id, 0, (uintptr_t)gui); - //gui->show(); - //} - - // activate - set_active(id_ladspa, true); - set_active(id_dssi, true); - set_active(id_native, true); - - // start guis - show_gui(id_dssi, true); - carla_sleep(1); - - // do tests - run_tests_standalone(id_dssi+1); - - // lock - app.exec(); - - delete vstGui; - vstGui = nullptr; - - remove_plugin(id_ladspa); - remove_plugin(id_dssi); - remove_plugin(id_native); - engine_close(); - - return 0; -} - -#endif diff --git a/c++/carla-backend/carla_backend_standalone.hpp b/c++/carla-backend/carla_backend_standalone.hpp deleted file mode 100644 index 7147c8a..0000000 --- a/c++/carla-backend/carla_backend_standalone.hpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Carla Backend - * Copyright (C) 2011-2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#ifndef CARLA_BACKEND_STANDALONE_H -#define CARLA_BACKEND_STANDALONE_H - -#include - -#include "carla_backend.hpp" - -// TODO - create struct for internal plugin info -// TODO - dont strdup() on const-char* returns, use static char[STR_MAX] - -/*! - * @defgroup CarlaBackendStandalone Carla Backend Standalone - * - * The Carla Backend Standalone API - * - * @{ - */ - -struct PluginInfo { - CarlaBackend::PluginType type; - CarlaBackend::PluginCategory category; - unsigned int hints; - const char* binary; - const char* name; - const char* label; - const char* maker; - const char* copyright; - long uniqueId; - - PluginInfo() - : type(CarlaBackend::PLUGIN_NONE), - category(CarlaBackend::PLUGIN_CATEGORY_NONE), - hints(0x0), - binary(nullptr), - name(nullptr), - label(nullptr), - maker(nullptr), - copyright(nullptr), - uniqueId(0) {} -}; - -struct PortCountInfo { - uint32_t ins; - uint32_t outs; - uint32_t total; - - PortCountInfo() - : ins(0), - outs(0), - total(0) {} -}; - -struct ParameterInfo { - const char* name; - const char* symbol; - const char* unit; - uint32_t scalePointCount; - - ParameterInfo() - : name(nullptr), - symbol(nullptr), - unit(nullptr), - scalePointCount(0) {} -}; - -struct ScalePointInfo { - double value; - const char* label; - - ScalePointInfo() - : value(0.0), - label(nullptr) {} -}; - -struct GuiInfo { - CarlaBackend::GuiType type; - bool resizable; - - GuiInfo() - : type(CarlaBackend::GUI_NONE), - resizable(false) {} -}; - -CARLA_EXPORT const char* get_extended_license_text(); - -CARLA_EXPORT unsigned int get_engine_driver_count(); -CARLA_EXPORT const char* get_engine_driver_name(unsigned int index); - -CARLA_EXPORT unsigned int get_internal_plugin_count(); -CARLA_EXPORT const PluginInfo* get_internal_plugin_info(unsigned int pluginId); - -CARLA_EXPORT bool engine_init(const char* driverName, const char* clientName); -CARLA_EXPORT bool engine_close(); -CARLA_EXPORT bool is_engine_running(); - -CARLA_EXPORT short add_plugin(CarlaBackend::BinaryType btype, CarlaBackend::PluginType ptype, const char* filename, const char* name, const char* label, void* extraStuff); -CARLA_EXPORT bool remove_plugin(unsigned short pluginId); - -CARLA_EXPORT const PluginInfo* get_plugin_info(unsigned short pluginId); -CARLA_EXPORT const PortCountInfo* get_audio_port_count_info(unsigned short pluginId); -CARLA_EXPORT const PortCountInfo* get_midi_port_count_info(unsigned short pluginId); -CARLA_EXPORT const PortCountInfo* get_parameter_count_info(unsigned short pluginId); -CARLA_EXPORT const ParameterInfo* get_parameter_info(unsigned short plugin_id, uint32_t parameterId); -CARLA_EXPORT const ScalePointInfo* get_parameter_scalepoint_info(unsigned short pluginId, uint32_t parameterId, uint32_t scalePointId); -CARLA_EXPORT const GuiInfo* get_gui_info(unsigned short pluginId); - -CARLA_EXPORT const CarlaBackend::ParameterData* get_parameter_data(unsigned short pluginId, uint32_t parameterId); -CARLA_EXPORT const CarlaBackend::ParameterRanges* get_parameter_ranges(unsigned short pluginId, uint32_t parameterId); -CARLA_EXPORT const CarlaBackend::MidiProgramData* get_midi_program_data(unsigned short pluginId, uint32_t midiProgramId); -CARLA_EXPORT const CarlaBackend::CustomData* get_custom_data(unsigned short pluginId, uint32_t customDataId); -CARLA_EXPORT const char* get_chunk_data(unsigned short pluginId); - -CARLA_EXPORT uint32_t get_parameter_count(unsigned short pluginId); -CARLA_EXPORT uint32_t get_program_count(unsigned short pluginId); -CARLA_EXPORT uint32_t get_midi_program_count(unsigned short pluginId); -CARLA_EXPORT uint32_t get_custom_data_count(unsigned short pluginId); - -CARLA_EXPORT const char* get_parameter_text(unsigned short pluginId, uint32_t parameterId); -CARLA_EXPORT const char* get_program_name(unsigned short pluginId, uint32_t programId); -CARLA_EXPORT const char* get_midi_program_name(unsigned short pluginId, uint32_t midiProgramId); -CARLA_EXPORT const char* get_real_plugin_name(unsigned short pluginId); - -CARLA_EXPORT int32_t get_current_program_index(unsigned short pluginId); -CARLA_EXPORT int32_t get_current_midi_program_index(unsigned short pluginId); - -CARLA_EXPORT double get_default_parameter_value(unsigned short pluginId, uint32_t parameterId); -CARLA_EXPORT double get_current_parameter_value(unsigned short pluginId, uint32_t parameterId); - -CARLA_EXPORT double get_input_peak_value(unsigned short pluginId, unsigned short portId); -CARLA_EXPORT double get_output_peak_value(unsigned short pluginId, unsigned short portId); - -CARLA_EXPORT void set_active(unsigned short pluginId, bool onOff); -CARLA_EXPORT void set_drywet(unsigned short pluginId, double value); -CARLA_EXPORT void set_volume(unsigned short pluginId, double value); -CARLA_EXPORT void set_balance_left(unsigned short pluginId, double value); -CARLA_EXPORT void set_balance_right(unsigned short pluginId, double value); - -CARLA_EXPORT void set_parameter_value(unsigned short pluginId, uint32_t parameterId, double value); -CARLA_EXPORT void set_parameter_midi_channel(unsigned short pluginId, uint32_t parameterId, uint8_t channel); -CARLA_EXPORT void set_parameter_midi_cc(unsigned short pluginId, uint32_t parameterId, int16_t cc); -CARLA_EXPORT void set_program(unsigned short pluginId, uint32_t programId); -CARLA_EXPORT void set_midi_program(unsigned short pluginId, uint32_t midiProgramId); - -CARLA_EXPORT void set_custom_data(unsigned short pluginId, const char* type, const char* key, const char* value); -CARLA_EXPORT void set_chunk_data(unsigned short pluginId, const char* chunkData); -CARLA_EXPORT void set_gui_container(unsigned short pluginId, uintptr_t guiAddr); - -CARLA_EXPORT void show_gui(unsigned short pluginId, bool yesNo); -CARLA_EXPORT void idle_guis(); - -CARLA_EXPORT void send_midi_note(unsigned short pluginId, uint8_t channel, uint8_t note, uint8_t velocity); -CARLA_EXPORT void prepare_for_save(unsigned short pluginId); - -CARLA_EXPORT uint32_t get_buffer_size(); -CARLA_EXPORT double get_sample_rate(); - -CARLA_EXPORT const char* get_last_error(); -CARLA_EXPORT const char* get_host_osc_url(); - -CARLA_EXPORT void set_callback_function(CarlaBackend::CallbackFunc func); -CARLA_EXPORT void set_option(CarlaBackend::OptionsType option, int value, const char* valueStr); - -CARLA_EXPORT void nsm_announce(const char* url, int pid); -CARLA_EXPORT void nsm_reply_open(); -CARLA_EXPORT void nsm_reply_save(); - -/**@}*/ - -#endif // CARLA_BACKEND_STANDALONE_H diff --git a/c++/carla-backend/carla_backend_utils.hpp b/c++/carla-backend/carla_backend_utils.hpp deleted file mode 100644 index 22c884f..0000000 --- a/c++/carla-backend/carla_backend_utils.hpp +++ /dev/null @@ -1,459 +0,0 @@ -/* - * Carla Backend - * Copyright (C) 2011-2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#ifndef CARLA_BACKEND_UTILS_HPP -#define CARLA_BACKEND_UTILS_HPP - -#include "carla_backend.hpp" -#include "carla_utils.hpp" - -CARLA_BACKEND_START_NAMESPACE - -/*! - * @defgroup CarlaBackendUtils Carla Backend Utils - * - * Carla Backend Utils - * - * @{ - */ - -static inline -const char* BinaryType2Str(const BinaryType& type) -{ - switch (type) - { - case BINARY_NONE: - return "BINARY_NONE"; - case BINARY_POSIX32: - return "BINARY_POSIX32"; - case BINARY_POSIX64: - return "BINARY_POSIX64"; - case BINARY_WIN32: - return "BINARY_WIN32"; - case BINARY_WIN64: - return "BINARY_WIN64"; - case BINARY_OTHER: - return "BINARY_OTHER"; - } - - qWarning("CarlaBackend::BinaryType2Str(%i) - invalid type", type); - return nullptr; -} - -static inline -const char* PluginType2Str(const PluginType& type) -{ - switch (type) - { - case PLUGIN_NONE: - return "PLUGIN_NONE"; - case PLUGIN_INTERNAL: - return "PLUGIN_INTERNAL"; - case PLUGIN_LADSPA: - return "PLUGIN_LADSPA"; - case PLUGIN_DSSI: - return "PLUGIN_DSSI"; - case PLUGIN_LV2: - return "PLUGIN_LV2"; - case PLUGIN_VST: - return "PLUGIN_VST"; - case PLUGIN_GIG: - return "PLUGIN_GIG"; - case PLUGIN_SF2: - return "PLUGIN_SF2"; - case PLUGIN_SFZ: - return "PLUGIN_SFZ"; - } - - qWarning("CarlaBackend::PluginType2Str(%i) - invalid type", type); - return nullptr; -} - -static inline -const char* PluginCategory2Str(const PluginCategory& category) -{ - switch (category) - { - case PLUGIN_CATEGORY_NONE: - return "PLUGIN_CATEGORY_NONE"; - case PLUGIN_CATEGORY_SYNTH: - return "PLUGIN_CATEGORY_SYNTH"; - case PLUGIN_CATEGORY_DELAY: - return "PLUGIN_CATEGORY_DELAY"; - case PLUGIN_CATEGORY_EQ: - return "PLUGIN_CATEGORY_EQ"; - case PLUGIN_CATEGORY_FILTER: - return "PLUGIN_CATEGORY_FILTER"; - case PLUGIN_CATEGORY_DYNAMICS: - return "PLUGIN_CATEGORY_DYNAMICS"; - case PLUGIN_CATEGORY_MODULATOR: - return "PLUGIN_CATEGORY_MODULATOR"; - case PLUGIN_CATEGORY_UTILITY: - return "PLUGIN_CATEGORY_UTILITY"; - case PLUGIN_CATEGORY_OTHER: - return "PLUGIN_CATEGORY_OTHER"; - } - - qWarning("CarlaBackend::PluginCategory2Str(%i) - invalid category", category); - return nullptr; -} - -static inline -const char* ParameterType2Str(const ParameterType& type) -{ - switch (type) - { - case PARAMETER_UNKNOWN: - return "PARAMETER_UNKNOWN"; - case PARAMETER_INPUT: - return "PARAMETER_INPUT"; - case PARAMETER_OUTPUT: - return "PARAMETER_OUTPUT"; - case PARAMETER_LATENCY: - return "PARAMETER_LATENCY"; - case PARAMETER_SAMPLE_RATE: - return "PARAMETER_SAMPLE_RATE"; - case PARAMETER_LV2_FREEWHEEL: - return "PARAMETER_LV2_FREEWHEEL"; - case PARAMETER_LV2_TIME: - return "PARAMETER_LV2_TIME"; - } - - qWarning("CarlaBackend::ParameterType2Str(%i) - invalid type", type); - return nullptr; -} - -static inline -const char* InternalParametersIndex2Str(const InternalParametersIndex& index) -{ - switch (index) - { - case PARAMETER_NULL: - return "PARAMETER_NULL"; - case PARAMETER_ACTIVE: - return "PARAMETER_ACTIVE"; - case PARAMETER_DRYWET: - return "PARAMETER_DRYWET"; - case PARAMETER_VOLUME: - return "PARAMETER_VOLUME"; - case PARAMETER_BALANCE_LEFT: - return "PARAMETER_BALANCE_LEFT"; - case PARAMETER_BALANCE_RIGHT: - return "PARAMETER_BALANCE_RIGHT"; - } - - qWarning("CarlaBackend::InternalParametersIndex2Str(%i) - invalid index", index); - return nullptr; -} - -static inline -const char* GuiType2Str(const GuiType& type) -{ - switch (type) - { - case GUI_NONE: - return "GUI_NONE"; - case GUI_INTERNAL_QT4: - return "GUI_INTERNAL_QT4"; - case GUI_INTERNAL_COCOA: - return "GUI_INTERNAL_COCOA"; - case GUI_INTERNAL_HWND: - return "GUI_INTERNAL_HWND"; - case GUI_INTERNAL_X11: - return "GUI_INTERNAL_X11"; - case GUI_EXTERNAL_LV2: - return "GUI_EXTERNAL_LV2"; - case GUI_EXTERNAL_SUIL: - return "GUI_EXTERNAL_SUIL"; - case GUI_EXTERNAL_OSC: - return "GUI_EXTERNAL_OSC"; - } - - qWarning("CarlaBackend::GuiType2Str(%i) - invalid type", type); - return nullptr; -} - -static inline -const char* OptionsType2Str(const OptionsType& type) -{ - switch (type) - { - case OPTION_PROCESS_NAME: - return "OPTION_PROCESS_NAME"; - case OPTION_PROCESS_MODE: - return "OPTION_PROCESS_MODE"; - case OPTION_PROCESS_HIGH_PRECISION: - return "OPTION_PROCESS_HIGH_PRECISION"; - case OPTION_MAX_PARAMETERS: - return "OPTION_MAX_PARAMETERS"; - case OPTION_PREFERRED_BUFFER_SIZE: - return "OPTION_PREFERRED_BUFFER_SIZE"; - case OPTION_PREFERRED_SAMPLE_RATE: - return "OPTION_PREFERRED_SAMPLE_RATE"; - case OPTION_FORCE_STEREO: - return "OPTION_FORCE_STEREO"; - case OPTION_USE_DSSI_VST_CHUNKS: - return "OPTION_USE_DSSI_VST_CHUNKS"; - case OPTION_PREFER_PLUGIN_BRIDGES: - return "OPTION_PREFER_PLUGIN_BRIDGES"; - case OPTION_PREFER_UI_BRIDGES: - return "OPTION_PREFER_UI_BRIDGES"; - case OPTION_OSC_UI_TIMEOUT: - return "OPTION_OSC_UI_TIMEOUT"; - case OPTION_PATH_BRIDGE_POSIX32: - return "OPTION_PATH_BRIDGE_POSIX32"; - case OPTION_PATH_BRIDGE_POSIX64: - return "OPTION_PATH_BRIDGE_POSIX64"; - case OPTION_PATH_BRIDGE_WIN32: - return "OPTION_PATH_BRIDGE_WIN32"; - case OPTION_PATH_BRIDGE_WIN64: - return "OPTION_PATH_BRIDGE_WIN64"; - case OPTION_PATH_BRIDGE_LV2_GTK2: - return "OPTION_PATH_BRIDGE_LV2_GTK2"; - case OPTION_PATH_BRIDGE_LV2_GTK3: - return "OPTION_PATH_BRIDGE_LV2_GTK3"; - case OPTION_PATH_BRIDGE_LV2_QT4: - return "OPTION_PATH_BRIDGE_LV2_QT4"; - case OPTION_PATH_BRIDGE_LV2_QT5: - return "OPTION_PATH_BRIDGE_LV2_QT5"; - case OPTION_PATH_BRIDGE_LV2_COCOA: - return "OPTION_PATH_BRIDGE_LV2_COCOA"; - case OPTION_PATH_BRIDGE_LV2_WINDOWS: - return "OPTION_PATH_BRIDGE_LV2_WINDOWS"; - case OPTION_PATH_BRIDGE_LV2_X11: - return "OPTION_PATH_BRIDGE_LV2_X11"; - case OPTION_PATH_BRIDGE_VST_COCOA: - return "OPTION_PATH_BRIDGE_VST_COCOA"; - case OPTION_PATH_BRIDGE_VST_HWND: - return "OPTION_PATH_BRIDGE_VST_HWND"; - case OPTION_PATH_BRIDGE_VST_X11: - return "OPTION_PATH_BRIDGE_VST_X11"; - } - - qWarning("CarlaBackend::OptionsType2Str(%i) - invalid type", type); - return nullptr; -} - -static inline -const char* CallbackType2Str(const CallbackType& type) -{ - switch (type) - { - case CALLBACK_DEBUG: - return "CALLBACK_DEBUG"; - case CALLBACK_PARAMETER_VALUE_CHANGED: - return "CALLBACK_PARAMETER_VALUE_CHANGED"; - case CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: - return "CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED"; - case CALLBACK_PARAMETER_MIDI_CC_CHANGED: - return "CALLBACK_PARAMETER_MIDI_CC_CHANGED"; - case CALLBACK_PROGRAM_CHANGED: - return "CALLBACK_PROGRAM_CHANGED"; - case CALLBACK_MIDI_PROGRAM_CHANGED: - return "CALLBACK_MIDI_PROGRAM_CHANGED"; - case CALLBACK_NOTE_ON: - return "CALLBACK_NOTE_ON"; - case CALLBACK_NOTE_OFF: - return "CALLBACK_NOTE_OFF"; - case CALLBACK_SHOW_GUI: - return "CALLBACK_SHOW_GUI"; - case CALLBACK_RESIZE_GUI: - return "CALLBACK_RESIZE_GUI"; - case CALLBACK_UPDATE: - return "CALLBACK_UPDATE"; - case CALLBACK_RELOAD_INFO: - return "CALLBACK_RELOAD_INFO"; - case CALLBACK_RELOAD_PARAMETERS: - return "CALLBACK_RELOAD_PARAMETERS"; - case CALLBACK_RELOAD_PROGRAMS: - return "CALLBACK_RELOAD_PROGRAMS"; - case CALLBACK_RELOAD_ALL: - return "CALLBACK_RELOAD_ALL"; - case CALLBACK_NSM_ANNOUNCE: - return "CALLBACK_NSM_ANNOUNCE"; - case CALLBACK_NSM_OPEN1: - return "CALLBACK_NSM_OPEN1"; - case CALLBACK_NSM_OPEN2: - return "CALLBACK_NSM_OPEN2"; - case CALLBACK_NSM_SAVE: - return "CALLBACK_NSM_SAVE"; - case CALLBACK_ERROR: - return "CALLBACK_ERROR"; - case CALLBACK_QUIT: - return "CALLBACK_QUIT"; - } - - qWarning("CarlaBackend::CallbackType2Str(%i) - invalid type", type); - return nullptr; -} - -static inline -const char* ProcessMode2Str(const ProcessMode& mode) -{ - switch (mode) - { - case PROCESS_MODE_SINGLE_CLIENT: - return "PROCESS_MODE_SINGLE_CLIENT"; - case PROCESS_MODE_MULTIPLE_CLIENTS: - return "PROCESS_MODE_MULTIPLE_CLIENTS"; - case PROCESS_MODE_CONTINUOUS_RACK: - return "PROCESS_MODE_CONTINUOUS_RACK"; - case PROCESS_MODE_PATCHBAY: - return "PROCESS_MODE_PATCHBAY"; - } - - qWarning("CarlaBackend::ProcessModeType2Str(%i) - invalid type", mode); - return nullptr; -} - -// ------------------------------------------------------------------------------------------------------------------- - -static inline -const char* getPluginTypeString(const PluginType& type) -{ - qDebug("CarlaBackend::getPluginTypeString(%s)", PluginType2Str(type)); - - switch (type) - { - case PLUGIN_NONE: - return "NONE"; - case PLUGIN_INTERNAL: - return "INTERNAL"; - case PLUGIN_LADSPA: - return "LADSPA"; - case PLUGIN_DSSI: - return "DSSI"; - case PLUGIN_LV2: - return "LV2"; - case PLUGIN_VST: - return "VST"; - case PLUGIN_GIG: - return "GIG"; - case PLUGIN_SF2: - return "SF2"; - case PLUGIN_SFZ: - return "SFZ"; - } - - return "NONE"; -} - -// ------------------------------------------------------------------------------------------------------------------- - -static inline -uintptr_t getAddressFromPointer(void* const ptr) -{ - qDebug("CarlaBackend::getAddressFromPointer(%p)", ptr); - CARLA_ASSERT(ptr != nullptr); - - uintptr_t* addr = (uintptr_t*)&ptr; - return *addr; -} - -static inline -void* getPointerFromAddress(const uintptr_t& addr) -{ - CARLA_ASSERT(addr != 0); - - uintptr_t** const ptr = (uintptr_t**)&addr; - return *ptr; -} - -static inline -PluginCategory getPluginCategoryFromName(const char* const name) -{ - qDebug("CarlaBackend::getPluginCategoryFromName(\"%s\")", name); - CARLA_ASSERT(name); - - if (! name) - return PLUGIN_CATEGORY_NONE; - - CarlaString sname(name); - - if (sname.isEmpty()) - return PLUGIN_CATEGORY_NONE; - - sname.toLower(); - - // generic tags first - if (sname.contains("delay")) - return PLUGIN_CATEGORY_DELAY; - if (sname.contains("reverb")) - return PLUGIN_CATEGORY_DELAY; - - // filter - if (sname.contains("filter")) - return PLUGIN_CATEGORY_FILTER; - - // dynamics - if (sname.contains("dynamics")) - return PLUGIN_CATEGORY_DYNAMICS; - if (sname.contains("amplifier")) - return PLUGIN_CATEGORY_DYNAMICS; - if (sname.contains("compressor")) - return PLUGIN_CATEGORY_DYNAMICS; - if (sname.contains("enhancer")) - return PLUGIN_CATEGORY_DYNAMICS; - if (sname.contains("exciter")) - return PLUGIN_CATEGORY_DYNAMICS; - if (sname.contains("gate")) - return PLUGIN_CATEGORY_DYNAMICS; - if (sname.contains("limiter")) - return PLUGIN_CATEGORY_DYNAMICS; - - // modulator - if (sname.contains("modulator")) - return PLUGIN_CATEGORY_MODULATOR; - if (sname.contains("chorus")) - return PLUGIN_CATEGORY_MODULATOR; - if (sname.contains("flanger")) - return PLUGIN_CATEGORY_MODULATOR; - if (sname.contains("phaser")) - return PLUGIN_CATEGORY_MODULATOR; - if (sname.contains("saturator")) - return PLUGIN_CATEGORY_MODULATOR; - - // utility - if (sname.contains("utility")) - return PLUGIN_CATEGORY_UTILITY; - if (sname.contains("analyzer")) - return PLUGIN_CATEGORY_UTILITY; - if (sname.contains("converter")) - return PLUGIN_CATEGORY_UTILITY; - if (sname.contains("deesser")) - return PLUGIN_CATEGORY_UTILITY; - if (sname.contains("mixer")) - return PLUGIN_CATEGORY_UTILITY; - - // common tags - if (sname.contains("verb")) - return PLUGIN_CATEGORY_DELAY; - - if (sname.contains("eq")) - return PLUGIN_CATEGORY_EQ; - - if (sname.contains("tool")) - return PLUGIN_CATEGORY_UTILITY; - - return PLUGIN_CATEGORY_NONE; -} - -/**@}*/ - -CARLA_BACKEND_END_NAMESPACE - -#endif // CARLA_BACKEND_UTILS_HPP diff --git a/c++/carla-bridge/Makefile b/c++/carla-bridge/Makefile deleted file mode 100644 index 309eb41..0000000 --- a/c++/carla-bridge/Makefile +++ /dev/null @@ -1,480 +0,0 @@ -#!/usr/bin/make -f -# Makefile for carla-bridges # -# ---------------------------------------- # -# Created by falkTX -# - -include ../Makefile.mk - -HAVE_GTK2 = $(shell pkg-config --exists gtk+-2.0 && echo true) -HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true) - -# -------------------------------------------------------------- - -BUILD_CXX_FLAGS += -DBUILD_BRIDGE -BUILD_CXX_FLAGS += -I. -I../carla-includes -I../carla-utils -BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo QtCore QtXml) -LINK_FLAGS += $(shell pkg-config --libs liblo QtCore QtXml) - -ifeq ($(CARLA_PLUGIN_SUPPORT),true) -BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST -endif - -ifeq ($(HAVE_QT5),true) -QT_UI_FLAGS = $(shell pkg-config --cflags QtWidgets) -QT_UI_LIBS = $(shell pkg-config --libs QtWidgets) -else -QT_UI_FLAGS = $(shell pkg-config --cflags QtGui) -QT_UI_LIBS = $(shell pkg-config --libs QtGui) -endif - -# -------------------------------------------------------------- -# Plugin bridges - -BUILD_PLUGIN_FLAGS = $(BUILD_CXX_FLAGS) -DBUILD_BRIDGE_PLUGIN -DBRIDGE_PLUGIN -BUILD_PLUGIN_FLAGS += -DCARLA_ENGINE_JACK -I../carla-backend -I../carla-engine -I../carla-jackbridge -I../carla-plugin -BUILD_PLUGIN_FLAGS += $(shell pkg-config --cflags jack) $(QT_UI_FLAGS) - -LINK_PLUGIN_FLAGS = $(LINK_FLAGS) -LINK_PLUGIN_FLAGS += $(QT_UI_LIBS) - -POSIX_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) -POSIX_32BIT_FLAGS = $(32BIT_FLAGS) -L/usr/lib32 -L/usr/lib/i386-linux-gnu -POSIX_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu -POSIX_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) $(shell pkg-config --libs jack) -ldl - -WIN_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) -DJACKBRIDGE_EXPORT -DPTW32_STATIC_LIB -WIN_32BIT_FLAGS = $(32BIT_FLAGS) -WIN_64BIT_FLAGS = $(64BIT_FLAGS) -WIN_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -mwindows -L../carla-jackbridge -lpthread -lwinspool -lole32 -luuid -limm32 -lshell32 -lws2_32 - -# -------------------------------------------------------------- -# UI bridges - -BUILD_UI_FLAGS = $(BUILD_CXX_FLAGS) -DBUILD_BRIDGE_UI -LINK_UI_FLAGS = $(LINK_FLAGS) -ldl - -BUILD_UI_LV2_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_LV2 -BUILD_UI_VST_FLAGS = $(BUILD_UI_FLAGS) -DBRIDGE_VST - -BUILD_UI_LV2_GTK2_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_GTK2 -DBRIDGE_LV2_GTK2 $(shell pkg-config --cflags gtk+-2.0) -LINK_UI_LV2_GTK2_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs gtk+-2.0) - -BUILD_UI_LV2_GTK3_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_GTK3 -DBRIDGE_LV2_GTK3 $(shell pkg-config --cflags gtk+-3.0) -LINK_UI_LV2_GTK3_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs gtk+-3.0) - -BUILD_UI_LV2_QT4_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_QT4 -DBRIDGE_LV2_QT4 $(shell pkg-config --cflags QtGui) -LINK_UI_LV2_QT4_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtGui) - -BUILD_UI_LV2_QT5_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_QT5 -DBRIDGE_LV2_QT5 $(shell pkg-config --cflags QtWidgets) -LINK_UI_LV2_QT5_FLAGS = $(LINK_UI_FLAGS) $(shell pkg-config --libs QtWidgets) - -BUILD_UI_LV2_HWND_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_HWND -DBRIDGE_LV2_HWND $(QT_UI_FLAGS) -LINK_UI_LV2_HWND_FLAGS = $(LINK_FLAGS) $(QT_UI_LIBS) -mwindows -static - -BUILD_UI_LV2_X11_FLAGS = $(BUILD_UI_LV2_FLAGS) -DBRIDGE_X11 -DBRIDGE_LV2_X11 $(QT_UI_FLAGS) -LINK_UI_LV2_X11_FLAGS = $(LINK_UI_FLAGS) $(QT_UI_LIBS) - -BUILD_UI_VST_HWND_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_HWND -DBRIDGE_VST_HWND $(QT_UI_FLAGS) -LINK_UI_VST_HWND_FLAGS = $(LINK_FLAGS) $(QT_UI_LIBS) -mwindows -static - -BUILD_UI_VST_X11_FLAGS = $(BUILD_UI_VST_FLAGS) -DBRIDGE_X11 -DBRIDGE_VST_X11 $(QT_UI_FLAGS) -LINK_UI_VST_X11_FLAGS = $(LINK_UI_FLAGS) $(QT_UI_LIBS) - -# -------------------------------------------------------------- - -ifeq ($(CARLA_PLUGIN_SUPPORT),true) -all: native ui_lv2-gtk2 ui_lv2-gtk3 ui_lv2-qt4 ui_lv2-qt5 ui_lv2-x11 ui_vst-x11 - -ifeq ($(HAVE_GTK2),true) -ui_lv2-gtk2: carla-bridge-lv2-gtk2 -else -ui_lv2-gtk2: -endif - -ifeq ($(HAVE_GTK3),true) -ui_lv2-gtk3: carla-bridge-lv2-gtk3 -else -ui_lv2-gtk3: -endif - -ifneq ($(HAVE_QT5),true) -ui_lv2-qt4: carla-bridge-lv2-qt4 -ui_lv2-qt5: -else -ui_lv2-qt4: -ui_lv2-qt5: carla-bridge-lv2-qt5 -endif - -ui_lv2-hwnd: carla-bridge-lv2-hwnd.exe -ui_lv2-x11: carla-bridge-lv2-x11 - -ui_vst-hwnd: carla-bridge-vst-hwnd.exe -ui_vst-x11: carla-bridge-vst-x11 - -else # CARLA_PLUGIN_SUPPORT -all: -endif - -# -------------------------------------------------------------- - -native: carla-bridge-native -posix32: carla-bridge-posix32 -posix64: carla-bridge-posix64 -win32: carla-bridge-win32.exe -win64: carla-bridge-win64.exe - -# -------------------------------------------------------------- -# UI common - -%__lv2.o: %.cpp - $(CXX) $< $(BUILD_UI_LV2_FLAGS) -c -o $@ - -%__vst.o: %.cpp - $(CXX) $< $(BUILD_UI_VST_FLAGS) -c -o $@ - -OBJS_UI_LV2_LIBS = \ - ../carla-lilv/carla_lilv.a \ - ../carla-rtmempool/carla_rtmempool.a - -# -------------------------------------------------------------- -# ui_lv2-gtk2 - -OBJS_UI_LV2_GTK2 = carla_bridge_ui-lv2__lv2-gtk2.o \ - carla_bridge_client__lv2.o carla_bridge_osc__lv2.o \ - carla_bridge_toolkit__lv2.o carla_bridge_toolkit-gtk__lv2-gtk2.o - -carla-bridge-lv2-gtk2: $(OBJS_UI_LV2_GTK2) $(OBJS_UI_LV2_LIBS) - $(CXX) $^ $(LINK_UI_LV2_GTK2_FLAGS) -o $@ && $(STRIP) $@ - -%__lv2-gtk2.o: %.cpp - $(CXX) $< $(BUILD_UI_LV2_GTK2_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# ui_lv2-gtk3 - -OBJS_UI_LV2_GTK3 = carla_bridge_ui-lv2__lv2-gtk3.o \ - carla_bridge_client__lv2.o carla_bridge_osc__lv2.o \ - carla_bridge_toolkit__lv2.o carla_bridge_toolkit-gtk__lv2-gtk3.o - -carla-bridge-lv2-gtk3: $(OBJS_UI_LV2_GTK3) $(OBJS_UI_LV2_LIBS) - $(CXX) $^ $(LINK_UI_LV2_GTK3_FLAGS) -o $@ && $(STRIP) $@ - -%__lv2-gtk3.o: %.cpp - $(CXX) $< $(BUILD_UI_LV2_GTK3_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# ui_lv2-qt4 - -OBJS_UI_LV2_QT4 = carla_bridge_ui-lv2__lv2-qt4.o \ - carla_bridge_client__lv2.o carla_bridge_osc__lv2.o \ - carla_bridge_toolkit__lv2.o carla_bridge_toolkit-qt__lv2-qt4.o - -carla-bridge-lv2-qt4: $(OBJS_UI_LV2_QT4) $(OBJS_UI_LV2_LIBS) - $(CXX) $^ $(LINK_UI_LV2_QT4_FLAGS) -o $@ && $(STRIP) $@ - -%__lv2-qt4.o: %.cpp - $(CXX) $< $(BUILD_UI_LV2_QT4_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# ui_lv2-qt5 - -OBJS_UI_LV2_QT5 = carla_bridge_ui-lv2__lv2-qt5.o \ - carla_bridge_client__lv2.o carla_bridge_osc__lv2.o \ - carla_bridge_toolkit__lv2.o carla_bridge_toolkit-qt__lv2-qt5.o - -carla-bridge-lv2-qt5: $(OBJS_UI_LV2_QT5) $(OBJS_UI_LV2_LIBS) - $(CXX) $^ $(LINK_UI_LV2_QT5_FLAGS) -o $@ && $(STRIP) $@ - -%__lv2-qt5.o: %.cpp - $(CXX) $< $(BUILD_UI_LV2_QT5_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# ui_lv2-x11 - -OBJS_UI_LV2_X11 = carla_bridge_ui-lv2__lv2-x11.o \ - carla_bridge_client__lv2.o carla_bridge_osc__lv2.o \ - carla_bridge_toolkit__lv2.o carla_bridge_toolkit-qt__lv2-x11.o - -carla-bridge-lv2-x11: $(OBJS_UI_LV2_X11) $(OBJS_UI_LV2_LIBS) - $(CXX) $^ $(LINK_UI_LV2_X11_FLAGS) -o $@ && $(STRIP) $@ - -%__lv2-x11.o: %.cpp - $(CXX) $< $(BUILD_UI_LV2_X11_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# ui_vst-hwnd - -OBJS_UI_VST_HWND = carla_bridge_ui-vst__vst-hwnd.o \ - carla_bridge_client__vst.o carla_bridge_osc__vst.o \ - carla_bridge_toolkit__vst.o carla_bridge_toolkit-qt__vst-hwnd.o - -carla-bridge-vst-hwnd.exe: $(OBJS_UI_VST_HWND) - $(CXX) $^ $(LINK_UI_VST_HWND_FLAGS) -o $@ && $(STRIP) $@ - -%__vst-hwnd.o: %.cpp - $(CXX) $< $(BUILD_UI_VST_HWND_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# ui_vst-x11 - -OBJS_UI_VST_X11 = carla_bridge_ui-vst__vst-x11.o \ - carla_bridge_client__vst.o carla_bridge_osc__vst.o \ - carla_bridge_toolkit__vst.o carla_bridge_toolkit-qt__vst-x11.o - -carla-bridge-vst-x11: $(OBJS_UI_VST_X11) - $(CXX) $^ $(LINK_UI_VST_X11_FLAGS) -o $@ && $(STRIP) $@ - -%__vst-x11.o: %.cpp - $(CXX) $< $(BUILD_UI_VST_X11_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# native - -NATIVE_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) -NATIVE_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) $(shell pkg-config --libs jack) -ldl - -ifeq ($(HAVE_SUIL),true) -NATIVE_BUILD_FLAGS += $(shell pkg-config --cflags suil-0) -DWANT_SUIL -NATIVE_LINK_FLAGS += $(shell pkg-config --libs suil-0) -endif - -OBJS_NATIVE = carla_bridge_plugin__native.o \ - carla_bridge_client__native.o carla_bridge_osc__native.o \ - carla_bridge_toolkit__native.o - -# carla -OBJS_NATIVE += \ - ../carla/Shared__native.o - -# carla-engine -OBJS_NATIVE += \ - ../carla-engine/carla_engine__native.o \ - ../carla-engine/carla_engine_osc__native.o \ - ../carla-engine/carla_engine_thread__native.o \ - ../carla-engine/jack__native.o - -# carla-plugin -OBJS_NATIVE += \ - ../carla-plugin/carla_plugin__native.o \ - ../carla-plugin/carla_plugin_thread__native.o \ - ../carla-plugin/ladspa__native.o \ - ../carla-plugin/dssi__native.o \ - ../carla-plugin/lv2__native.o \ - ../carla-plugin/vst__native.o - -# libs -OBJS_NATIVE += \ - ../carla-lilv/carla_lilv.a \ - ../carla-rtmempool/carla_rtmempool.a - -carla-bridge-native: $(OBJS_NATIVE) - $(CXX) $^ $(NATIVE_LINK_FLAGS) -o $@ && $(STRIP) $@ - -%__native.o: %.cpp - $(CXX) $< $(NATIVE_BUILD_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# posix32 - -OBJS_POSIX32 = carla_bridge_plugin__posix32.o \ - carla_bridge_client__posix32.o carla_bridge_osc__posix32.o \ - carla_bridge_toolkit__posix32.o - -# carla -OBJS_POSIX32 += \ - ../carla/Shared__posix32.o - -# carla-engine -OBJS_POSIX32 += \ - ../carla-engine/carla_engine__posix32.o \ - ../carla-engine/carla_engine_osc__posix32.o \ - ../carla-engine/carla_engine_thread__posix32.o \ - ../carla-engine/jack__posix32.o - -# carla-plugin -OBJS_POSIX32 += \ - ../carla-plugin/carla_plugin__posix32.o \ - ../carla-plugin/carla_plugin_thread__posix32.o \ - ../carla-plugin/ladspa__posix32.o \ - ../carla-plugin/dssi__posix32.o \ - ../carla-plugin/lv2__posix32.o \ - ../carla-plugin/vst__posix32.o - -# libs -OBJS_POSIX32 += \ - ../carla-lilv/carla_lilv_posix32.a \ - ../carla-rtmempool/carla_rtmempool_posix32.a - -carla-bridge-posix32: $(OBJS_POSIX32) - $(CXX) $^ $(POSIX_LINK_FLAGS) $(POSIX_32BIT_FLAGS) -o $@ && $(STRIP) $@ - -%__posix32.o: %.cpp - $(CXX) $< $(POSIX_BUILD_FLAGS) $(POSIX_32BIT_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# posix64 - -OBJS_POSIX64 = carla_bridge_plugin__posix64.o \ - carla_bridge_client__posix64.o carla_bridge_osc__posix64.o \ - carla_bridge_toolkit__posix64.o - -# carla -OBJS_POSIX64 += \ - ../carla/Shared__posix64.o - -# carla-engine -OBJS_POSIX64 += \ - ../carla-engine/carla_engine__posix64.o \ - ../carla-engine/carla_engine_osc__posix64.o \ - ../carla-engine/carla_engine_thread__posix64.o \ - ../carla-engine/jack__posix64.o - -# carla-plugin -OBJS_POSIX64 += \ - ../carla-plugin/carla_plugin__posix64.o \ - ../carla-plugin/carla_plugin_thread__posix64.o \ - ../carla-plugin/ladspa__posix64.o \ - ../carla-plugin/dssi__posix64.o \ - ../carla-plugin/lv2__posix64.o \ - ../carla-plugin/vst__posix64.o - -# libs -OBJS_POSIX64 += \ - ../carla-lilv/carla_lilv_posix64.a \ - ../carla-rtmempool/carla_rtmempool_posix64.a - -carla-bridge-posix64: $(OBJS_POSIX64) - $(CXX) $^ $(POSIX_LINK_FLAGS) $(POSIX_64BIT_FLAGS) -o $@ && $(STRIP) $@ - -%__posix64.o: %.cpp - $(CXX) $< $(POSIX_BUILD_FLAGS) $(POSIX_64BIT_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# win32 - -OBJS_WIN32 = carla_bridge_plugin__win32.o \ - carla_bridge_client__win32.o carla_bridge_osc__win32.o \ - carla_bridge_toolkit__win32.o - -# carla -OBJS_WIN32 += \ - ../carla/Shared__win32.o - -# carla-engine -OBJS_WIN32 += \ - ../carla-engine/carla_engine__win32.o \ - ../carla-engine/carla_engine_osc__win32.o \ - ../carla-engine/carla_engine_thread__win32.o \ - ../carla-engine/jack__win32.o - -# carla-plugin -OBJS_WIN32 += \ - ../carla-plugin/carla_plugin__win32.o \ - ../carla-plugin/carla_plugin_thread__win32.o \ - ../carla-plugin/ladspa__win32.o \ - ../carla-plugin/dssi__win32.o \ - ../carla-plugin/lv2__win32.o \ - ../carla-plugin/vst__win32.o - -# libs -OBJS_WIN32 += \ - ../carla-lilv/carla_lilv_win32.a \ - ../carla-rtmempool/carla_rtmempool_win32.a - -carla-bridge-win32.exe: $(OBJS_WIN32) ../carla-jackbridge/libcarla-jackbridge-win32.dll - $(CXX) $(OBJS_WIN32) $(WIN_32BIT_FLAGS) $(WIN_LINK_FLAGS) -lcarla-jackbridge-win32 -o $@ && $(STRIP) $@ - -%__win32.o: %.cpp - $(CXX) $< $(WIN_BUILD_FLAGS) $(WIN_32BIT_FLAGS) -c -o $@ - -# -------------------------------------------------------------- -# win64 - -OBJS_WIN64 = carla_bridge_plugin__win64.o \ - carla_bridge_client__win64.o carla_bridge_osc__win64.o \ - carla_bridge_toolkit__win64.o - -# carla -OBJS_WIN64 += \ - ../carla/Shared__win64.o - -# carla-engine -OBJS_WIN64 += \ - ../carla-engine/carla_engine__win64.o \ - ../carla-engine/carla_engine_osc__win64.o \ - ../carla-engine/carla_engine_thread__win64.o \ - ../carla-engine/jack__win64.o - -# carla-plugin -OBJS_WIN64 += \ - ../carla-plugin/carla_plugin__win64.o \ - ../carla-plugin/carla_plugin_thread__win64.o \ - ../carla-plugin/ladspa__win64.o \ - ../carla-plugin/dssi__win64.o \ - ../carla-plugin/lv2__win64.o \ - ../carla-plugin/vst__win64.o - -# libs -OBJS_WIN64 += \ - ../carla-lilv/carla_lilv_win64.a \ - ../carla-rtmempool/carla_rtmempool_win64.a - -carla-bridge-win64.exe: $(OBJS_WIN64) ../carla-jackbridge/libcarla-jackbridge-win64.dll - $(CXX) $(OBJS_WIN64) $(WIN_64BIT_FLAGS) $(WIN_LINK_FLAGS) -lcarla-jackbridge-win64 -o $@ && $(STRIP) $@ - -%__win64.o: %.cpp - $(CXX) $< $(WIN_BUILD_FLAGS) $(WIN_64BIT_FLAGS) -c -o $@ - -# -------------------------------------------------------------- - -../carla-lilv/carla_lilv.a: - $(MAKE) -C ../carla-lilv - -../carla-lilv/carla_lilv_posix32.a: - $(MAKE) -C ../carla-lilv posix32 - -../carla-lilv/carla_lilv_posix64.a: - $(MAKE) -C ../carla-lilv posix64 - -../carla-lilv/carla_lilv_win32.a: - $(MAKE) -C ../carla-lilv win32 - -../carla-lilv/carla_lilv_win64.a: - $(MAKE) -C ../carla-lilv win64 - -../carla-rtmempool/carla_rtmempool.a: - $(MAKE) -C ../carla-rtmempool - -../carla-rtmempool/carla_rtmempool_posix32.a: - $(MAKE) -C ../carla-rtmempool posix32 - -../carla-rtmempool/carla_rtmempool_posix64.a: - $(MAKE) -C ../carla-rtmempool posix64 - -../carla-rtmempool/carla_rtmempool_win32.a: - $(MAKE) -C ../carla-rtmempool win32 - -../carla-rtmempool/carla_rtmempool_win64.a: - $(MAKE) -C ../carla-rtmempool win64 - -../carla-jackbridge/libcarla-jackbridge-win32.dll: - $(MAKE) -C ../carla-jackbridge win32 - -../carla-jackbridge/libcarla-jackbridge-win64.dll: - $(MAKE) -C ../carla-jackbridge win64 - -# -------------------------------------------------------------- - -doxygen: carla_bridge.doxygen - doxygen $< - -clean: - rm -f *.o *.dll *.so *.exe - rm -f $(OBJS_NATIVE) - rm -f $(OBJS_POSIX32) - rm -f $(OBJS_POSIX64) - rm -f $(OBJS_WIN32) - rm -f $(OBJS_WIN64) - rm -f carla-bridge-lv2-gtk2 carla-bridge-lv2-gtk3 carla-bridge-lv2-qt4 carla-bridge-lv2-qt5 carla-bridge-lv2-x11 carla-bridge-vst-x11 - rm -f carla-bridge-native carla-bridge-posix32 carla-bridge-posix64 diff --git a/c++/carla-bridge/carla_bridge.doxygen b/c++/carla-bridge/carla_bridge.doxygen deleted file mode 100644 index 4dd7dc1..0000000 --- a/c++/carla-bridge/carla_bridge.doxygen +++ /dev/null @@ -1,287 +0,0 @@ -# Doxyfile 1.7.6.1 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "Carla Bridge" -PROJECT_NUMBER = -PROJECT_BRIEF = -PROJECT_LOGO = -OUTPUT_DIRECTORY = ../../doc/carla-bridge -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 4 -ALIASES = -TCL_SUBST = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -EXTENSION_MAPPING = -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -IDL_PROPERTY_SUPPORT = YES -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -INLINE_GROUPED_CLASSES = NO -INLINE_SIMPLE_STRUCTS = NO -TYPEDEF_HIDES_STRUCT = NO -SYMBOL_CACHE_SIZE = 0 -LOOKUP_CACHE_SIZE = 0 -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -EXTRACT_ANON_NSPACES = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = YES -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -FORCE_LOCAL_INCLUDES = NO -INLINE_INFO = YES -SORT_MEMBER_DOCS = NO -SORT_BRIEF_DOCS = NO -SORT_MEMBERS_CTORS_1ST = NO -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -STRICT_PROTO_MATCHING = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO -SHOW_FILES = YES -SHOW_NAMESPACES = YES -FILE_VERSION_FILTER = -LAYOUT_FILE = -CITE_BIB_FILES = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = -RECURSIVE = NO -EXCLUDE = carla_bridge_osc.hpp carla_bridge_osc.cpp carla_bridge_plugin.cpp -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -FILTER_SOURCE_PATTERNS = -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = . -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_EXTRA_FILES = -HTML_COLORSTYLE_HUE = 220 -HTML_COLORSTYLE_SAT = 100 -HTML_COLORSTYLE_GAMMA = 80 -HTML_TIMESTAMP = YES -HTML_ALIGN_MEMBERS = YES -HTML_DYNAMIC_SECTIONS = NO -GENERATE_DOCSET = NO -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = org.doxygen.Project -DOCSET_PUBLISHER_ID = org.doxygen.Publisher -DOCSET_PUBLISHER_NAME = Publisher -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -CHM_INDEX_ENCODING = -BINARY_TOC = NO -TOC_EXPAND = NO -GENERATE_QHP = NO -QCH_FILE = -QHP_NAMESPACE = org.doxygen.Project -QHP_VIRTUAL_FOLDER = doc -QHP_CUST_FILTER_NAME = -QHP_CUST_FILTER_ATTRS = -QHP_SECT_FILTER_ATTRS = -QHG_LOCATION = -GENERATE_ECLIPSEHELP = NO -ECLIPSE_DOC_ID = org.doxygen.Project -DISABLE_INDEX = NO -GENERATE_TREEVIEW = NO -ENUM_VALUES_PER_LINE = 4 -USE_INLINE_TREES = NO -TREEVIEW_WIDTH = 250 -EXT_LINKS_IN_WINDOW = NO -FORMULA_FONTSIZE = 10 -FORMULA_TRANSPARENT = YES -USE_MATHJAX = NO -MATHJAX_RELPATH = http://www.mathjax.org/mathjax -MATHJAX_EXTENSIONS = -SEARCHENGINE = YES -SERVER_BASED_SEARCH = NO -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4 -EXTRA_PACKAGES = -LATEX_HEADER = -LATEX_FOOTER = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -LATEX_SOURCE_CODE = NO -LATEX_BIB_STYLE = plain -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = DOXYGEN BUILD_BRIDGE BUILD_BRIDGE_PLUGIN BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_LV2_GTK2 BRIDGE_LV2_GTK3 BRIDGE_LV2_QT4 BRIDGE_LV2_X11 BRIDGE_VST BRIDGE_VST_HWND BRIDGE_VST_X11 -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -MSCGEN_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -DOT_NUM_THREADS = 0 -DOT_FONTNAME = Helvetica -DOT_FONTSIZE = 10 -DOT_FONTPATH = -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -INTERACTIVE_SVG = NO -DOT_PATH = -DOTFILE_DIRS = -MSCFILE_DIRS = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = YES -GENERATE_LEGEND = YES -DOT_CLEANUP = YES diff --git a/c++/carla-bridge/carla_bridge.hpp b/c++/carla-bridge/carla_bridge.hpp deleted file mode 100644 index 960126a..0000000 --- a/c++/carla-bridge/carla_bridge.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Carla Bridge - * Copyright (C) 2011-2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#ifndef CARLA_BRIDGE_HPP -#define CARLA_BRIDGE_HPP - -#include "carla_defines.hpp" - -#define CARLA_BRIDGE_START_NAMESPACE namespace CarlaBridge { -#define CARLA_BRIDGE_END_NAMESPACE } -#define CARLA_BRIDGE_USE_NAMESPACE using namespace CarlaBridge; - -CARLA_BRIDGE_START_NAMESPACE - -class CarlaBridgeClient; -class CarlaBridgeToolkit; - -CARLA_BRIDGE_END_NAMESPACE - -#endif // CARLA_BRIDGE_HPP diff --git a/c++/carla-bridge/carla_bridge_client.cpp b/c++/carla-bridge/carla_bridge_client.cpp deleted file mode 100644 index 5131689..0000000 --- a/c++/carla-bridge/carla_bridge_client.cpp +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Carla Bridge Client - * Copyright (C) 2011-2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#include "carla_bridge_client.hpp" -#include "carla_bridge_toolkit.hpp" - -#ifdef BUILD_BRIDGE_UI -# include "carla_lib_utils.hpp" -#endif - -#include -#include - -CARLA_BRIDGE_START_NAMESPACE - -// --------------------------------------------------------------------- - -CarlaBridgeClient::CarlaBridgeClient(const char* const uiTitle) - : m_osc(this), - m_toolkit(CarlaBridgeToolkit::createNew(this, uiTitle)) -{ - qDebug("CarlaBridgeClient::CarlaBridgeClient(\"%s\")", uiTitle); - - m_oscData = nullptr; - -#ifdef BUILD_BRIDGE_UI - m_uiFilename = nullptr; - m_uiLib = nullptr; - m_uiQuit = false; -#endif -} - -CarlaBridgeClient::~CarlaBridgeClient() -{ - qDebug("CarlaBridgeClient::~CarlaBridgeClient()"); - -#ifdef BUILD_BRIDGE_UI - if (m_uiFilename) - free(m_uiFilename); -#endif - - delete m_toolkit; -} - -#ifdef BUILD_BRIDGE_UI -// --------------------------------------------------------------------- -// ui initialization - -bool CarlaBridgeClient::init(const char* const, const char* const) -{ - qDebug("CarlaBridgeClient::init()"); - - // Test for single init - { - static bool initiated = false; - CARLA_ASSERT(! initiated); - initiated = true; - } - - m_uiQuit = false; - - m_toolkit->init(); - - return false; -} - -void CarlaBridgeClient::close() -{ - qDebug("CarlaBridgeClient::close()"); - - if (! m_uiQuit) - { - m_uiQuit = true; - - if (isOscControlRegistered()) - sendOscExiting(); - } - - m_toolkit->quit(); -} -#endif - -// --------------------------------------------------------------------- -// osc stuff - -bool CarlaBridgeClient::oscInit(const char* const url) -{ - qDebug("CarlaBridgeClient::oscInit(\"%s\")", url); - - const bool ret = m_osc.init(url); - m_oscData = m_osc.getControlData(); - - return ret; -} - -bool CarlaBridgeClient::oscIdle() -{ - m_osc.idle(); - -#ifdef BUILD_BRIDGE_UI - return ! m_uiQuit; -#else - return true; -#endif -} - -void CarlaBridgeClient::oscClose() -{ - qDebug("CarlaBridgeClient::oscClose()"); - CARLA_ASSERT(m_oscData); - - m_osc.close(); - m_oscData = nullptr; -} - -bool CarlaBridgeClient::isOscControlRegistered() const -{ - return m_osc.isControlRegistered(); -} - -void CarlaBridgeClient::sendOscUpdate() -{ - qDebug("CarlaBridgeClient::sendOscUpdate()"); - CARLA_ASSERT(m_oscData); - - if (m_oscData && m_oscData->target) - osc_send_update(m_oscData, m_osc.getServerPath()); -} - -#ifdef BUILD_BRIDGE_PLUGIN -void CarlaBridgeClient::sendOscBridgeUpdate() -{ - qDebug("CarlaBridgeClient::sendOscBridgeUpdate()"); - CARLA_ASSERT(m_oscData); - CARLA_ASSERT(m_oscData->target && m_oscData->path); - - if (m_oscData && m_oscData->target && m_oscData->path) - osc_send_bridge_update(m_oscData, m_oscData->path); -} - -void CarlaBridgeClient::sendOscBridgeError(const char* const error) -{ - qDebug("CarlaBridgeClient::sendOscBridgeError(\"%s\")", error); - CARLA_ASSERT(m_oscData); - CARLA_ASSERT(error); - - if (m_oscData && m_oscData->target) - osc_send_bridge_error(m_oscData, error); -} -#endif - -// --------------------------------------------------------------------- -// toolkit - -void CarlaBridgeClient::toolkitShow() -{ - qDebug("CarlaBridgeClient::toolkitShow()"); - - m_toolkit->show(); -} - -void CarlaBridgeClient::toolkitHide() -{ - qDebug("CarlaBridgeClient::toolkitHide()"); - - m_toolkit->hide(); -} - -void CarlaBridgeClient::toolkitResize(const int width, const int height) -{ - qDebug("CarlaBridgeClient::toolkitResize(%i, %i)", width, height); - - m_toolkit->resize(width, height); -} - -void CarlaBridgeClient::toolkitExec(const bool showGui) -{ - qDebug("CarlaBridgeClient::toolkitExec(%s)", bool2str(showGui)); - - m_toolkit->exec(showGui); -} - -void CarlaBridgeClient::toolkitQuit() -{ - qDebug("CarlaBridgeClient::toolkitQuit()"); - -#ifdef BUILD_BRIDGE_UI - m_uiQuit = true; -#endif - m_toolkit->quit(); -} - -// --------------------------------------------------------------------- - -void CarlaBridgeClient::sendOscConfigure(const char* const key, const char* const value) -{ - qDebug("CarlaBridgeClient::sendOscConfigure(\"%s\", \"%s\")", key, value); - CARLA_ASSERT(m_oscData); - - if (m_oscData && m_oscData->target) - osc_send_configure(m_oscData, key, value); -} - -void CarlaBridgeClient::sendOscControl(const int32_t index, const float value) -{ - qDebug("CarlaBridgeClient::sendOscControl(%i, %f)", index, value); - CARLA_ASSERT(m_oscData); - - if (m_oscData && m_oscData->target) - osc_send_control(m_oscData, index, value); -} - -void CarlaBridgeClient::sendOscProgram(const int32_t index) -{ - qDebug("CarlaBridgeClient::sendOscProgram(%i)", index); - CARLA_ASSERT(m_oscData); - - if (m_oscData && m_oscData->target) - osc_send_program(m_oscData, index); -} - -void CarlaBridgeClient::sendOscMidiProgram(const int32_t index) -{ - qDebug("CarlaBridgeClient::sendOscMidiProgram(%i)", index); - CARLA_ASSERT(m_oscData); - - if (m_oscData && m_oscData->target) - osc_send_midi_program(m_oscData, index); -} - -void CarlaBridgeClient::sendOscMidi(const uint8_t midiBuf[4]) -{ - qDebug("CarlaBridgeClient::sendOscMidi(%p)", midiBuf); - CARLA_ASSERT(m_oscData); - - if (m_oscData && m_oscData->target) - osc_send_midi(m_oscData, midiBuf); -} - -void CarlaBridgeClient::sendOscExiting() -{ - qDebug("CarlaBridgeClient::sendOscExiting()"); - CARLA_ASSERT(m_oscData); - - if (m_oscData && m_oscData->target) - osc_send_exiting(m_oscData); -} - -#ifdef BRIDGE_LV2 -void CarlaBridgeClient::sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf) -{ - qDebug("CarlaBridgeClient::sendOscLv2TransferAtom(%i, \"%s\", \"%s\")", portIndex, typeStr, atomBuf); - CARLA_ASSERT(m_oscData); - - if (m_oscData && m_oscData->target) - osc_send_lv2_transfer_atom(m_oscData, portIndex, typeStr, atomBuf); -} - -void CarlaBridgeClient::sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const atomBuf) -{ - qDebug("CarlaBridgeClient::sendOscLv2TransferEvent(%i, \"%s\", \"%s\")", portIndex, typeStr, atomBuf); - CARLA_ASSERT(m_oscData); - - if (m_oscData && m_oscData->target) - osc_send_lv2_transfer_event(m_oscData, portIndex, typeStr, atomBuf); -} -#endif - -// --------------------------------------------------------------------- - -void* CarlaBridgeClient::getContainerId() -{ - return m_toolkit->getContainerId(); -} - -#ifdef BUILD_BRIDGE_UI -bool CarlaBridgeClient::uiLibOpen(const char* const filename) -{ - CARLA_ASSERT(! m_uiLib); - CARLA_ASSERT(filename); - - if (m_uiFilename) - free(m_uiFilename); - - m_uiLib = lib_open(filename); - m_uiFilename = strdup(filename ? filename : ""); - - return bool(m_uiLib); -} - -bool CarlaBridgeClient::uiLibClose() -{ - CARLA_ASSERT(m_uiLib); - - if (m_uiLib) - { - const bool closed = lib_close(m_uiLib); - m_uiLib = nullptr; - return closed; - } - - return false; -} - -void* CarlaBridgeClient::uiLibSymbol(const char* const symbol) -{ - CARLA_ASSERT(m_uiLib); - - if (m_uiLib) - return lib_symbol(m_uiLib, symbol); - - return nullptr; -} - -const char* CarlaBridgeClient::uiLibError() -{ - return lib_error(m_uiFilename); -} -#endif - -CARLA_BRIDGE_END_NAMESPACE diff --git a/c++/carla-bridge/carla_bridge_client.hpp b/c++/carla-bridge/carla_bridge_client.hpp deleted file mode 100644 index 19fcc3f..0000000 --- a/c++/carla-bridge/carla_bridge_client.hpp +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Carla Bridge Client - * Copyright (C) 2011-2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#ifndef CARLA_BRIDGE_CLIENT_HPP -#define CARLA_BRIDGE_CLIENT_HPP - -#include "carla_bridge_osc.hpp" - -CARLA_BRIDGE_START_NAMESPACE - -#if 0 -} // Fix editor indentation -#endif - -/*! - * @defgroup CarlaBridgeClient Carla Bridge Client - * - * The Carla Bridge Client. - * @{ - */ - -class CarlaBridgeClient -{ -public: - CarlaBridgeClient(const char* const uiTitle); - virtual ~CarlaBridgeClient(); - -#ifdef BUILD_BRIDGE_UI - // --------------------------------------------------------------------- - // ui initialization - - virtual bool init(const char* const, const char* const); - virtual void close(); -#endif - -#ifdef BUILD_BRIDGE_UI - // --------------------------------------------------------------------- - // ui management - - virtual void* getWidget() const = 0; - virtual bool isResizable() const = 0; - virtual bool needsReparent() const = 0; -#endif - - // --------------------------------------------------------------------- - // processing - - virtual void setParameter(const int32_t rindex, const double value) = 0; - virtual void setProgram(const uint32_t index) = 0; -#ifdef BUILD_BRIDGE_PLUGIN - virtual void setMidiProgram(const uint32_t index) = 0; -#endif -#ifdef BUILD_BRIDGE_UI - virtual void setMidiProgram(const uint32_t bank, const uint32_t program) = 0; -#endif - virtual void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) = 0; - virtual void noteOff(const uint8_t channel, const uint8_t note) = 0; - -#ifdef BUILD_BRIDGE_PLUGIN - // --------------------------------------------------------------------- - // plugin - - virtual void saveNow() = 0; - virtual void setCustomData(const char* const type, const char* const key, const char* const value) = 0; - virtual void setChunkData(const char* const filePath) = 0; -#endif - - // --------------------------------------------------------------------- - // osc stuff - - bool oscInit(const char* const url); - bool oscIdle(); - void oscClose(); - - bool isOscControlRegistered() const; - void sendOscUpdate(); - -#ifdef BUILD_BRIDGE_PLUGIN - void sendOscBridgeUpdate(); - void sendOscBridgeError(const char* const error); -#endif - - // --------------------------------------------------------------------- - // toolkit - - void toolkitShow(); - void toolkitHide(); - void toolkitResize(const int width, const int height); - void toolkitExec(const bool showGui); - void toolkitQuit(); - - // --------------------------------------------------------------------- - -protected: - void sendOscConfigure(const char* const key, const char* const value); - void sendOscControl(const int32_t index, const float value); - void sendOscProgram(const int32_t index); - void sendOscMidiProgram(const int32_t index); - void sendOscMidi(const uint8_t midiBuf[4]); - void sendOscExiting(); - -#ifdef BRIDGE_LV2 - void sendOscLv2TransferAtom(const int32_t portIndex, const char* const typeStr, const char* const atomBuf); - void sendOscLv2TransferEvent(const int32_t portIndex, const char* const typeStr, const char* const atomBuf); -#endif - - // --------------------------------------------------------------------- - - void* getContainerId(); - -#ifdef BUILD_BRIDGE_UI - bool uiLibOpen(const char* const filename); - bool uiLibClose(); - void* uiLibSymbol(const char* const symbol); - const char* uiLibError(); -#endif - - // --------------------------------------------------------------------- - -private: - CarlaBridgeOsc m_osc; - CarlaBridgeToolkit* const m_toolkit; - - const CarlaOscData* m_oscData; - -#ifdef BUILD_BRIDGE_UI - char* m_uiFilename; - void* m_uiLib; - bool m_uiQuit; -#else - friend class CarlaPluginClient; -#endif -}; - -/**@}*/ - -CARLA_BRIDGE_END_NAMESPACE - -#endif // CARLA_BRIDGE_CLIENT_HPP diff --git a/c++/carla-bridge/carla_bridge_osc.cpp b/c++/carla-bridge/carla_bridge_osc.cpp deleted file mode 100644 index 194cc3c..0000000 --- a/c++/carla-bridge/carla_bridge_osc.cpp +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Carla Bridge OSC - * Copyright (C) 2011-2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#include "carla_bridge_osc.hpp" -#include "carla_bridge_client.hpp" -#include "carla_midi.h" -#include "carla_utils.hpp" - -#include -#include - -CARLA_BRIDGE_START_NAMESPACE - -// ----------------------------------------------------------------------- - -CarlaBridgeOsc::CarlaBridgeOsc(CarlaBridgeClient* const client_) - : client(client_) -{ - qDebug("CarlaBridgeOsc::CarlaBridgeOsc(%p)", client); - CARLA_ASSERT(client); - - m_name = nullptr; - m_nameSize = 0; - - m_server = nullptr; - m_serverPath = nullptr; -} - -CarlaBridgeOsc::~CarlaBridgeOsc() -{ - qDebug("CarlaBridgeOsc::~CarlaBridgeOsc()"); - CARLA_ASSERT(! m_name); - CARLA_ASSERT(! m_server); - CARLA_ASSERT(! m_serverPath); -} - -bool CarlaBridgeOsc::init(const char* const url) -{ - qDebug("CarlaBridgeOsc::init(\"%s\")", url); - CARLA_ASSERT(! m_name); - CARLA_ASSERT(! m_server); - CARLA_ASSERT(! m_serverPath); - CARLA_ASSERT(m_nameSize == 0); - CARLA_ASSERT(url); - - if (! url) - { - qWarning("CarlaBridgeOsc::init(\"%s\") - invalid url", url); - return false; - } - -#ifdef BUILD_BRIDGE_PLUGIN - m_name = strdup("carla-bridge-plugin"); -#else - m_name = strdup("carla-bridge-ui"); -#endif - m_nameSize = strlen(m_name); - - char* const host = lo_url_get_hostname(url); - char* const path = lo_url_get_path(url); - char* const port = lo_url_get_port(url); - - if (! host) - { - qCritical("CarlaBridgeOsc::init(\"%s\") - failed to get url hostname", url); - return false; - } - - if (! path) - { - free(host); - qCritical("CarlaBridgeOsc::init(\"%s\") - failed to get url path", url); - return false; - } - - if (! port) - { - free(host); - free(path); - qCritical("CarlaBridgeOsc::init(\"%s\") - failed to get url port", url); - return false; - } - - m_controlData.path = path; - m_controlData.target = lo_address_new_with_proto(LO_TCP, host, port); - - free(host); - free(port); - - if (! m_controlData.target) - { - qCritical("CarlaBridgeOsc::init(\"%s\") - failed to get new url address for host '%s' and port '%s'", url, host, port); - return false; - } - - m_server = lo_server_new_with_proto(nullptr, LO_TCP, osc_error_handler); - - if (! m_server) - { - qCritical("CarlaBridgeOsc::init(\"%s\") - failed to create new OSC server", url); - return false; - } - - if (char* const serverUrl = lo_server_get_url(m_server)) - { - m_serverPath = strdup(QString("%1%2").arg(serverUrl).arg(m_name).toUtf8().constData()); - free(serverUrl); - } - else - m_serverPath = strdup(QString("%1carla-bridge").arg(serverUrl).toUtf8().constData()); - - lo_server_add_method(m_server, nullptr, nullptr, osc_message_handler, this); - - return true; -} - -void CarlaBridgeOsc::idle() -{ - CARLA_ASSERT(m_server); - - if (m_server) - { - while (lo_server_recv_noblock(m_server, 0) != 0) {} - } -} - -void CarlaBridgeOsc::close() -{ - qDebug("CarlaBridgeOsc::close()"); - CARLA_ASSERT(m_name); - CARLA_ASSERT(m_server); - CARLA_ASSERT(m_serverPath); - - m_nameSize = 0; - - if (m_name) - { - free(m_name); - m_name = nullptr; - } - - if (m_server) - { - lo_server_del_method(m_server, nullptr, nullptr); - lo_server_free(m_server); - m_server = nullptr; - } - - if (m_serverPath) - { - free(m_serverPath); - m_serverPath = nullptr; - } - - m_controlData.free(); -} - -// ----------------------------------------------------------------------- - -int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg) -{ - qDebug("CarlaBridgeOsc::handleMessage(\"%s\", %i, %p, \"%s\", %p)", path, argc, argv, types, msg); - CARLA_ASSERT(m_name); - CARLA_ASSERT(m_server); - CARLA_ASSERT(m_serverPath); - CARLA_ASSERT(path); - - if (! path) - { - qCritical("CarlaBridgeOsc::handleMessage() - got invalid path"); - return 1; - } - - if (! (m_name && m_server && m_serverPath)) - { - qCritical("CarlaBridgeOsc::handleMessage(\"%s\", ...) - received message but client is offline", path); - return 1; - } - - if (strlen(path) <= m_nameSize || strncmp(path+1, m_name, m_nameSize) != 0) - { - qWarning("CarlaBridgeOsc::handleMessage() - message not for this client: '%s' != '/%s/'", path, m_name); - return 1; - } - - char method[32] = { 0 }; - strncpy(method, path + (m_nameSize + 2), 31); - - if (method[0] == '\0') - { - qWarning("CarlaBridgeOsc::handleMessage(\"%s\", ...) - received message without method", path); - return 1; - } - - // Common OSC methods - if (strcmp(method, "configure") == 0) - return handleMsgConfigure(argc, argv, types); - if (strcmp(method, "control") == 0) - return handleMsgControl(argc, argv, types); - if (strcmp(method, "program") == 0) - return handleMsgProgram(argc, argv, types); - if (strcmp(method, "midi_program") == 0) - return handleMsgMidiProgram(argc, argv, types); - if (strcmp(method, "midi") == 0) - return handleMsgMidi(argc, argv, types); - if (strcmp(method, "sample-rate") == 0) - return 0; // unused - if (strcmp(method, "show") == 0) - return handleMsgShow(); - if (strcmp(method, "hide") == 0) - return handleMsgHide(); - if (strcmp(method, "quit") == 0) - return handleMsgQuit(); - -#ifdef BRIDGE_LV2 - // LV2 UI methods - if (strcmp(method, "lv2_atom_transfer") == 0) - return handleMsgLv2TransferAtom(argc, argv, types); - if (strcmp(method, "lv2_event_transfer") == 0) - return handleMsgLv2TransferEvent(argc, argv, types); -#endif - -#ifdef BUILD_BRIDGE_PLUGIN - // Plugin methods - if (strcmp(method, "plugin_save_now") == 0) - return handleMsgPluginSaveNow(); - if (strcmp(method, "plugin_set_chunk") == 0) - return handleMsgPluginSetChunk(argc, argv, types); - if (strcmp(method, "plugin_set_custom_data") == 0) - return handleMsgPluginSetCustomData(argc, argv, types); -#endif - -#if 0 - // TODO - else if (strcmp(method, "set_parameter_midi_channel") == 0) - return osc_set_parameter_midi_channel_handler(argv); - else if (strcmp(method, "set_parameter_midi_cc") == 0) - return osc_set_parameter_midi_channel_handler(argv); -#endif - - qWarning("CarlaBridgeOsc::handleMessage(\"%s\", ...) - received unsupported OSC method '%s'", path, method); - return 1; -} - -int CarlaBridgeOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) -{ - qDebug("CarlaBridgeOsc::handleMsgConfigure()"); - CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ss"); - - if (! client) - return 1; - - // nothing here for now - - return 0; - - Q_UNUSED(argv); -} - -int CarlaBridgeOsc::handleMsgControl(CARLA_BRIDGE_OSC_HANDLE_ARGS) -{ - qDebug("CarlaBridgeOsc::handleMsgControl()"); - CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "if"); - - if (! client) - return 1; - - const int32_t index = argv[0]->i; - const float value = argv[1]->f; - - client->setParameter(index, value); - - return 0; -} - -int CarlaBridgeOsc::handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) -{ - qDebug("CarlaBridgeOsc::handleMsgProgram()"); - CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "i"); - - if (! client) - return 1; - - const int32_t index = argv[0]->i; - - client->setProgram(index); - - return 0; -} - -#ifdef BUILD_BRIDGE_PLUGIN -int CarlaBridgeOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) -{ - qDebug("CarlaBridgeOsc::handleMsgMidiProgram()"); - CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "i"); - - if (! client) - return 1; - - const int32_t index = argv[0]->i; - - client->setMidiProgram(index); - - return 0; -} -#else -int CarlaBridgeOsc::handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS) -{ - qDebug("CarlaBridgeOsc::handleMsgMidiProgram()"); - CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ii"); - - if (! client) - return 1; - - const int32_t bank = argv[0]->i; - const int32_t program = argv[1]->i; - - client->setMidiProgram(bank, program); - - return 0; -} -#endif - -int CarlaBridgeOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) -{ - qDebug("CarlaBridgeOsc::handleMsgMidi()"); - CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "m"); - - if (! client) - return 1; - - const uint8_t* const mdata = argv[0]->m; - const uint8_t data[4] = { mdata[0], mdata[1], mdata[2], mdata[3] }; - - uint8_t status = data[1]; - uint8_t channel = status & 0x0F; - - // Fix bad note-off - if (MIDI_IS_STATUS_NOTE_ON(status) && data[3] == 0) - status -= 0x10; - - if (MIDI_IS_STATUS_NOTE_OFF(status)) - { - const uint8_t note = data[2]; - - client->noteOff(channel, note); - } - else if (MIDI_IS_STATUS_NOTE_ON(status)) - { - const uint8_t note = data[2]; - const uint8_t velo = data[3]; - - client->noteOn(channel, note, velo); - } - - return 0; -} - -int CarlaBridgeOsc::handleMsgShow() -{ - qDebug("CarlaBridgeOsc::handleMsgShow()"); - - if (! client) - return 1; - - client->toolkitShow(); - - return 0; -} - -int CarlaBridgeOsc::handleMsgHide() -{ - qDebug("CarlaBridgeOsc::handleMsgHide()"); - - if (! client) - return 1; - - client->toolkitHide(); - - return 0; -} - -int CarlaBridgeOsc::handleMsgQuit() -{ - qDebug("CarlaBridgeOsc::handleMsgQuit()"); - - if (! client) - return 1; - - client->toolkitQuit(); - - return 0; -} - -CARLA_BRIDGE_END_NAMESPACE diff --git a/c++/carla-bridge/carla_bridge_osc.hpp b/c++/carla-bridge/carla_bridge_osc.hpp deleted file mode 100644 index 041c645..0000000 --- a/c++/carla-bridge/carla_bridge_osc.hpp +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Carla Bridge OSC - * Copyright (C) 2011-2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#ifndef CARLA_BRIDGE_OSC_HPP -#define CARLA_BRIDGE_OSC_HPP - -#include "carla_bridge.hpp" -#include "carla_osc_utils.hpp" - -#define CARLA_BRIDGE_OSC_HANDLE_ARGS const int argc, const lo_arg* const* const argv, const char* const types - -#define CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(/* argc, types, */ argcToCompare, typesToCompare) \ - /* check argument count */ \ - if (argc != argcToCompare) \ - { \ - qCritical("CarlaBridgeOsc::%s() - argument count mismatch: %i != %i", __FUNCTION__, argc, argcToCompare); \ - return 1; \ - } \ - if (argc > 0) \ - { \ - /* check for nullness */ \ - if (! (types && typesToCompare)) \ - { \ - qCritical("CarlaBridgeOsc::%s() - argument types are null", __FUNCTION__); \ - return 1; \ - } \ - /* check argument types */ \ - if (strcmp(types, typesToCompare) != 0) \ - { \ - qCritical("CarlaBridgeOsc::%s() - argument types mismatch: '%s' != '%s'", __FUNCTION__, types, typesToCompare); \ - return 1; \ - } \ - } - -CARLA_BRIDGE_START_NAMESPACE - -#if 0 -} // Fix editor indentation -#endif - -class CarlaBridgeOsc -{ -public: - CarlaBridgeOsc(CarlaBridgeClient* const client); - ~CarlaBridgeOsc(); - - bool init(const char* const url); - void idle(); - void close(); - - // ------------------------------------------------------------------- - - bool isControlRegistered() const - { - return bool(m_controlData.target); - } - - const CarlaOscData* getControlData() const - { - return &m_controlData; - } - - const char* getServerPath() const - { - return m_serverPath; - } - - // ------------------------------------------------------------------- - -private: - CarlaBridgeClient* const client; - - char* m_name; - size_t m_nameSize; - - lo_server m_server; - char* m_serverPath; - - CarlaOscData m_controlData; - - // ------------------------------------------------------------------- - - int handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg); - - int handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgControl(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgMidiProgram(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgShow(); - int handleMsgHide(); - int handleMsgQuit(); - -#ifdef BRIDGE_LV2 - int handleMsgLv2TransferAtom(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgLv2TransferEvent(CARLA_BRIDGE_OSC_HANDLE_ARGS); -#endif - -#ifdef BUILD_BRIDGE_PLUGIN - int handleMsgPluginSaveNow(); - int handleMsgPluginSetChunk(CARLA_BRIDGE_OSC_HANDLE_ARGS); - int handleMsgPluginSetCustomData(CARLA_BRIDGE_OSC_HANDLE_ARGS); -#endif - - // ------------------------------------------------------------------- - - static void osc_error_handler(const int num, const char* const msg, const char* const path) - { - qWarning("CarlaBridgeOsc::osc_error_handler(%i, \"%s\", \"%s\")", num, msg, path); - } - - static int osc_message_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg, void* const user_data) - { - CARLA_ASSERT(user_data); - if (CarlaBridgeOsc* const _this_ = (CarlaBridgeOsc*)user_data) - return _this_->handleMessage(path, argc, argv, types, msg); - return 1; - } -}; - -CARLA_BRIDGE_END_NAMESPACE - -#endif // CARLA_BRIDGE_OSC_HPP diff --git a/c++/carla-bridge/carla_bridge_plugin.cpp b/c++/carla-bridge/carla_bridge_plugin.cpp deleted file mode 100644 index 91ea99b..0000000 --- a/c++/carla-bridge/carla_bridge_plugin.cpp +++ /dev/null @@ -1,1150 +0,0 @@ -/* - * Carla Plugin bridge code - * Copyright (C) 2012 Filipe Coelho - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * For a full copy of the GNU General Public License see the COPYING file - */ - -#ifdef BRIDGE_PLUGIN - -#include "carla_bridge_client.hpp" -#include "carla_bridge_toolkit.hpp" -#include "carla_plugin.hpp" -#include "../carla/Shared.hpp" - -#include -#include -#include -#include -#include -#include - -#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) -# include -#else -# include -#endif - -#ifdef Q_OS_UNIX -# include -#endif - -// ------------------------------------------------------------------------- - -static int qargc = 0; -static char** qargv = nullptr; -static bool qCloseNow = false; -static bool qSaveNow = false; - -#if defined(Q_OS_HAIKU) || defined(Q_OS_UNIX) -void closeSignalHandler(int) -{ - qCloseNow = true; -} -void saveSignalHandler(int) -{ - qSaveNow = true; -} -#elif defined(Q_OS_WIN) -BOOL WINAPI closeSignalHandler(DWORD dwCtrlType) -{ - if (dwCtrlType == CTRL_C_EVENT) - { - qCloseNow = true; - return TRUE; - } - - return FALSE; -} -#endif - -void initSignalHandler() -{ -#if defined(Q_OS_HAIKU) || defined(Q_OS_UNIX) - struct sigaction sint; - struct sigaction sterm; - struct sigaction susr1; - - sint.sa_handler = closeSignalHandler; - sint.sa_flags = SA_RESTART; - sint.sa_restorer = nullptr; - sigemptyset(&sint.sa_mask); - sigaction(SIGINT, &sint, nullptr); - - sterm.sa_handler = closeSignalHandler; - sterm.sa_flags = SA_RESTART; - sterm.sa_restorer = nullptr; - sigemptyset(&sterm.sa_mask); - sigaction(SIGTERM, &sterm, nullptr); - - susr1.sa_handler = saveSignalHandler; - susr1.sa_flags = SA_RESTART; - susr1.sa_restorer = nullptr; - sigemptyset(&susr1.sa_mask); - sigaction(SIGUSR1, &susr1, nullptr); -#elif defined(Q_OS_WIN) - SetConsoleCtrlHandler(closeSignalHandler, TRUE); -#endif -} - -CARLA_BRIDGE_START_NAMESPACE - -// ------------------------------------------------------------------------- - -class CarlaBridgeToolkitPlugin : public CarlaBridgeToolkit, - public CarlaBackend::CarlaPluginGUI::Callback -{ -public: - CarlaBridgeToolkitPlugin(CarlaBridgeClient* const client, const char* const uiTitle) - : CarlaBridgeToolkit(client, uiTitle) - { - qDebug("CarlaBridgeToolkitPlugin::CarlaBridgeToolkitPlugin(%p, \"%s\")", client, uiTitle); - - app = nullptr; - gui = nullptr; - - m_hasUI = false; - m_uiQuit = false; - m_uiShow = false; - - init(); - } - - ~CarlaBridgeToolkitPlugin() - { - qDebug("CarlaBridgeToolkitPlugin::~CarlaBridgeToolkitPlugin()"); - - if (gui) - { - gui->close(); - - delete gui; - gui = nullptr; - } - - if (app) - { - if (! app->closingDown()) - app->quit(); - - delete app; - app = nullptr; - } - } - - void init() - { - qDebug("CarlaBridgeToolkitPlugin::init()"); - CARLA_ASSERT(! app); - CARLA_ASSERT(! gui); - - app = new QApplication(qargc, qargv); - - gui = new CarlaBackend::CarlaPluginGUI(nullptr, this); - } - - void exec(const bool showGui) - { - qDebug("CarlaBridgeToolkitPlugin::exec(%s)", bool2str(showGui)); - CARLA_ASSERT(app); - CARLA_ASSERT(gui); - CARLA_ASSERT(client); - - if (showGui) - { - if (m_hasUI) - show(); - } - else - { - app->setQuitOnLastWindowClosed(false); - client->sendOscUpdate(); - client->sendOscBridgeUpdate(); - } - - m_uiQuit = showGui; - - // Main loop - app->exec(); - } - - void quit() - { - qDebug("CarlaBridgeToolkitPlugin::quit()"); - CARLA_ASSERT(app); - - if (app && ! app->closingDown()) - app->quit(); - } - - void show(); - void hide(); - - void resize(const int width, const int height) - { - qDebug("CarlaBridgeToolkitPlugin::resize(%i, %i)", width, height); - CARLA_ASSERT(gui); - - if (gui) - gui->setNewSize(width, height); - } - - GuiContainer* getContainer() const - { - CARLA_ASSERT(gui); - - if (gui) - return gui->getContainer(); - - return nullptr; - } - - void* getContainerId() - { - CARLA_ASSERT(gui); - - if (gui) - return (void*)gui->getWinId(); - - return nullptr; - } - - void setHasUI(const bool hasUI, const bool showUI) - { - m_hasUI = hasUI; - m_uiShow = showUI; - } - - void guiClosedCallback(); - -protected: - QApplication* app; - CarlaBackend::CarlaPluginGUI* gui; - -private: - bool m_hasUI; - bool m_uiQuit; - bool m_uiShow; -}; - -CarlaBridgeToolkit* CarlaBridgeToolkit::createNew(CarlaBridgeClient* const client, const char* const uiTitle) -{ - return new CarlaBridgeToolkitPlugin(client, uiTitle); -} - -// ------------------------------------------------------------------------- - -class CarlaPluginClient : public CarlaBridgeClient, - public QObject -{ -public: - CarlaPluginClient() - : CarlaBridgeClient(""), - QObject(nullptr) - { - qDebug("CarlaPluginClient::CarlaPluginClient()"); - - msgTimerGUI = 0; - msgTimerOSC = 0; - - needsResize = 0; - nextWidth = 0; - nextHeight = 0; - - engine = nullptr; - plugin = nullptr; - } - - ~CarlaPluginClient() - { - qDebug("CarlaPluginClient::~CarlaPluginClient()"); - CARLA_ASSERT(msgTimerGUI == 0); - CARLA_ASSERT(msgTimerOSC == 0); - } - - // --------------------------------------------------------------------- - - void init() - { - CARLA_ASSERT(plugin); - - msgTimerGUI = startTimer(50); - msgTimerOSC = startTimer(25); - - if (! plugin) - return; - - bool guiResizable; - CarlaBackend::GuiType guiType; - plugin->getGuiInfo(&guiType, &guiResizable); - - CarlaBridgeToolkitPlugin* const plugToolkit = (CarlaBridgeToolkitPlugin*)m_toolkit; - - if (guiType == CarlaBackend::GUI_INTERNAL_QT4 || guiType == CarlaBackend::GUI_INTERNAL_COCOA || guiType == CarlaBackend::GUI_INTERNAL_HWND || guiType == CarlaBackend::GUI_INTERNAL_X11) - { - plugin->setGuiContainer(plugToolkit->getContainer()); - plugToolkit->setHasUI(true, true); - } - else - { - plugToolkit->setHasUI(guiType != CarlaBackend::GUI_NONE, false); - } - } - - void quit() - { - engine = nullptr; - plugin = nullptr; - - if (msgTimerGUI != 0) - { - killTimer(msgTimerGUI); - msgTimerGUI = 0; - } - - if (msgTimerOSC != 0) - { - killTimer(msgTimerOSC); - msgTimerOSC = 0; - } - } - - // --------------------------------------------------------------------- - - void setEngine(CarlaBackend::CarlaEngine* const engine) - { - qDebug("CarlaPluginClient::setEngine(%p)", engine); - CARLA_ASSERT(engine); - - this->engine = engine; - - engine->setOscBridgeData(m_oscData); - } - - void setPlugin(CarlaBackend::CarlaPlugin* const plugin) - { - qDebug("CarlaPluginClient::setPlugin(%p)", plugin); - CARLA_ASSERT(plugin); - - this->plugin = plugin; - - // load carla plugin preset if possible - if (const char* const pName = plugin->name()) - { - QFile pFile(QDir::currentPath() + QDir::separator() + pName + ".carxs"); - qDebug("Trying to load plugin preset file '%s'", pFile.fileName().toUtf8().constData()); - - if (! /*(*/pFile.exists() /*&& pFile.isReadable())*/) - { - qDebug("Plugin preset file doesn't exist or is not readable"); - return; - } - - if (! pFile.open(QFile::ReadOnly)) - { - qWarning("Plugin preset file read failed"); - return; - } - - QDomDocument xml; - xml.setContent(pFile.readAll()); - - QDomElement xmlNode(xml.documentElement()); - - if (xmlNode.tagName() == "CARLA-PRESET") - { - loadStateDict(getSaveStateDictFromXML(xmlNode)); - } - else - qWarning("Plugin preset file is not valid or corrupted"); - - pFile.close(); - } - } - - // --------------------------------------------------------------------- - - void loadStateDict(const CarlaSaveState* const content) - { - CARLA_ASSERT(content); - - if (! content) - return; - - qDebug("Loading plugin state now..."); - - // --------------------------------------------------------------------- - // Part 1 - set custom data (except chunks) - - foreach (const CarlaStateCustomData& customData, content->customData) - { - if (customData.type != CUSTOM_DATA_CHUNK) - { - const char* const type = customData.type.toUtf8().constData(); - const char* const key = customData.key.toUtf8().constData(); - const char* const value = customData.value.toUtf8().constData(); - - plugin->setCustomData(type, key, value, true); - } - } - - // --------------------------------------------------------------------- - // Part 2 - set program - - int32_t programId = -1; - - if (! content->currentProgramName.isEmpty()) - { - const uint32_t programCount = plugin->programCount(); - - char strBuf[STR_MAX] = { 0 }; - plugin->getProgramName(content->currentProgramIndex, strBuf); - QString testProgramName(strBuf); - - // Program name matches - if (content->currentProgramName == testProgramName) - { - programId = content->currentProgramIndex; - } - - // index < count - else if (content->currentProgramIndex < (int32_t)programCount) - { - programId = content->currentProgramIndex; - } - - // index not valid, try to find by name - else - { - for (uint32_t i=0; i < programCount; i++) - { - plugin->getProgramName(i, strBuf); - testProgramName = QString(strBuf); - - if (content->currentProgramName == testProgramName) - { - programId = i; - break; - } - } - } - } - - // set program now, if valid - if (programId >= 0) - { - plugin->setProgram(programId, true, true, false, true); - } - - // --------------------------------------------------------------------- - // Part 3 - set midi program - - if (content->currentMidiBank >= 0 and content->currentMidiProgram >= 0) - { - const uint32_t midiProgramCount = plugin->midiProgramCount(); - - for (uint32_t i=0; i < midiProgramCount; i++) - { - const MidiProgramData* const midiProgramData = plugin->midiProgramData(i); - - if ((int32_t)midiProgramData->bank == content->currentMidiBank && (int32_t)midiProgramData->program == content->currentMidiProgram) - { - plugin->setMidiProgram(i, true, true, false, true); - break; - } - } - } - - // --------------------------------------------------------------------- - // Part 4a - get plugin parameter symbols - - struct ParamSymbol { - uint32_t index; - QString symbol; - - ParamSymbol() {} - - ParamSymbol(uint32_t index_, const char* symbol_) - : index(index_), - symbol(symbol_) {} - }; - - QVector paramSymbols; - - foreach (const CarlaStateParameter& parameter, content->parameters) - { - if (! parameter.symbol.isEmpty()) - { - char strBuf[STR_MAX] = { 0 }; - plugin->getParameterSymbol(parameter.index, strBuf); - - if (strBuf[0] != 0) - { - ParamSymbol ps(parameter.index, strBuf); - paramSymbols.append(ps); - } - } - } - - // --------------------------------------------------------------------- - // Part 4b - set parameter values (carefully) - - const double sampleRate = engine->getSampleRate(); - - foreach (const CarlaStateParameter& parameter, content->parameters) - { - int32_t index = -1; - - if (content->type == "LADSPA") - { - // Try to set by symbol, otherwise use index - if (! parameter.symbol.isEmpty()) - { - bool breaked = false; - - foreach (const ParamSymbol& ps, paramSymbols) - { - if (parameter.symbol == ps.symbol) - { - index = ps.index; - breaked = true; - break; - } - } - - if (! breaked) - index = parameter.index; - } - else - index = parameter.index; - } - else if (content->type == "LV2") - { - // Symbol only - if (! parameter.symbol.isEmpty()) - { - bool breaked = false; - - foreach (const ParamSymbol& ps, paramSymbols) - { - if (parameter.symbol == ps.symbol) - { - index = ps.index; - breaked = true; - break; - } - } - - if (! breaked) - qWarning("Failed to find LV2 parameter symbol for '%s')", parameter.symbol.toUtf8().constData()); - } - else - qWarning("LV2 Plugin parameter '%s' has no symbol", parameter.name.toUtf8().constData()); - } - else - { - // Index only - index = parameter.index; - } - - // Now set parameter - if (index >= 0) - { - const ParameterData* const paramData = plugin->parameterData(index); - double value = parameter.value; - - if (paramData->hints & PARAMETER_USES_SAMPLERATE) - value *= sampleRate; - - plugin->setParameterValue(index, value, true, true, false); - plugin->setParameterMidiCC(index, parameter.midiCC, true, false); - plugin->setParameterMidiChannel(index, parameter.midiChannel-1, true, false); - } - else - qWarning("Could not set parameter data for '%s')", parameter.name.toUtf8().constData()); - } - - // --------------------------------------------------------------------- - // Part 5 - set chunk data - - foreach (const CarlaStateCustomData& customData, content->customData) - { - if (customData.type == CUSTOM_DATA_CHUNK) - { - const char* const type = customData.type.toUtf8().constData(); - const char* const key = customData.key.toUtf8().constData(); - const char* const value = customData.value.toUtf8().constData(); - - plugin->setCustomData(type, key, value, true); - } - } - - if (! content->chunk.isEmpty()) - plugin->setChunkData(content->chunk.toUtf8().constData()); - - qDebug("Loading plugin state now finished"); - } - - void guiClosed() - { - CARLA_ASSERT(engine); - - if (engine) - engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_HIDE_GUI, ""); - } - - void showPluginGui(const bool yesNo) - { - CARLA_ASSERT(plugin); - - if (plugin) - plugin->showGui(yesNo); - } - - // --------------------------------------------------------------------- - // processing - - void setParameter(const int32_t rindex, const double value) - { - qDebug("CarlaPluginClient::setParameter(%i, %g)", rindex, value); - CARLA_ASSERT(plugin); - - if (plugin) - plugin->setParameterValueByRIndex(rindex, value, true, true, false); - } - - void setProgram(const uint32_t index) - { - qDebug("CarlaPluginClient::setProgram(%i)", index); - CARLA_ASSERT(engine); - CARLA_ASSERT(plugin); - CARLA_ASSERT(index < plugin->programCount()); - - if (! (plugin && engine)) - return; - if (index >= plugin->programCount()) - return; - - plugin->setProgram(index, true, true, false, true); - - double value; - for (uint32_t i=0; i < plugin->parameterCount(); i++) - { - value = plugin->getParameterValue(i); - engine->osc_send_bridge_set_parameter_value(i, value); - engine->osc_send_bridge_set_default_value(i, value); - } - } - - void setMidiProgram(const uint32_t index) - { - qDebug("CarlaPluginClient::setMidiProgram(%i)", index); - CARLA_ASSERT(engine); - CARLA_ASSERT(plugin); - - if (! (plugin && engine)) - return; - - plugin->setMidiProgram(index, true, true, false, true); - - double value; - for (uint32_t i=0; i < plugin->parameterCount(); i++) - { - value = plugin->getParameterValue(i); - engine->osc_send_bridge_set_parameter_value(i, value); - engine->osc_send_bridge_set_default_value(i, value); - } - } - - void noteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) - { - qDebug("CarlaPluginClient::noteOn(%i, %i, %i)", channel, note, velo); - CARLA_ASSERT(plugin); - CARLA_ASSERT(velo > 0); - - if (! plugin) - return; - - plugin->sendMidiSingleNote(channel, note, velo, true, true, false); - } - - void noteOff(const uint8_t channel, const uint8_t note) - { - qDebug("CarlaPluginClient::noteOff(%i, %i)", channel, note); - CARLA_ASSERT(plugin); - - if (! plugin) - return; - - plugin->sendMidiSingleNote(channel, note, 0, true, true, false); - } - - // --------------------------------------------------------------------- - // plugin - - void saveNow() - { - qDebug("CarlaPluginClient::saveNow()"); - CARLA_ASSERT(plugin); - CARLA_ASSERT(engine); - - if (! (plugin && engine)) - return; - - plugin->prepareForSave(); - - for (uint32_t i=0; i < plugin->customDataCount(); i++) - { - const CarlaBackend::CustomData* const cdata = plugin->customData(i); - engine->osc_send_bridge_set_custom_data(cdata->type, cdata->key, cdata->value); - } - - if (plugin->hints() & CarlaBackend::PLUGIN_USES_CHUNKS) - { - void* data = nullptr; - int32_t dataSize = plugin->chunkData(&data); - - if (data && dataSize >= 4) - { - QString filePath; - filePath = QDir::tempPath(); -#ifdef Q_OS_WIN - filePath += "\\.CarlaChunk_"; -#else - filePath += "/.CarlaChunk_"; -#endif - filePath += plugin->name(); - - QFile file(filePath); - - if (file.open(QIODevice::WriteOnly)) - { - QByteArray chunk((const char*)data, dataSize); - file.write(chunk); - file.close(); - engine->osc_send_bridge_set_chunk_data(filePath.toUtf8().constData()); - } - } - } - - engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_SAVED, ""); - } - - void setCustomData(const char* const type, const char* const key, const char* const value) - { - qDebug("CarlaPluginClient::setCustomData(\"%s\", \"%s\", \"%s\")", type, key, value); - CARLA_ASSERT(plugin); - - if (! plugin) - return; - - plugin->setCustomData(type, key, value, true); - } - - void setChunkData(const char* const filePath) - { - qDebug("CarlaPluginClient::setChunkData(\"%s\")", filePath); - CARLA_ASSERT(plugin); - - if (! plugin) - return; - - QString chunkFilePath(filePath); - -#ifdef Q_OS_WIN - if (chunkFilePath.startsWith("/")) - { - // running under Wine, posix host - chunkFilePath = chunkFilePath.replace(0, 1, "Z:/"); - chunkFilePath = QDir::toNativeSeparators(chunkFilePath); - } -#endif - QFile chunkFile(chunkFilePath); - - if (plugin && chunkFile.open(QIODevice::ReadOnly | QIODevice::Text)) - { - QTextStream in(&chunkFile); - QString stringData(in.readAll()); - chunkFile.close(); - chunkFile.remove(); - - plugin->setChunkData(stringData.toUtf8().constData()); - } - } - - // --------------------------------------------------------------------- - // callback - - static void callback(void* const ptr, CarlaBackend::CallbackType const action, const unsigned short, const int value1, const int value2, const double value3, const char* const valueStr) - { - CARLA_ASSERT(ptr); - - if (CarlaPluginClient* const _this_ = (CarlaPluginClient*)ptr) - _this_->handleCallback(action, value1, value2, value3, valueStr); - } - - // --------------------------------------------------------------------- - -protected: - int msgTimerGUI; - int msgTimerOSC; - - bool needsResize; - int nextWidth; - int nextHeight; - - CarlaBackend::CarlaEngine* engine; - CarlaBackend::CarlaPlugin* plugin; - - std::set parametersToUpdate; - - void handleCallback(const CarlaBackend::CallbackType action, const int value1, const int value2, const double value3, const char* const valueStr) - { - CARLA_BACKEND_USE_NAMESPACE - qDebug("CarlaPluginClient::handleCallback(%s, %i, %i, %g \"%s\")", CallbackType2Str(action), value1, value2, value3, valueStr); - - if (! engine) - return; - - switch (action) - { - case CALLBACK_DEBUG: - break; - - case CALLBACK_PARAMETER_VALUE_CHANGED: - parametersToUpdate.insert(value1); - break; - - case CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: - // todo, unused? - break; - - case CALLBACK_PARAMETER_MIDI_CC_CHANGED: - // todo, unused? - break; - - case CALLBACK_PROGRAM_CHANGED: - engine->osc_send_bridge_set_program(value1); - break; - - case CALLBACK_MIDI_PROGRAM_CHANGED: - engine->osc_send_bridge_set_midi_program(value1); - break; - - case CALLBACK_NOTE_ON: - // todo - break; - - case CALLBACK_NOTE_OFF: - // todo - break; - - case CALLBACK_SHOW_GUI: - if (value1 == 0) - { - CarlaBridgeToolkitPlugin* const plugToolkit = (CarlaBridgeToolkitPlugin*)m_toolkit; - plugToolkit->guiClosedCallback(); - } - break; - - case CALLBACK_RESIZE_GUI: - nextWidth = value1; - nextHeight = value2; - needsResize = true; - break; - - case CALLBACK_UPDATE: - // todo - break; - - case CALLBACK_RELOAD_INFO: - // todo - break; - - case CALLBACK_RELOAD_PARAMETERS: - // todo - break; - - case CALLBACK_RELOAD_PROGRAMS: - // todo - break; - - case CALLBACK_RELOAD_ALL: - // todo - break; - - case CALLBACK_NSM_ANNOUNCE: - case CALLBACK_NSM_OPEN1: - case CALLBACK_NSM_OPEN2: - case CALLBACK_NSM_SAVE: - break; - - case CALLBACK_ERROR: - break; - - case CALLBACK_QUIT: - m_toolkit->quit(); - break; - } - } - - void timerEvent(QTimerEvent* const event) - { - if (qCloseNow) - return toolkitQuit(); - - if (qSaveNow) - { - // TODO - qSaveNow = false; - } - - if (event->timerId() == msgTimerGUI) - { - if (plugin) - plugin->idleGui(); - } - else if (event->timerId() == msgTimerOSC) - { - if (isOscControlRegistered()) - oscIdle(); - } - - QObject::timerEvent(event); - } -}; - -// ------------------------------------------------------------------------- - -void CarlaBridgeToolkitPlugin::show() -{ - qDebug("CarlaBridgeToolkitPlugin::show()"); - CARLA_ASSERT(gui); - - CarlaPluginClient* const plugClient = (CarlaPluginClient*)client; - - plugClient->showPluginGui(true); - - if (gui && m_uiShow) - gui->setVisible(true); -} - -void CarlaBridgeToolkitPlugin::hide() -{ - qDebug("CarlaBridgeToolkitPlugin::hide()"); - CARLA_ASSERT(gui); - - CarlaPluginClient* const plugClient = (CarlaPluginClient*)client; - - if (gui && m_uiShow) - gui->setVisible(false); - - plugClient->showPluginGui(false); -} - -void CarlaBridgeToolkitPlugin::guiClosedCallback() -{ - qDebug("CarlaBridgeToolkitPlugin::guiClosedCallback()"); - - CarlaPluginClient* const plugClient = (CarlaPluginClient*)client; - - if (m_uiQuit) - { - plugClient->quit(); - quit(); - } - else - { - plugClient->guiClosed(); - } -} - -// ------------------------------------------------------------------------- - -int CarlaBridgeOsc::handleMsgPluginSaveNow() -{ - qDebug("CarlaBridgeOsc::handleMsgPluginSaveNow()"); - - if (! client) - return 1; - - CarlaPluginClient* const plugClient = (CarlaPluginClient*)client; - plugClient->saveNow(); - - return 0; -} - -int CarlaBridgeOsc::handleMsgPluginSetChunk(CARLA_BRIDGE_OSC_HANDLE_ARGS) -{ - qDebug("CarlaBridgeOsc::handleMsgPluginSaveNow()"); - CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "s"); - - if (! client) - return 1; - - const char* const chunkFile = (const char*)&argv[0]->s; - - CarlaPluginClient* const plugClient = (CarlaPluginClient*)client; - plugClient->setChunkData(chunkFile); - - return 0; -} - -int CarlaBridgeOsc::handleMsgPluginSetCustomData(CARLA_BRIDGE_OSC_HANDLE_ARGS) -{ - qDebug("CarlaBridgeOsc::handleMsgPluginSaveNow()"); - CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(3, "sss"); - - if (! client) - return 1; - - const char* const type = (const char*)&argv[0]->s; - const char* const key = (const char*)&argv[1]->s; - const char* const value = (const char*)&argv[2]->s; - - CarlaPluginClient* const plugClient = (CarlaPluginClient*)client; - plugClient->setCustomData(type, key, value); - - return 0; -} - -// ------------------------------------------------------------------------- - -CARLA_BRIDGE_END_NAMESPACE - -int main(int argc, char* argv[]) -{ - CARLA_BRIDGE_USE_NAMESPACE - - if (argc != 6) - { - qWarning("usage: %s