ladi-claudia: Major cleanup & merge of changes in shared components from Houston4444/Caleson

See the updated README file for more info.
This commit is contained in:
Nedko Arnaudov 2024-05-09 22:11:27 +03:00
commit 5d37537aeb
133 changed files with 247 additions and 43141 deletions

5
.gitignore vendored
View File

@ -3,6 +3,7 @@
.fuse-*
.*.kate-swp
.kdev4/
.vscode
# Temp files
*~
@ -32,10 +33,6 @@ qrc_resources*.cpp
# Translation files
*.qm
# Binaries
c++/jackmeter/cadence-jackmeter
c++/xycontroller/cadence-xycontroller
# CX-Freeze builds
src/dist/

View File

@ -1,6 +1,6 @@
# --- INSTALL for Cadence ---
# --- INSTALL for Claudia ---
To install Cadence and its tools, simply run as usual: <br/>
To install Claudia, simply run as usual: <br/>
`$ make` <br/>
`$ [sudo] make install`
@ -14,69 +14,35 @@ Packagers can make use of the 'PREFIX' and 'DESTDIR' variable during install, li
<br/>
Use LRELEASE variable if case lrelease binary is not in PATH.
===== BUILD DEPENDENCIES =====
--------------------------------
The required build dependencies are: <i>(devel packages of these)</i>
- JACK
- Qt5
- PyQt5 (Py3 version)
On Debian and Ubuntu, use these commands to install all build dependencies: <br/>
`$ sudo apt-get install libjack-jackd2-dev qtbase5-dev qtbase5-dev-tools` <br/>
`$ sudo apt-get install qtbase5-dev qtbase5-dev-tools` <br/>
`$ sudo apt-get install python3-pyqt5 python3-pyqt5.qtsvg pyqt5-dev-tools`
To run all the apps/tools, you'll additionally need:
- python3-dbus
- python3-dbus.mainloop.qt
Optional but recommended:
- a2jmidid
- jack-capture
- pulseaudio[-module-jack]
The 'Cadence' app relies on jackdbus to work properly (either JACK2 or JACK1+DBus patch). <br/>
Claudia is a LADISH frontend, so it will obviously require LADISH to run.
The python version used and tested is python3.2. Older versions won't work! <br/>
After install, the app/tools will still work on distributions with python2 as default, without any additional work.
<br/>
===== RUNTIME DEPENDENCIES =====
----------------------------------
All tools require Python3 and Qt5 (PyQt5). <br/>
Here's the required run-time dependencies of each of the main tools:
### Cadence
Requires jack <br/>
Recommends a2jmidid (>= 7) and jackdbus <br/>
Suggests pulseaudio[-module-jack] <br/>
### Cadence-JackMeter
Requires jack <br/>
### Cadence-JackSettings
Requires jackdbus <br/>
### Cadence-Logs
No special requirements <br/>
### Cadence-Render
Requires jack-capture <br/>
### Cadence-XY Controller
Requires jack <br/>
### Catarina
No special requirements <br/>
### Catia
Requires jack <br/>
Recommends a2jmidid (>= 7) and jackdbus <br/>
### Claudia [Linux only] <br/>
Requires jackdbus and ladish <br/>
Claudia requires jackdbus and ladish <br/>
Recommends a2jmidid <br/>
To run Claudia you'll additionally need:
- python3-dbus
- python3-dbus.mainloop.qt
Optional:
- a2jmidid
After install, the Claudia should still work on distributions with python2,
without any additional work.

174
Makefile
View File

@ -1,11 +1,11 @@
#!/usr/bin/make -f
# Makefile for Cadence #
# Makefile for LADI/Claudia #
# ---------------------- #
# Created by falkTX
# Modified (post 2023) by Nedko Arnaudov
# Claudia was created by falkTX
# This and related files were modified (post 2023) by Nedko Arnaudov (LADI)
CODETREENAME="ladi-cadence"
VERSION="1.9.4"
CODETREENAME="ladi-claudia"
VERSION="2.5.0"
PREFIX = /usr/local
DESTDIR =
@ -16,13 +16,6 @@ PYRCC ?= pyrcc5
PYLUPDATE ?= pylupdate5
LRELEASE ?= lrelease
# Detect X11 rules dir
ifeq "$(wildcard /etc/X11/Xsession.d/ )" ""
X11_RC_DIR = $(DESTDIR)/etc/X11/xinit/xinitrc.d/
else
X11_RC_DIR = $(DESTDIR)/etc/X11/Xsession.d/
endif
# -----------------------------------------------------------------------------------------------------------------------------------------
# Internationalization
@ -30,18 +23,9 @@ I18N_LANGUAGES :=
# -----------------------------------------------------------------------------------------------------------------------------------------
all: CPP RES UI locale
default: RES UI
# -----------------------------------------------------------------------------------------------------------------------------------------
# C++ code
CPP: jackmeter xycontroller
jackmeter:
$(MAKE) -C c++/jackmeter
xycontroller:
$(MAKE) -C c++/xycontroller
all: RES UI
# -----------------------------------------------------------------------------------------------------------------------------------------
# Resources
@ -51,37 +35,20 @@ RES: src/resources_rc.py
src/resources_rc.py: resources/resources.qrc
$(PYRCC) $< -o $@
# -----------------------------------------------------------------------------------------------------------------------------------------
# Translations
locale: locale/cadence_en.qm locale/cadence_fr.qm
locale/%.qm: locale/%.ts
$(LRELEASE) $< -qm $@
# -----------------------------------------------------------------------------------------------------------------------------------------
# UI code
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 \
src/ui_cadence_rwait.py
catarina: src/ui_catarina.py \
src/ui_catarina_addgroup.py src/ui_catarina_removegroup.py src/ui_catarina_renamegroup.py \
src/ui_catarina_addport.py src/ui_catarina_removeport.py src/ui_catarina_renameport.py \
src/ui_catarina_connectports.py src/ui_catarina_disconnectports.py
catia: src/ui_catia.py
UI: claudia tools
claudia: src/ui_claudia.py \
src/ui_claudia_studioname.py src/ui_claudia_studiolist.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
src/ui_claudia_runcustom.py
#claudia: src/ui_claudia_launcher.py src/ui_claudia_launcher_app.py
tools: \
src/ui_logs.py src/ui_render.py \
src/ui_settings_app.py src/ui_settings_jack.py
src/ui_settings_app.py
src/ui_%.py: resources/ui/%.ui
$(PYUIC) $< -o $@
@ -89,9 +56,7 @@ src/ui_%.py: resources/ui/%.ui
# -----------------------------------------------------------------------------------------------------------------------------------------
clean:
$(MAKE) clean -C c++/jackmeter
$(MAKE) clean -C c++/xycontroller
rm -f *~ src/*~ src/*.pyc src/ui_*.py src/resources_rc.py resources/locale/*.qm
rm -f *~ src/*~ src/*.pyc src/ui_*.py src/resources_rc.py
# -----------------------------------------------------------------------------------------------------------------------------------------
@ -110,143 +75,62 @@ install:
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/
install -d $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/
install -d $(DESTDIR)$(PREFIX)/share/cadence/
install -d $(DESTDIR)$(PREFIX)/share/cadence/src/
install -d $(DESTDIR)$(PREFIX)/share/cadence/pulse2jack/
install -d $(DESTDIR)$(PREFIX)/share/cadence/pulse2loopback/
install -d $(DESTDIR)$(PREFIX)/share/cadence/icons/
install -d $(DESTDIR)$(PREFIX)/share/cadence/templates/
install -d $(DESTDIR)$(PREFIX)/share/cadence/locale/
install -d $(X11_RC_DIR)
install -d $(DESTDIR)$(PREFIX)/share/$(CODETREENAME)/
install -d $(DESTDIR)$(PREFIX)/share/$(CODETREENAME)/src/
install -d $(DESTDIR)$(PREFIX)/share/$(CODETREENAME)/icons/
install -d $(DESTDIR)$(PREFIX)/share/$(CODETREENAME)/templates/
# Install script files and binaries
install -m 755 \
data/cadence \
data/cadence-aloop-daemon \
data/cadence-jacksettings \
data/cadence-logs \
data/cadence-pulse2jack \
data/cadence-pulse2loopback \
data/cadence-render \
data/cadence-session-start \
data/catarina \
data/catia \
data/claudia \
data/claudia-launcher \
c++/jackmeter/cadence-jackmeter \
c++/xycontroller/cadence-xycontroller \
$(DESTDIR)$(PREFIX)/bin/
# Install desktop files
install -m 644 data/autostart/*.desktop $(DESTDIR)/etc/xdg/autostart/
install -m 644 data/*.desktop $(DESTDIR)$(PREFIX)/share/applications/
# Install icons, 16x16
install -m 644 resources/16x16/cadence.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/
install -m 644 resources/16x16/catarina.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/16x16/apps/
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/claudia-launcher.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/
install -m 644 resources/48x48/catarina.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/48x48/apps/
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/claudia-launcher.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/
install -m 644 resources/128x128/catarina.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/128x128/apps/
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/claudia-launcher.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/
install -m 644 resources/256x256/catarina.png $(DESTDIR)$(PREFIX)/share/icons/hicolor/256x256/apps/
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/claudia-launcher.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/
install -m 644 resources/scalable/catarina.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/
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/claudia-launcher.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/
# Install main code
install -m 644 src/*.py $(DESTDIR)$(PREFIX)/share/cadence/src/
# Install translations
install -m 644 locale/*.qm $(DESTDIR)$(PREFIX)/share/cadence/locale/
install -m 644 src/*.py $(DESTDIR)$(PREFIX)/share/$(CODETREENAME)/src/
# compile python files
python3 -m compileall $(DESTDIR)$(PREFIX)/share/cadence/src/
# Install addtional stuff for Cadence
install -m 644 data/pulse2jack/* $(DESTDIR)$(PREFIX)/share/cadence/pulse2jack/
install -m 644 data/pulse2loopback/* $(DESTDIR)$(PREFIX)/share/cadence/pulse2loopback/
install -m 755 data/61-cadence-session-inject.sh $(X11_RC_DIR)
python3 -m compileall $(DESTDIR)$(PREFIX)/share/$(CODETREENAME)/src/
# Install addtional stuff for Claudia
cp -r data/icons/* $(DESTDIR)$(PREFIX)/share/cadence/icons/
cp -r data/templates/* $(DESTDIR)$(PREFIX)/share/cadence/templates/
cp -r data/icons/* $(DESTDIR)$(PREFIX)/share/claudia/icons/
cp -r data/templates/* $(DESTDIR)$(PREFIX)/share/claudia/templates/
# Adjust PREFIX value in script files
sed -i "s?X-PREFIX-X?$(PREFIX)?" \
$(DESTDIR)$(PREFIX)/bin/cadence \
$(DESTDIR)$(PREFIX)/bin/cadence-aloop-daemon \
$(DESTDIR)$(PREFIX)/bin/cadence-jacksettings \
$(DESTDIR)$(PREFIX)/bin/cadence-logs \
$(DESTDIR)$(PREFIX)/bin/cadence-pulse2jack \
$(DESTDIR)$(PREFIX)/bin/cadence-pulse2loopback \
$(DESTDIR)$(PREFIX)/bin/cadence-render \
$(DESTDIR)$(PREFIX)/bin/cadence-session-start \
$(DESTDIR)$(PREFIX)/bin/catarina \
$(DESTDIR)$(PREFIX)/bin/catia \
$(DESTDIR)$(PREFIX)/bin/claudia \
$(DESTDIR)$(PREFIX)/bin/claudia-launcher \
$(X11_RC_DIR)/61-cadence-session-inject.sh
# Delete old scripts
rm -f $(X11_RC_DIR)/21cadence-session-inject
rm -f $(X11_RC_DIR)/61cadence-session-inject
rm -f $(X11_RC_DIR)/70cadence-plugin-paths
rm -f $(X11_RC_DIR)/99cadence-session-start
$(DESTDIR)$(PREFIX)/bin/claudia
# $(DESTDIR)$(PREFIX)/bin/claudia-launcher
# -----------------------------------------------------------------------------------------------------------------------------------------
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)/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/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/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)/etc/xdg/autostart/cadence-session-start.desktop
rm -f $(X11_RC_DIR)/61-cadence-session-inject.sh
rm -rf $(DESTDIR)$(PREFIX)/share/cadence/
# Delete old scripts
rm -f $(X11_RC_DIR)/21cadence-session-inject
rm -f $(X11_RC_DIR)/61cadence-session-inject
rm -f $(X11_RC_DIR)/70cadence-plugin-paths
rm -f $(X11_RC_DIR)/99cadence-session-start
rm -rf $(DESTDIR)$(PREFIX)/share/$(CODETREENAME)/
TARBALL_NAME := $(CODETREENAME)-$(VERSION)
dist:

View File

@ -1,63 +1,23 @@
# --- README for Cadence ---
# --- README for LADI/Claudia ---
Cadence is a set of tools useful for audio production. <br/>
It was developed by falkTX, using Python3 and Qt5 (and some C++ where needed).
LADI/Claudia is Qt frontend for LADISH.<br/>
It was developed by falkTX, using Python3 and Qt5.
The tools share the same base source code, so most of them look quite similar (which is intentional). <br/>
Also, lots of custom widgets were coded when needed (like pixmapdial, pixmapkeyboard, patchcanvas and systray). <br/>
They can be re-used in other projects.
Claudia (and Cadence suite) was abandoned by its original author in August 2023.
Cadence suite was abandoned by its original author in August 2023.
Since August 2023, the Cadence suite is maintained by Nedko Arnaudov (LADI project),
Since August 2023, LADI/Claudia is maintained by Nedko Arnaudov (LADI project),
the author of jackdbus and ladish.
In particular, fixes for CVE-2023-43782 and CVE-2023-43783 are applied.
Another fork, by Houston4444, provides the other apps for LADISH setups:
===== DESCRIPTIONS =====
------------------------
Here's a brief description of the main tools:
* Caleson - a fork of Cadence, "The main app".
It performs system checks, manages the JACK server (via jackdbus),
calls other tools and make system tweaks.
* Caleson-JackSettings, а simple and easy-to-use configure Qt GUI dialog for jackdbus.
It can configure JACK's driver and engine parameters,
and also works with for LADISH studios in LADIOS.
* Caleson-Logs, Small tool that shows JACK, A2J (and LADISH in LADIOS) logs in a multi-tab window.
The logs are viewed in a text box, making it easy
to browse and extract status messages using copy and paste commands.
### [Cadence](http://kxstudio.sourceforge.net/KXStudio:Applications:Cadence)
The main app. It performs system checks, manages JACK, calls other tools and make system tweaks.
### [Cadence-JackMeter](http://kxstudio.sourceforge.net/KXStudio:Applications:Cadence-JackMeter)
Digital peak meter for JACK. <br/>
It automatically connects itself to all application JACK output ports that are also connected to the system output.
### [Cadence-JackSettings](http://kxstudio.sourceforge.net/KXStudio:Applications:Cadence-JackSettings)
Simple and easy-to-use configure dialog for jackdbus. <br/>
It can configure JACK's driver and engine parameters, and it also supports LADISH studios.
### [Cadence-Logs](http://kxstudio.sourceforge.net/KXStudio:Applications:Cadence-Logs)
Small tool that shows JACK, A2J, LASH and LADISH logs in a multi-tab window. <br/>
The logs are viewed in a text box, making it easy to browse and extract status messages using copy and paste commands.
### [Cadence-Render](http://kxstudio.sourceforge.net/KXStudio:Applications:Cadence-Render)
Tool to record (or 'render') a JACK project using jack-capture, controlled by JACK Transport. <br/>
It supports a vast number of file types and can render in both realtime and freewheel modes.
### [Cadence-XY Controller](http://kxstudio.sourceforge.net/KXStudio:Applications:Cadence-XYController)
Simple XY widget that sends and receives data from Jack MIDI. <br/>
It can send data through specific channels and has a MIDI Keyboard too.
### [Catarina](http://kxstudio.sourceforge.net/KXStudio:Applications:Catarina)
A Patchbay test app, created while the patchcanvas module was being developed. <br/>
It allows the user to experiment with the patchbay, without using ALSA, JACK or LADISH. <br/>
You can save & load patchbay configurations too.
### [Catia](http://kxstudio.sourceforge.net/KXStudio:Applications:Catia)
JACK Patchbay, with some neat features like A2J bridge support and JACK Transport. <br/>
It's supposed to be as simple as possible (there's Claudia for advanced things), so it can work nicely on Windows and Mac too. <br/>
Currently has ALSA-MIDI support in experimental stage (it doesn't automatically refresh the canvas when changes happen externally).
### [Claudia](http://kxstudio.sourceforge.net/KXStudio:Applications:Claudia)
LADISH frontend; just like Catia, but focused at session management through LADISH. <br/>
It has a bit more features than the official LADISH GUI, with a nice preview of the main canvas in the bottom-left. <br/>
It also implements the 'Claudia-Launcher' add-application style for LADISH.
### [Claudia-Launcher](http://kxstudio.sourceforge.net/KXStudio:Applications:Claudia-Launcher)
A multimedia application launcher with LADISH support. <br/>
It searches for installed packages (not binaries), and displays the respective content as a launcher. <br/>
The content is got through an hardcoded database, created and/or modified to suit the target distribution. <br/>
Currently supports Debian and ArchLinux based distros.
https://github.com/Houston4444/Caleson

43
TODO
View File

@ -1,42 +1,3 @@
# Cadence tools TODO
# LADI/Claudia tools TODO
-------------------
- GENERAL -
Artwork:
- Add tools icons (logs, xy, meter)
GUI:
- Check shortcut consistency
All:
- Only use QSettings in function scope, not always opened (makes config still valid if a crash happens)
-------------------
- APPS -
Cadence:
- add freq info to systray tooltip
- add freq Hz change
- add desktop decriptions
- jacksettings, remember last tab
- reset xruns, change BufSize (reset xrun also in Unity desktop)
Claudia:
- Handle sample-rate changes in JACK (made possible by switch-master)
- rename canvas client should rename app name
Claudia-Launcher:
- Finish plugins
- Auto-close option
- jamin -p
-------------------
- MODULES -
PatchCanvas:
- Cleanup C++
- Implement export to Catarina file
- Implement auto-arrange
* Only use QSettings in function scope, not always opened (makes config still valid if a crash happens)

View File

@ -1,47 +0,0 @@
#!/usr/bin/make -f
# Makefile for Cadence C++ code #
# -------------------------------------------- #
# Created by falkTX
#
AR ?= ar
CC ?= gcc
CXX ?= g++
STRIP ?= strip
WINDRES ?= windres
HOSTBINS = $(shell pkg-config --variable=host_bins Qt5Core)
MOC ?= $(HOSTBINS)/moc
RCC ?= $(HOSTBINS)/rcc
UIC ?= $(HOSTBINS)/uic
# --------------------------------------------------------------
DEBUG ?= false
ifeq ($(DEBUG),true)
BASE_FLAGS = -O0 -g -Wall -Wextra
BASE_FLAGS += -DDEBUG
else
BASE_FLAGS = -O3 -ffast-math -Wall -Wextra
BASE_FLAGS += -DNDEBUG
endif
BASE_FLAGS += -fPIC
BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 $(CFLAGS)
BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS)
LINK_FLAGS = $(LDFLAGS)
ifneq ($(DEBUG),true)
BUILD_CXX_FLAGS += -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG_OUTPUT
endif
ifneq ($(SKIP_STRIPPING),true)
LINK_FLAGS += -Wl,--strip-all
endif
# --------------------------------------------------------------
# Currently broken
# HAVE_JACKSESSION = $(shell pkg-config --atleast-version=0.121.0 jack && echo true)

View File

@ -1,81 +0,0 @@
/*
* Common JACK code
* Copyright (C) 2012-2015 Filipe Coelho <falktx@falktx.com>
*
* 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 __JACK_UTILS_HPP__
#define __JACK_UTILS_HPP__
#include "jackbridge/JackBridge.cpp"
#include <cstring>
#include <string>
#include <vector>
static inline
std::vector<char*> jackbridge_port_get_all_connections_as_vector(jack_client_t* const client, jack_port_t* const port)
{
std::vector<char*> connectionsVector;
if (const char** const connections = jackbridge_port_get_all_connections(client, port))
{
for (int i=0; connections[i]; i++)
connectionsVector.push_back(strdup(connections[i]));
jackbridge_free(connections);
}
return connectionsVector;
}
static inline
std::string jackbridge_status_get_error_string(const jack_status_t& status)
{
std::string errorString;
if (status & JackFailure)
errorString += "Overall operation failed;\n";
if (status & JackInvalidOption)
errorString += "The operation contained an invalid or unsupported option;\n";
if (status & JackNameNotUnique)
errorString += "The desired client name was not unique;\n";
if (status & JackServerStarted)
errorString += "The JACK server was started as a result of this operation;\n";
if (status & JackServerFailed)
errorString += "Unable to connect to the JACK server;\n";
if (status & JackServerError)
errorString += "Communication error with the JACK server;\n";
if (status & JackNoSuchClient)
errorString += "Requested client does not exist;\n";
if (status & JackLoadFailure)
errorString += "Unable to load internal client;\n";
if (status & JackInitFailure)
errorString += "Unable to initialize client;\n";
if (status & JackShmFailure)
errorString += "Unable to access shared memory;\n";
if (status & JackVersionError)
errorString += "Client's protocol version does not match;\n";
if (status & JackBackendError)
errorString += "Backend Error;\n";
if (status & JackClientZombie)
errorString += "Client is being shutdown against its will;\n";
if (errorString.size() > 2)
errorString.replace(errorString.size()-2, 2, ".");
return errorString;
}
#endif // __JACK_UTILS_HPP__

File diff suppressed because it is too large Load Diff

View File

@ -1,357 +0,0 @@
/*
* JackBridge
* Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef JACKBRIDGE_HPP_INCLUDED
#define JACKBRIDGE_HPP_INCLUDED
#include "JackBridgeDefines.hpp"
#ifdef JACKBRIDGE_DIRECT
# include <jack/jack.h>
# include <jack/midiport.h>
# include <jack/transport.h>
# include <jack/custom.h>
#else
#include <cstddef>
#ifdef JACKBRIDGE_PROPER_CPP11_SUPPORT
# include <cstdint>
#else
# include <stdint.h>
#endif
#ifndef POST_PACKED_STRUCTURE
# ifdef __GNUC__
/* POST_PACKED_STRUCTURE needs to be a macro which
expands into a compiler directive. The directive must
tell the compiler to arrange the preceding structure
declaration so that it is packed on byte-boundaries rather
than use the natural alignment of the processor and/or
compiler.
*/
#define PRE_PACKED_STRUCTURE
#define POST_PACKED_STRUCTURE __attribute__((__packed__))
# else
#ifdef _MSC_VER
#define PRE_PACKED_STRUCTURE1 __pragma(pack(push,1))
#define PRE_PACKED_STRUCTURE PRE_PACKED_STRUCTURE1
/* PRE_PACKED_STRUCTURE needs to be a macro which
expands into a compiler directive. The directive must
tell the compiler to arrange the following structure
declaration so that it is packed on byte-boundaries rather
than use the natural alignment of the processor and/or
compiler.
*/
#define POST_PACKED_STRUCTURE ;__pragma(pack(pop))
/* and POST_PACKED_STRUCTURE needs to be a macro which
restores the packing to its previous setting */
#else
#define PRE_PACKED_STRUCTURE
#define POST_PACKED_STRUCTURE
#endif // _MSC_VER
# endif // __GNUC__
#endif
#define JACK_DEFAULT_AUDIO_TYPE "32 bit float mono audio"
#define JACK_DEFAULT_MIDI_TYPE "8 bit raw midi"
#define JACK_HAS_CUSTOM_DATA_API 1
#define JACK_HAS_PORT_IS_CONTROL_VOLTAGE_FLAG 1
#define JackOpenOptions (JackSessionID|JackServerName|JackNoStartServer|JackUseExactName)
#define JackLoadOptions (JackLoadInit|JackLoadName|JackUseExactName)
#define JACK_POSITION_MASK (JackPositionBBT|JackPositionTimecode)
#define EXTENDED_TIME_INFO
enum JackOptions {
JackNullOption = 0x00,
JackNoStartServer = 0x01,
JackUseExactName = 0x02,
JackServerName = 0x04,
JackLoadName = 0x08,
JackLoadInit = 0x10,
JackSessionID = 0x20
};
enum JackStatus {
JackFailure = 0x0001,
JackInvalidOption = 0x0002,
JackNameNotUnique = 0x0004,
JackServerStarted = 0x0008,
JackServerFailed = 0x0010,
JackServerError = 0x0020,
JackNoSuchClient = 0x0040,
JackLoadFailure = 0x0080,
JackInitFailure = 0x0100,
JackShmFailure = 0x0200,
JackVersionError = 0x0400,
JackBackendError = 0x0800,
JackClientZombie = 0x1000
};
enum JackLatencyCallbackMode {
JackCaptureLatency,
JackPlaybackLatency
};
enum JackPortFlags {
JackPortIsInput = 0x01,
JackPortIsOutput = 0x02,
JackPortIsPhysical = 0x04,
JackPortCanMonitor = 0x08,
JackPortIsTerminal = 0x10,
JackPortIsControlVoltage = 0x100
};
enum JackTransportState {
JackTransportStopped = 0,
JackTransportRolling = 1,
JackTransportLooping = 2,
JackTransportStarting = 3,
JackTransportNetStarting = 4
};
enum JackPositionBits {
JackPositionBBT = 0x010,
JackPositionTimecode = 0x020,
JackBBTFrameOffset = 0x040,
JackAudioVideoRatio = 0x080,
JackVideoFrameOffset = 0x100
};
enum JackSessionEventType {
JackSessionSave = 1,
JackSessionSaveAndQuit = 2,
JackSessionSaveTemplate = 3
};
enum JackSessionFlags {
JackSessionSaveError = 0x1,
JackSessionNeedTerminal = 0x2
};
enum JackCustomChange {
JackCustomRemoved,
JackCustomAdded,
JackCustomReplaced
};
typedef uint32_t jack_nframes_t;
typedef uint32_t jack_port_id_t;
typedef uint64_t jack_time_t;
typedef uint64_t jack_unique_t;
typedef unsigned char jack_midi_data_t;
typedef float jack_default_audio_sample_t;
typedef enum JackOptions jack_options_t;
typedef enum JackStatus jack_status_t;
typedef enum JackLatencyCallbackMode jack_latency_callback_mode_t;
typedef enum JackTransportState jack_transport_state_t;
typedef enum JackPositionBits jack_position_bits_t;
typedef enum JackSessionEventType jack_session_event_type_t;
typedef enum JackSessionFlags jack_session_flags_t;
typedef enum JackCustomChange jack_custom_change_t;
struct _jack_midi_event {
jack_nframes_t time;
size_t size;
jack_midi_data_t* buffer;
};
PRE_PACKED_STRUCTURE
struct _jack_latency_range {
jack_nframes_t min;
jack_nframes_t max;
} POST_PACKED_STRUCTURE;
PRE_PACKED_STRUCTURE
struct _jack_position {
jack_unique_t unique_1;
jack_time_t usecs;
jack_nframes_t frame_rate;
jack_nframes_t frame;
jack_position_bits_t valid;
int32_t bar;
int32_t beat;
int32_t tick;
double bar_start_tick;
float beats_per_bar;
float beat_type;
double ticks_per_beat;
double beats_per_minute;
double frame_time;
double next_time;
jack_nframes_t bbt_offset;
float audio_frames_per_video_frame;
jack_nframes_t video_offset;
int32_t padding[7];
jack_unique_t unique_2;
} POST_PACKED_STRUCTURE;
struct _jack_session_event {
jack_session_event_type_t type;
const char* session_dir;
const char* client_uuid;
char* command_line;
jack_session_flags_t flags;
uint32_t future;
};
struct _jack_session_command_t {
const char* uuid;
const char* client_name;
const char* command;
jack_session_flags_t flags;
};
typedef struct _jack_port jack_port_t;
typedef struct _jack_client jack_client_t;
typedef struct _jack_midi_event jack_midi_event_t;
typedef struct _jack_latency_range jack_latency_range_t;
typedef struct _jack_position jack_position_t;
typedef struct _jack_session_event jack_session_event_t;
typedef struct _jack_session_command_t jack_session_command_t;
typedef void (*JackLatencyCallback)(jack_latency_callback_mode_t mode, void* arg);
typedef int (*JackProcessCallback)(jack_nframes_t nframes, void* arg);
typedef void (*JackThreadInitCallback)(void* arg);
typedef int (*JackGraphOrderCallback)(void* arg);
typedef int (*JackXRunCallback)(void* arg);
typedef int (*JackBufferSizeCallback)(jack_nframes_t nframes, void* arg);
typedef int (*JackSampleRateCallback)(jack_nframes_t nframes, void* arg);
typedef void (*JackPortRegistrationCallback)(jack_port_id_t port, int register_, void* arg);
typedef void (*JackClientRegistrationCallback)(const char* name, int register_, void* arg);
typedef int (*JackClientRenameCallback)(const char* old_name, const char* new_name, void* arg);
typedef void (*JackPortConnectCallback)(jack_port_id_t a, jack_port_id_t b, int connect, void* arg);
typedef int (*JackPortRenameCallback)(jack_port_id_t port, const char* old_name, const char* new_name, void* arg);
typedef void (*JackFreewheelCallback)(int starting, void* arg);
typedef void (*JackShutdownCallback)(void* arg);
typedef void (*JackInfoShutdownCallback)(jack_status_t code, const char* reason, void* arg);
typedef int (*JackSyncCallback)(jack_transport_state_t state, jack_position_t* pos, void* arg);
typedef void (*JackTimebaseCallback)(jack_transport_state_t state, jack_nframes_t nframes, jack_position_t* pos, int new_pos, void* arg);
typedef void (*JackSessionCallback)(jack_session_event_t* event, void* arg);
typedef void (*JackCustomDataAppearanceCallback)(const char* client_name, const char* key, jack_custom_change_t change, void* arg);
#endif // ! JACKBRIDGE_DIRECT
JACKBRIDGE_EXPORT void jackbridge_get_version(int* major_ptr, int* minor_ptr, int* micro_ptr, int* proto_ptr);
JACKBRIDGE_EXPORT const char* jackbridge_get_version_string();
JACKBRIDGE_EXPORT jack_client_t* jackbridge_client_open(const char* client_name, jack_options_t options, jack_status_t* status, ...);
JACKBRIDGE_EXPORT const char* jackbridge_client_rename(jack_client_t* client, const char* new_name);
JACKBRIDGE_EXPORT bool jackbridge_client_close(jack_client_t* client);
JACKBRIDGE_EXPORT int jackbridge_client_name_size();
JACKBRIDGE_EXPORT char* jackbridge_get_client_name(jack_client_t* client);
JACKBRIDGE_EXPORT bool jackbridge_activate(jack_client_t* client);
JACKBRIDGE_EXPORT bool jackbridge_deactivate(jack_client_t* client);
JACKBRIDGE_EXPORT int jackbridge_get_client_pid(const char* name);
JACKBRIDGE_EXPORT bool jackbridge_is_realtime(jack_client_t* client);
JACKBRIDGE_EXPORT bool jackbridge_set_thread_init_callback(jack_client_t* client, JackThreadInitCallback thread_init_callback, void* arg);
JACKBRIDGE_EXPORT void jackbridge_on_shutdown(jack_client_t* client, JackShutdownCallback shutdown_callback, void* arg);
JACKBRIDGE_EXPORT void jackbridge_on_info_shutdown(jack_client_t* client, JackInfoShutdownCallback shutdown_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_process_callback(jack_client_t* client, JackProcessCallback process_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback freewheel_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback bufsize_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback srate_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_client_registration_callback(jack_client_t* client, JackClientRegistrationCallback registration_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_client_rename_callback(jack_client_t* client, JackClientRenameCallback rename_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_port_registration_callback(jack_client_t* client, JackPortRegistrationCallback registration_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_port_connect_callback(jack_client_t* client, JackPortConnectCallback connect_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_port_rename_callback(jack_client_t* client, JackPortRenameCallback rename_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_graph_order_callback(jack_client_t* client, JackGraphOrderCallback graph_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_xrun_callback(jack_client_t* client, JackXRunCallback xrun_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_latency_callback(jack_client_t* client, JackLatencyCallback latency_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_freewheel(jack_client_t* client, bool onoff);
JACKBRIDGE_EXPORT bool jackbridge_set_buffer_size(jack_client_t* client, jack_nframes_t nframes);
JACKBRIDGE_EXPORT jack_nframes_t jackbridge_get_sample_rate(jack_client_t* client);
JACKBRIDGE_EXPORT jack_nframes_t jackbridge_get_buffer_size(jack_client_t* client);
JACKBRIDGE_EXPORT float jackbridge_cpu_load(jack_client_t* client);
JACKBRIDGE_EXPORT jack_port_t* jackbridge_port_register(jack_client_t* client, const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size);
JACKBRIDGE_EXPORT bool jackbridge_port_unregister(jack_client_t* client, jack_port_t* port);
JACKBRIDGE_EXPORT void* jackbridge_port_get_buffer(jack_port_t* port, jack_nframes_t nframes);
JACKBRIDGE_EXPORT const char* jackbridge_port_name(const jack_port_t* port);
JACKBRIDGE_EXPORT const char* jackbridge_port_short_name(const jack_port_t* port);
JACKBRIDGE_EXPORT int jackbridge_port_flags(const jack_port_t* port);
JACKBRIDGE_EXPORT const char* jackbridge_port_type(const jack_port_t* port);
JACKBRIDGE_EXPORT bool jackbridge_port_is_mine(const jack_client_t* client, const jack_port_t* port);
JACKBRIDGE_EXPORT bool jackbridge_port_connected(const jack_port_t* port);
JACKBRIDGE_EXPORT bool jackbridge_port_connected_to(const jack_port_t* port, const char* port_name);
JACKBRIDGE_EXPORT const char** jackbridge_port_get_connections(const jack_port_t* port);
JACKBRIDGE_EXPORT const char** jackbridge_port_get_all_connections(const jack_client_t* client, const jack_port_t* port);
JACKBRIDGE_EXPORT bool jackbridge_port_set_name(jack_port_t* port, const char* port_name);
JACKBRIDGE_EXPORT bool jackbridge_port_set_alias(jack_port_t* port, const char* alias);
JACKBRIDGE_EXPORT bool jackbridge_port_unset_alias(jack_port_t* port, const char* alias);
JACKBRIDGE_EXPORT int jackbridge_port_get_aliases(const jack_port_t* port, char* const aliases[2]);
JACKBRIDGE_EXPORT bool jackbridge_port_request_monitor(jack_port_t* port, bool onoff);
JACKBRIDGE_EXPORT bool jackbridge_port_request_monitor_by_name(jack_client_t* client, const char* port_name, bool onoff);
JACKBRIDGE_EXPORT bool jackbridge_port_ensure_monitor(jack_port_t* port, bool onoff);
JACKBRIDGE_EXPORT bool jackbridge_port_monitoring_input(jack_port_t* port);
JACKBRIDGE_EXPORT bool jackbridge_connect(jack_client_t* client, const char* source_port, const char* destination_port);
JACKBRIDGE_EXPORT bool jackbridge_disconnect(jack_client_t* client, const char* source_port, const char* destination_port);
JACKBRIDGE_EXPORT bool jackbridge_port_disconnect(jack_client_t* client, jack_port_t* port);
JACKBRIDGE_EXPORT int jackbridge_port_name_size();
JACKBRIDGE_EXPORT int jackbridge_port_type_size();
JACKBRIDGE_EXPORT size_t jackbridge_port_type_get_buffer_size(jack_client_t* client, const char* port_type);
JACKBRIDGE_EXPORT void jackbridge_port_get_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range);
JACKBRIDGE_EXPORT void jackbridge_port_set_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range);
JACKBRIDGE_EXPORT bool jackbridge_recompute_total_latencies(jack_client_t* client);
JACKBRIDGE_EXPORT const char** jackbridge_get_ports(jack_client_t* client, const char* port_name_pattern, const char* type_name_pattern, unsigned long flags);
JACKBRIDGE_EXPORT jack_port_t* jackbridge_port_by_name(jack_client_t* client, const char* port_name);
JACKBRIDGE_EXPORT jack_port_t* jackbridge_port_by_id(jack_client_t* client, jack_port_id_t port_id);
JACKBRIDGE_EXPORT void jackbridge_free(void* ptr);
JACKBRIDGE_EXPORT uint32_t jackbridge_midi_get_event_count(void* port_buffer);
JACKBRIDGE_EXPORT bool jackbridge_midi_event_get(jack_midi_event_t* event, void* port_buffer, uint32_t event_index);
JACKBRIDGE_EXPORT void jackbridge_midi_clear_buffer(void* port_buffer);
JACKBRIDGE_EXPORT bool jackbridge_midi_event_write(void* port_buffer, jack_nframes_t time, const jack_midi_data_t* data, size_t data_size);
JACKBRIDGE_EXPORT jack_midi_data_t* jackbridge_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size);
JACKBRIDGE_EXPORT bool jackbridge_release_timebase(jack_client_t* client);
JACKBRIDGE_EXPORT bool jackbridge_set_sync_callback(jack_client_t* client, JackSyncCallback sync_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_set_sync_timeout(jack_client_t* client, jack_time_t timeout);
JACKBRIDGE_EXPORT bool jackbridge_set_timebase_callback(jack_client_t* client, bool conditional, JackTimebaseCallback timebase_callback, void* arg);
JACKBRIDGE_EXPORT bool jackbridge_transport_locate(jack_client_t* client, jack_nframes_t frame);
JACKBRIDGE_EXPORT jack_transport_state_t jackbridge_transport_query(const jack_client_t* client, jack_position_t* pos);
JACKBRIDGE_EXPORT jack_nframes_t jackbridge_get_current_transport_frame(const jack_client_t* client);
JACKBRIDGE_EXPORT bool jackbridge_transport_reposition(jack_client_t* client, const jack_position_t* pos);
JACKBRIDGE_EXPORT void jackbridge_transport_start(jack_client_t* client);
JACKBRIDGE_EXPORT void jackbridge_transport_stop(jack_client_t* client);
JACKBRIDGE_EXPORT bool jackbridge_custom_publish_data(jack_client_t* client, const char* key, const void* data, size_t size);
JACKBRIDGE_EXPORT bool jackbridge_custom_get_data(jack_client_t* client, const char* client_name, const char* key, void** data, size_t* size);
JACKBRIDGE_EXPORT bool jackbridge_custom_unpublish_data(jack_client_t* client, const char* key);
JACKBRIDGE_EXPORT bool jackbridge_custom_set_data_appearance_callback(jack_client_t* client, JackCustomDataAppearanceCallback callback, void* arg);
JACKBRIDGE_EXPORT const char** jackbridge_custom_get_keys(jack_client_t* client, const char* client_name);
#endif // JACKBRIDGE_HPP_INCLUDED

View File

@ -1,77 +0,0 @@
/*
* JackBridge common defines
* Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef JACKBRIDGE_DEFINES_HPP_INCLUDED
#define JACKBRIDGE_DEFINES_HPP_INCLUDED
// Check OS
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
# define JACKBRIDGE_OS_WIN64
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define JACKBRIDGE_OS_WIN32
#elif defined(__APPLE__)
# define JACKBRIDGE_OS_MAC
#elif defined(__HAIKU__)
# define JACKBRIDGE_OS_HAIKU
#elif defined(__linux__) || defined(__linux)
# define JACKBRIDGE_OS_LINUX
#else
# warning Unsupported platform!
#endif
#if defined(JACKBRIDGE_OS_WIN32) || defined(JACKBRIDGE_OS_WIN64)
# define JACKBRIDGE_OS_WIN
#elif ! defined(JACKBRIDGE_OS_HAIKU)
# define JACKBRIDGE_OS_UNIX
#endif
// Check for C++11 support
#if defined(HAVE_CPP11_SUPPORT)
# define JACKBRIDGE_PROPER_CPP11_SUPPORT
#elif defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
# define JACKBRIDGE_PROPER_CPP11_SUPPORT
# if (__GNUC__ * 100 + __GNUC_MINOR__) < 407
# define override // gcc4.7+ only
# endif
# endif
#endif
#ifndef JACKBRIDGE_PROPER_CPP11_SUPPORT
# define override
# define noexcept
# define nullptr (0)
#endif
// Common includes
#ifdef JACKBRIDGE_OS_WIN
# include <winsock2.h>
# include <windows.h>
#else
# include <unistd.h>
# ifndef __cdecl
# define __cdecl
# endif
#endif
// Define JACKBRIDGE_EXPORT
#if defined(JACKBRIDGE_OS_WIN) && ! defined(__WINE__)
# define JACKBRIDGE_EXPORT extern "C" __declspec (dllexport)
#else
# define JACKBRIDGE_EXPORT extern "C" __attribute__ ((visibility("default")))
#endif
#endif // JACKBRIDGE_DEFINES_HPP_INCLUDED

View File

@ -1,91 +0,0 @@
/*
* JackBridge library utils
* Copyright (C) 2013 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
* permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef JACKBRIDGE_LIB_UTILS_HPP_INCLUDED
#define JACKBRIDGE_LIB_UTILS_HPP_INCLUDED
#include "JackBridgeDefines.hpp"
#include <cstdio>
#ifndef JACKBRIDGE_OS_WIN
# include <dlfcn.h>
#endif
// -------------------------------------------------
// library related calls
static inline
void* lib_open(const char* const filename)
{
#ifdef JACKBRIDGE_OS_WIN
return (void*)LoadLibraryA(filename);
#else
return dlopen(filename, RTLD_NOW|RTLD_LOCAL);
#endif
}
static inline
bool lib_close(void* const lib)
{
if (lib == nullptr)
return false;
#ifdef JACKBRIDGE_OS_WIN
return FreeLibrary((HMODULE)lib);
#else
return (dlclose(lib) == 0);
#endif
}
static inline
void* lib_symbol(void* const lib, const char* const symbol)
{
if (lib == nullptr && symbol == nullptr)
return nullptr;
#ifdef JACKBRIDGE_OS_WIN
return (void*)GetProcAddress((HMODULE)lib, symbol);
#else
return dlsym(lib, symbol);
#endif
}
static inline
const char* lib_error(const char* const filename)
{
#ifdef JACKBRIDGE_OS_WIN
static char libError[2048];
LPVOID winErrorString;
DWORD winErrorCode = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, nullptr, winErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&winErrorString, 0, nullptr);
std::snprintf(libError, 2048, "%s: error code %li: %s", filename, winErrorCode, (const char*)winErrorString);
LocalFree(winErrorString);
return libError;
#else
return dlerror();
// unused
(void)filename;
#endif
}
// -------------------------------------------------
#endif // JACKBRIDGE_LIB_UTILS_HPP_INCLUDED

View File

@ -1,67 +0,0 @@
#!/usr/bin/make -f
# Makefile for jackbridge #
# ------------------------------------- #
# Created by falkTX
#
include ../../Makefile.mk
# --------------------------------------------------------------
WINECXX ?= wineg++
BUILD_CXX_FLAGS += -DJACKBRIDGE_EXPORT
BUILD_CXX_FLAGS += -I. -I../../includes -I../../utils
ifeq ($(MACOS),true)
LINK_FLAGS += -dynamiclib
else
LINK_FLAGS += -shared
endif
WIN_BUILD_FLAGS = $(BUILD_CXX_FLAGS) -DJACKBRIDGE_DUMMY=1 -w
WIN_32BIT_FLAGS = $(32BIT_FLAGS)
WIN_64BIT_FLAGS = $(64BIT_FLAGS)
WIN_LINK_FLAGS = $(LINK_FLAGS)
WINE_BUILD_FLAGS = $(BUILD_CXX_FLAGS) -fPIC
WINE_32BIT_FLAGS = $(32BIT_FLAGS) -L/usr/lib32/wine -L/usr/lib/i386-linux-gnu/wine
WINE_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64/wine -L/usr/lib/x86_64-linux-gnu/wine
WINE_LINK_FLAGS = $(LINK_FLAGS) -ldl -lrt -lpthread
OBJS = JackBridge1.cpp JackBridge2.cpp
OBJSw32 = JackBridge1.w32.o JackBridge2.w32.o
OBJSw64 = JackBridge1.w64.o JackBridge2.w64.o
# --------------------------------------------------------------
all:
win32: ../jackbridge-win32.dll
win64: ../jackbridge-win64.dll
wine32: ../jackbridge-win32.dll.so
wine64: ../jackbridge-win64.dll.so
# --------------------------------------------------------------
JackBridge%.w32.o: JackBridge%.cpp
$(CXX) $^ $(WINE_BUILD_FLAGS) $(WINE_32BIT_FLAGS) -c -o $@
JackBridge%.w64.o: JackBridge%.cpp
$(CXX) $^ $(WINE_BUILD_FLAGS) $(WINE_64BIT_FLAGS) -c -o $@
# --------------------------------------------------------------
../jackbridge-win32.dll: $(OBJS)
$(CXX) $^ $(WIN_BUILD_FLAGS) $(WIN_32BIT_FLAGS) $(WIN_LINK_FLAGS) -Wl,--output-def,$@.def,--out-implib,$@.a -o $@ $(CMD_STRIP) $@
../jackbridge-win64.dll: $(OBJS)
$(CXX) $^ $(WIN_BUILD_FLAGS) $(WIN_64BIT_FLAGS) $(WIN_LINK_FLAGS) -Wl,--output-def,$@.def,--out-implib,$@.a -o $@ $(CMD_STRIP) $@
../jackbridge-win32.dll.so: $(OBJSw32) ../jackbridge-win32.dll.def
$(WINECXX) $^ $(WINE_32BIT_FLAGS) $(WINE_LINK_FLAGS) -o $@ $(CMD_STRIP) $@
../jackbridge-win64.dll.so: $(OBJS) ../jackbridge-win64.dll.def
$(WINECXX) $^ $(WINE_64BIT_FLAGS) $(WINE_LINK_FLAGS) -o $@ $(CMD_STRIP) $@
# --------------------------------------------------------------

View File

@ -1,53 +0,0 @@
#!/usr/bin/make -f
# Makefile for jackmeter #
# -------------------------------- #
# Created by falkTX
#
include ../Makefile.mk
# --------------------------------------------------------------
BUILD_CXX_FLAGS += -I../widgets
BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)
LINK_FLAGS += $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets)
ifeq ($(HAVE_JACKSESSION),true)
BUILD_CXX_FLAGS += -DHAVE_JACKSESSION
endif
# --------------------------------------------------------------
FILES = \
qrc_resources-jackmeter.cpp
OBJS = \
jackmeter.o \
qrc_resources-jackmeter.o \
../widgets/digitalpeakmeter.o
# --------------------------------------------------------------
all: cadence-jackmeter
cadence-jackmeter: $(FILES) $(OBJS)
$(CXX) $(OBJS) $(LINK_FLAGS) -ldl -o $@
cadence-jackmeter.exe: $(FILES) $(OBJS) icon.o
$(CXX) $(OBJS) icon.o $(LINK_FLAGS) -limm32 -lole32 -luuid -lwinspool -lws2_32 -mwindows -o $@
# --------------------------------------------------------------
qrc_resources-jackmeter.cpp: ../../resources/resources-jackmeter.qrc
$(RCC) -name resources-jackmeter $< -o $@
icon.o: ../../resources/ico/cadence.rc
$(WINDRES) -i $< -o $@ -O coff
# --------------------------------------------------------------
.cpp.o:
$(CXX) -c $< $(BUILD_CXX_FLAGS) -o $@
clean:
rm -f $(FILES) $(OBJS) icon.o cadence-jackmeter*

View File

@ -1,261 +0,0 @@
/*
* Simple JACK Audio Meter
* Copyright (C) 2011-2015 Filipe Coelho <falktx@falktx.com>
*
* 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 <QtCore/Qt>
#ifndef Q_COMPILER_LAMBDA
# define nullptr (0)
#endif
#define VERSION "0.8.1"
#include "../jack_utils.hpp"
#include "../widgets/digitalpeakmeter.hpp"
#include <cmath>
#include <QtGui/QIcon>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMessageBox>
// -------------------------------
volatile double x_portValue1 = 0.0;
volatile double x_portValue2 = 0.0;
volatile bool x_isOutput = true;
volatile bool x_needReconnect = false;
volatile bool x_quitNow = false;
jack_client_t* jClient = nullptr;
jack_port_t* jPort1 = nullptr;
jack_port_t* jPort2 = nullptr;
QString gClientName;
// -------------------------------
// JACK callbacks
int process_callback(const jack_nframes_t nframes, void*)
{
float* const jOut1 = (float*)jackbridge_port_get_buffer(jPort1, nframes);
float* const jOut2 = (float*)jackbridge_port_get_buffer(jPort2, nframes);
for (jack_nframes_t i = 0; i < nframes; i++)
{
if (std::abs(jOut1[i]) > x_portValue1)
x_portValue1 = std::abs(jOut1[i]);
if (std::abs(jOut2[i]) > x_portValue2)
x_portValue2 = std::abs(jOut2[i]);
}
return 0;
}
void port_callback(jack_port_id_t, jack_port_id_t, int, void*)
{
if (x_isOutput)
x_needReconnect = true;
}
#ifdef HAVE_JACKSESSION
void session_callback(jack_session_event_t* const event, void* const arg)
{
#ifdef Q_OS_LINUX
QString filepath("cadence-jackmeter");
Q_UNUSED(arg);
#else
QString filepath((char*)arg);
#endif
event->command_line = strdup(filepath.toUtf8().constData());
jackbridge_session_reply(jClient, event);
if (event->type == JackSessionSaveAndQuit)
x_quitNow = true;
jackbridge_session_event_free(event);
}
#endif
// -------------------------------
// helpers
void reconnect_ports()
{
x_needReconnect = false;
const QString nameIn1(gClientName+":in1");
const QString nameIn2(gClientName+":in2");
if (x_isOutput)
{
jack_port_t* const jPlayPort1 = jackbridge_port_by_name(jClient, x_isOutput ? "system:playback_1" : "system:capture_1");
jack_port_t* const jPlayPort2 = jackbridge_port_by_name(jClient, x_isOutput ? "system:playback_2" : "system:capture_2");
std::vector<char*> jPortList1(jackbridge_port_get_all_connections_as_vector(jClient, jPlayPort1));
std::vector<char*> jPortList2(jackbridge_port_get_all_connections_as_vector(jClient, jPlayPort2));
foreach (char* const& thisPortName, jPortList1)
{
jack_port_t* const thisPort = jackbridge_port_by_name(jClient, thisPortName);
if (! (jackbridge_port_is_mine(jClient, thisPort) || jackbridge_port_connected_to(jPort1, thisPortName)))
jackbridge_connect(jClient, thisPortName, nameIn1.toUtf8().constData());
free(thisPortName);
}
foreach (char* const& thisPortName, jPortList2)
{
jack_port_t* const thisPort = jackbridge_port_by_name(jClient, thisPortName);
if (! (jackbridge_port_is_mine(jClient, thisPort) || jackbridge_port_connected_to(jPort2, thisPortName)))
jackbridge_connect(jClient, thisPortName, nameIn2.toUtf8().constData());
free(thisPortName);
}
jPortList1.clear();
jPortList2.clear();
}
else
{
if (jackbridge_port_by_name(jClient, "system:capture_1") != nullptr)
if (! jackbridge_port_connected_to(jPort1, "system:capture_1"))
jackbridge_connect(jClient, "system:capture_1", nameIn1.toUtf8().constData());
if (jackbridge_port_by_name(jClient, "system:capture_2") != nullptr)
if (! jackbridge_port_connected_to(jPort2, "system:capture_2"))
jackbridge_connect(jClient, "system:capture_2", nameIn2.toUtf8().constData());
}
}
// -------------------------------
// Meter class
class MeterW : public DigitalPeakMeter
{
public:
MeterW() : DigitalPeakMeter(nullptr)
{
setWindowFlags(Qt::Tool | Qt::WindowStaysOnTopHint);
setWindowTitle(gClientName);
if (x_isOutput)
setColor(Color::GREEN);
else
setColor(Color::BLUE);
setChannels(2);
setOrientation(VERTICAL);
setSmoothRelease(1);
displayMeter(1, 0.0f);
displayMeter(2, 0.0f);
int refresh = float(jackbridge_get_buffer_size(jClient)) / jackbridge_get_sample_rate(jClient) * 1000;
m_peakTimerId = startTimer(refresh > 50 ? refresh : 50);
}
protected:
void timerEvent(QTimerEvent* event)
{
if (x_quitNow)
{
close();
x_quitNow = false;
return;
}
if (event->timerId() == m_peakTimerId)
{
displayMeter(1