AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: All
-AllowShortLambdasOnASingleLine: All
-AllowShortIfStatementsOnASingleLine: WithoutElse
-AllowShortLoopsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: Inline
+AllowShortLambdasOnASingleLine: Empty
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
--- /dev/null
+externals/*
-Checks: '-*,modernize-deprecated-headers,modernize-loop-convert'
+Checks: '-*,modernize-deprecated-headers,modernize-loop-convert,google-build-using-namespace'
endif ()
if (rtaudio)
- add_compile_definitions(__RT_AUDIO__)
+ add_compile_definitions(RT_AUDIO)
endif ()
if (weakjack)
include_directories("externals/weakjack")
endif()
-if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
- add_compile_definitions(__LINUX__)
-elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- add_compile_definitions (__MAC_OSX__)
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set (ENV{PKG_CONFIG_PATH} "/usr/local/lib/pkgconfig")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
- add_compile_definitions(__WIN_32__ _WIN32_WINNT=0x0600 WIN32_LEAN_AND_MEAN)
+ add_compile_definitions(_WIN32_WINNT=0x0600 WIN32_LEAN_AND_MEAN)
if (EXISTS "C:/Program Files/JACK2/include")
include_directories("C:/Program Files/JACK2/include")
set (jacklib "C:/Program Files/JACK2/lib/libjack64.lib")
+- Version: "1.5.1"
+ Date: 2022-01-07
+ Description:
+ - (added) option to include the server in the patching for client fan out/in and full mix modes
+ - (added) clang-tidy and clang-format CI checks
+ - (update) [Meson] only add weakjack include directory when enabled
+ - (update) remove reserved macro identifiers // use predefined macros
+ - (update) remove 'using namespace std' and add clang-tidy check
+ - (fixed) nearly all clazy warnings level 2 fixed
+ - (fixed) missing Windows startmenu icon
+ - (fixed) missing initializer for PROCESSENTRY32 type (Windows)
- Version: "1.5.0"
Date: 2022-01-03
Description:
- (update) RtAudio device selection
- (update) build script moved to root directory
- Version: "1.3.0"
+ Date: 2021-01-14
Description:
- (added) async networking in hub listener
- (added) limiter, compressor, reverb
- (update) clipping to saturation
- (update) build instructions
- Version: "1.2.2"
+ Date: 2020-12-27
Description:
- (added) bindPort range to reject oddball connections
- (fixed) jack client name strings
- Version: "1.2.1"
+ Date: 2020-08-05
Description:
- (added) src/build script builds in ../builddir
- (fixed) refactor "Master" to be "Hub"
- (fixed) 1.2.1 correctly Versioned and tagged
- Version: "1.2"
+ Date: 2020-06-07
Description:
- (added) jack patching modes (-p) for Hub Mode server (-S)
- (fixed) Compilation under ubuntu
- (fixed) Fixed compilation for MacOSX10.11.sdk.
- (update) Updated to RtAudio 4.1.1, and using shared lib in linux.
- Version: "1.1"
+ Date: 2015-05-27
Description:
- (added) Support for RtAudio. Jacktrip can now be used without Jack
- (added) DNS Look-up support, now one machine can have a private IP (but still needs to have UDP ports open)
- (added) New port to Windows XP and Windows Vista (experimental and not tested for a long time, only when using jacktrip as a library)
- (added) Multiclient Server (experimental and not exposed in the executable)
- Version: "1.0.5"
+ Date: 2010-11-25
Description:
- (added) Compatibility with JamLink boxes (restricted at the moment to 48KHz, 64 buffer size and 1 channel)
- (added) New port structure that allows the communication between a public server and a local client
- (fixed) General optimizations and code cleanup
- (added) Improved, now cross-platform build script
- Version: "1.0.4"
+ Date: 2009-02-05
Description:
- (fixed) Buss error caused when no physical inputs or outputs ports are available
- Version: "1.0.3"
+ Date: 2008-12-29
Description:
- (added) Redundancy Algorithm for UDP Packets to avoid glitches with packet losses
- (fixed) Now compiles on 64bits machines
- (added) Some functionality reimplemented using signals and slots for more flexibility
- (added) Multiple-Client-Server in alpha testing, expect it working in the next release
- Version: "1.0.2"
+ Date: 2008-09-30
Type: development
Description:
- (added) Port offset mode, to use a different UDP port than the default one.
- (fixed) Improved thread behavior
- Version: "1.0.1"
+ Date: 2008-09-23
Type: development
Description:
- (added) jamlink mode to connect with jamlink boxes
- (added) Check for peer audio settings, program exists if they don't match
- (added) Automatically connect ports to available physical audio interface.
- Version: "1.0"
+ Date: 2008-09-23
Type: "development"
Description:
- initial release
It supports any number of channels (as many as the computer/network can handle) of bidirectional, high quality, uncompressed audio signal streaming.
You can use it between any combination of machines e.g., one end using Linux can connect to another using macOS.
+
+## Screenshots
+
+
+
+=== "Hubclient // Basic"
+
+ {width=450}
+
+=== "Hubclient // Plugins"
+
+ {width=450}
+
+=== "HubServer // Basic"
+
+ {width=450}
+
+=== "HubServer // Jitter Buffer"
+
+ {width=450}
+
// abs is now predefined
// template<typename T> T abs (T a) { return (a<T(0)) ? -a : a; }
-inline int lsr(int x, int n) { return int(((unsigned int)x) >> n); }
+inline int lsr(int x, int n)
+{
+ return int(((unsigned int)x) >> n);
+}
/******************************************************************************
*******************************************************************************
# configuration with RtAudio
rtaudio|bundled_rtaudio {
message(Building with RtAudio)
- DEFINES += __RT_AUDIO__
+ DEFINES += RT_AUDIO
}
# Configuration without Jack
nojack {
- DEFINES += __NO_JACK__
+ DEFINES += NO_JACK
}
# for plugins
#CONFIG += x86 #ppc #### If you have both libraries installed, you
# can change between 32bits (x86) or 64bits(x86_64) Change this to go back to 32 bits (x86)
LIBS += -framework CoreAudio -framework CoreFoundation
- DEFINES += __MAC_OSX__
!nogui {
LIBS += -framework Foundation
CONFIG += objective_c
}
QMAKE_CXXFLAGS += -g -O2
- DEFINES += __LINUX__
}
linux-g++ {
}
}
LIBS += -lWs2_32
- DEFINES += __WIN_32__
DEFINES += _WIN32_WINNT=0x0600 #needed for inet_pton
DEFINES += WIN32_LEAN_AND_MEAN
+ RC_FILE = win/qjacktrip.rc
}
DESTDIR = .
# X11 + XShm access
- --share=ipc
- --socket=x11
- - --socket=fallback-x11
- - --device=dri
# Wayland access
- - --socket=wayland
+ # - --socket=wayland
# Needs network access
- --share=network
# Pipewire/Jack
- --filesystem=xdg-run/pipewire-0
- - --system-talk-name=org.freedesktop.RealtimeKit1
+ # For setting realtime priority for network thread?
- --socket=system-bus
+cleanup:
+ - /lib/python3.8
+ - /share/man
modules:
- shared-modules/linux-audio/jack2.json
- name: python3-pyyaml
buildsystem: simple
+ cleanup: [ "*" ]
build-commands:
- pip3 install --verbose --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} "pyyaml" --no-build-isolation
sources:
url: https://files.pythonhosted.org/packages/36/2b/61d51a2c4f25ef062ae3f74576b01638bebad5e045f747ff12643df63844/PyYAML-6.0.tar.gz
- name: python3-jinja2
buildsystem: simple
+ cleanup: [ "*" ]
build-commands:
- pip3 install --verbose --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} "jinja2" --no-build-isolation
sources:
# X11 + XShm access
- --share=ipc
- --socket=x11
- - --socket=fallback-x11
- - --device=dri
- # Wayland access
- - --socket=wayland
+ # Wayland access (disabled because of missing window shadows)
+ # - --socket=wayland
# Needs network access
- --share=network
# Pipewire/Jack
- --filesystem=xdg-run/pipewire-0
- - --system-talk-name=org.freedesktop.RealtimeKit1
+ # For setting realtime priority for network thread?
- --socket=system-bus
+cleanup:
+ - /lib/python3.8
+ - /share/man
modules:
- shared-modules/linux-audio/jack2.json
- name: python3-pyyaml
buildsystem: simple
+ cleanup: [ "*" ]
build-commands:
- pip3 install --verbose --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} "pyyaml" --no-build-isolation
sources:
url: https://files.pythonhosted.org/packages/36/2b/61d51a2c4f25ef062ae3f74576b01638bebad5e045f747ff12643df63844/PyYAML-6.0.tar.gz
- name: python3-jinja2
buildsystem: simple
+ cleanup: [ "*" ]
build-commands:
- pip3 install --verbose --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} "jinja2" --no-build-isolation
sources:
# X11 + XShm access
- --share=ipc
- --socket=x11
- - --socket=fallback-x11
- - --device=dri
# Wayland access
- - --socket=wayland
+ # - --socket=wayland
# Needs network access
- --share=network
# Pipewire/Jack
- --filesystem=xdg-run/pipewire-0
- - --system-talk-name=org.freedesktop.RealtimeKit1
+ # For setting realtime priority for network thread?
- --socket=system-bus
+cleanup:
+ - /lib/python3.8
+ - /share/man
modules:
- shared-modules/linux-audio/jack2.json
- name: python3-pyyaml
buildsystem: simple
+ cleanup: [ "*" ]
build-commands:
- pip3 install --verbose --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} "pyyaml" --no-build-isolation
sources:
url: https://files.pythonhosted.org/packages/36/2b/61d51a2c4f25ef062ae3f74576b01638bebad5e045f747ff12643df63844/PyYAML-6.0.tar.gz
- name: python3-jinja2
buildsystem: simple
+ cleanup: [ "*" ]
build-commands:
- pip3 install --verbose --exists-action=i --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} "jinja2" --no-build-isolation
sources:
<name>JackTrip</name>
<summary>Connect and play with other musicians</summary>
+ <categories>
+ <category>Audio</category>
+ <category>Network</category>
+ </categories>
+
<description>
<p>
JackTrip is a cross-platform multi-machine audio system
<launchable type="desktop-id">@appid@.desktop</launchable>
- <url type="homepage">https://jacktrip.github.io/jacktrip/</url>
+ <url type="homepage">https://github.com/jacktrip/jacktrip</url>
+ <url type="help">https://jacktrip.github.io/jacktrip</url>
+ <url type="bugtracker">https://github.com/jacktrip/jacktrip/issues</url>
<project_group>JackTrip</project_group>
+ <developer_name>The JackTrip Community</developer_name>
<provides>
<binary>jacktrip</binary>
</provides>
+ <requires>
+ <control>keyboard</control>
+ <control>pointing</control>
+ <display_length compare="ge">907</display_length>
+ </requires>
+
+ <screenshots>
+ <screenshot type="default">
+ <caption>Hubclient Mode</caption>
+ <image>https://jacktrip.github.io/jacktrip/images/jacktrip_hubclient_basic.png</image>
+ </screenshot>
+ <screenshot>
+ <caption>Hubclient Mode // Plugins tab</caption>
+ <image>https://jacktrip.github.io/jacktrip/images/jacktrip_hubclient_plugins.png</image>
+ </screenshot>
+ <screenshot>
+ <caption>Hubserver Mode</caption>
+ <image>https://jacktrip.github.io/jacktrip/images/jacktrip_hubserver_basic.png</image>
+ </screenshot>
+ <screenshot>
+ <caption>Hubserver Mode // Jitter Buffer Tab</caption>
+ <image>https://jacktrip.github.io/jacktrip/images/jacktrip_hubserver_jitter.png</image>
+ </screenshot>
+ </screenshots>
+
<releases>
{%- for release in releases %}
<release version="{{ release.Version }}" {%- if release.Date %} date="{{ release.Date }}"{%- endif %}{% if release.Type == 'development' %} type="development"{% endif %}>
<description>
+ <ul>
{%- for change in release.Description %}
- <p>{{ change }}</p>
+ <li>{{ change }}</li>
{%- endfor %}
+ </ul>
</description>
</release>
{%- endfor %}
defines = ['-DWAIRTOHUB']
c_defines = []
-if host_machine.system() == 'linux'
- defines += '-D__LINUX__'
-elif host_machine.system() == 'darwin'
- defines += '-D__MAC_OSX__'
-elif host_machine.system() == 'windows'
- defines += '-D__WIN_32__'
- defines += '-D_WIN32_WINNT=0x0600'
- defines += '-DWIN32_LEAN_AND_MEAN'
- defines += '-DNOMINMAX'
-endif
-
-incdir = include_directories('externals/weakjack')
+incdirs = []
src = [ 'src/DataProtocol.cpp',
'src/JackTrip.cpp',
ui_h = []
qres = []
-
deps = [dependency('threads')]
+
+subdir('win')
+subdir('linux')
+
jack_dep = dependency('jack', required: get_option('jack'))
if not jack_dep.found()
- defines += '-D__NO_JACK__'
+ defines += '-DNO_JACK'
else
src += ['src/JackAudioInterface.cpp',
'src/JMess.cpp',
'src/Patcher.cpp']
moc_h += ['src/Patcher.h']
if get_option('weakjack') == true
+ incdirs += include_directories('externals/weakjack')
src += 'externals/weakjack/weak_libjack.c'
defines += '-DUSE_WEAK_JACK'
c_defines += '-DUSE_WEAK_JACK'
rtaudio_dep = dependency('rtaudio', required: get_option('rtaudio'))
if rtaudio_dep.found() == true
- defines += '-D__RT_AUDIO__'
+ defines += '-DRT_AUDIO'
src += 'src/RtAudioInterface.cpp'
deps += rtaudio_dep
endif
-if host_machine.system() == 'windows'
- deps += compiler.find_library('ws2_32', required: true)
-endif
-
-if compiler.get_id() == 'msvc'
- opt_var = cmake.subproject_options()
- if get_option('buildtype') == 'release'
- opt_var.add_cmake_defines({'CMAKE_BUILD_TYPE': 'Release'})
- else
- opt_var.add_cmake_defines({'CMAKE_BUILD_TYPE': 'Debug'})
- endif
- wingetopt = cmake.subproject('wingetopt', options: opt_var)
- deps += wingetopt.dependency('wingetopt')
-endif
-
if host_machine.system() == 'darwin'
src += ['src/gui/NoNap.mm']
# Adding CoreAudio here is a workaround and should be removed
add_languages('objcpp')
endif
-subdir('linux')
-
-jacktrip = executable('jacktrip', src, prepro_files, include_directories: incdir, dependencies: deps, c_args: c_defines, cpp_args: defines, install: true )
+jacktrip = executable('jacktrip', src, prepro_files, include_directories: incdirs, dependencies: deps, c_args: c_defines, cpp_args: defines, install: true )
help2man = find_program('help2man', required: false)
if not (host_machine.system() == 'windows')
features:
- navigation.tabs
markdown_extensions:
+ - attr_list
- pymdownx.snippets
- - pymdownx.tabbed
+ - pymdownx.tabbed:
+ alternate_style: true
- pymdownx.superfences
- pymdownx.details
- admonition
mInProcessBuffer.resize(mNumInChans);
mOutProcessBuffer.resize(mNumOutChans);
// Set pointer to NULL
- for (int i = 0; i < mNumInChans; i++) { mInProcessBuffer[i] = NULL; }
- for (int i = 0; i < mNumOutChans; i++) { mOutProcessBuffer[i] = NULL; }
+ for (int i = 0; i < mNumInChans; i++) {
+ mInProcessBuffer[i] = NULL;
+ }
+ for (int i = 0; i < mNumOutChans; i++) {
+ mOutProcessBuffer[i] = NULL;
+ }
#else // WAIR
int iCnt = (mNumInChans > mNumNetRevChans) ? mNumInChans : mNumNetRevChans;
int oCnt = (mNumOutChans > mNumNetRevChans) ? mNumOutChans : mNumNetRevChans;
int aCnt = (mNumNetRevChans) ? mNumInChans : 0;
- for (int i = 0; i < iCnt; i++) { mInProcessBuffer[i] = NULL; }
- for (int i = 0; i < oCnt; i++) { mOutProcessBuffer[i] = NULL; }
- for (int i = 0; i < aCnt; i++) { mAPInBuffer[i] = NULL; }
+ for (int i = 0; i < iCnt; i++) {
+ mInProcessBuffer[i] = NULL;
+ }
+ for (int i = 0; i < oCnt; i++) {
+ mOutProcessBuffer[i] = NULL;
+ }
+ for (int i = 0; i < aCnt; i++) {
+ mAPInBuffer[i] = NULL;
+ }
#endif // endwhere
mInBufCopy.resize(mNumInChans);
delete[] mAudioInputPacket;
delete[] mAudioOutputPacket;
#ifndef WAIR // NOT WAIR:
- for (int i = 0; i < mNumInChans; i++) { delete[] mInProcessBuffer[i]; }
+ for (int i = 0; i < mNumInChans; i++) {
+ delete[] mInProcessBuffer[i];
+ }
- for (int i = 0; i < mNumOutChans; i++) { delete[] mOutProcessBuffer[i]; }
+ for (int i = 0; i < mNumOutChans; i++) {
+ delete[] mOutProcessBuffer[i];
+ }
#else // WAIR
int iCnt = (mNumInChans > mNumNetRevChans) ? mNumInChans : mNumNetRevChans;
int oCnt = (mNumOutChans > mNumNetRevChans) ? mNumOutChans : mNumNetRevChans;
int aCnt = (mNumNetRevChans) ? mNumInChans : 0;
- for (int i = 0; i < iCnt; i++) { delete[] mInProcessBuffer[i]; }
- for (int i = 0; i < oCnt; i++) { delete[] mOutProcessBuffer[i]; }
- for (int i = 0; i < aCnt; i++) { delete[] mAPInBuffer[i]; }
+ for (int i = 0; i < iCnt; i++) {
+ delete[] mInProcessBuffer[i];
+ }
+ for (int i = 0; i < oCnt; i++) {
+ delete[] mOutProcessBuffer[i];
+ }
+ for (int i = 0; i < aCnt; i++) {
+ delete[] mAPInBuffer[i];
+ }
#endif // endwhere
- for (auto* i : qAsConst(mProcessPluginsFromNetwork)) { delete i; }
- for (auto* i : qAsConst(mProcessPluginsToNetwork)) { delete i; }
- for (int i = 0; i < mNumInChans; i++) { delete[] mInBufCopy[i]; }
+ for (auto* i : qAsConst(mProcessPluginsFromNetwork)) {
+ delete i;
+ }
+ for (auto* i : qAsConst(mProcessPluginsToNetwork)) {
+ delete i;
+ }
+ for (int i = 0; i < mNumInChans; i++) {
+ delete[] mInBufCopy[i];
+ }
}
//*******************************************************************************
for (int i = 0; i < mNumNetRevChans; i++) {
sample_t* mix_sample = out_buffer[i % mNumOutChans];
sample_t* tmp_sample = mNetInBuffer[i]; // mNetInBuffer
- for (int j = 0; j < (int)n_frames; j++) { mix_sample[j] += tmp_sample[j]; }
+ for (int j = 0; j < (int)n_frames; j++) {
+ mix_sample[j] += tmp_sample[j];
+ }
} // nib6 to aob2
#else // AP
for (int i = 0; i < mNumNetRevChans; i++) {
sample_t* mix_sample = mAPInBuffer[i % mNumOutChans];
sample_t* tmp_sample = mNetInBuffer[i];
- for (int j = 0; j < n_frames; j++) { mix_sample[j] += tmp_sample[j]; }
+ for (int j = 0; j < n_frames; j++) {
+ mix_sample[j] += tmp_sample[j];
+ }
} // nib16 to apib2
for (int i = 0; i < mNumOutChans; i++) {
std::memset(out_buffer[i], 0, sizeof(sample_t) * n_frames);
for (int i = 0; i < mNumInChans; i++) {
sample_t* mix_sample = out_buffer[i];
sample_t* tmp_sample = in_buffer[i];
- for (int j = 0; j < n_frames; j++) { mix_sample[j] += tmp_sample[j]; }
+ for (int j = 0; j < n_frames; j++) {
+ mix_sample[j] += tmp_sample[j];
+ }
}
// add aib2 to aob2
#endif // ADD_DIRECT
//*******************************************************************************
void AudioInterface::appendProcessPluginToNetwork(ProcessPlugin* plugin)
{
- if (not plugin) { return; }
+ if (not plugin) {
+ return;
+ }
int nTestChans = (mAudioTesterP && mAudioTesterP->getEnabled()) ? 1 : 0;
int nPluginChans = mNumInChans - nTestChans;
assert(nTestChans == 0 || (mAudioTesterP->getSendChannel() == mNumInChans - 1));
void AudioInterface::appendProcessPluginFromNetwork(ProcessPlugin* plugin)
{
- if (not plugin) { return; }
+ if (not plugin) {
+ return;
+ }
int nTestChans = (mAudioTesterP && mAudioTesterP->getEnabled()) ? 1 : 0;
int nPluginChans = mNumOutChans - nTestChans;
assert(nTestChans == 0 || (mAudioTesterP->getSendChannel() == mNumOutChans - 1));
mBufferSizeInSamples = buf_size;
}
/// \brief Set Client Name to something different that the default (JackTrip)
- virtual void setClientName(QString ClientName) = 0;
+ virtual void setClientName(const QString& ClientName) = 0;
virtual void setLoopBack(bool b) { mLoopBack = b; }
virtual void enableBroadcastOutput() {}
virtual void setAudioTesterP(AudioTester* atp) { mAudioTesterP = atp; }
if (sendImpulse) {
assert(sendChannel < mInBufCopy.size());
mInBufCopy[sendChannel][0] = getImpulseAmp();
- for (uint n = 1; n < n_frames; n++) { mInBufCopy[sendChannel][n] = 0; }
+ for (uint n = 1; n < n_frames; n++) {
+ mInBufCopy[sendChannel][n] = 0;
+ }
impulsePending = true;
impulseTimeUS = timeMicroSec();
impulseTimeSamples = sampleCountSinceImpulse; // timer in samples for current
} else {
mInBufCopy[sendChannel][0] =
0.0f; // send zeros until a new impulse is needed
- if (n_frames > 1) { mInBufCopy[sendChannel][1] = 0.0f; }
+ if (n_frames > 1) {
+ mInBufCopy[sendChannel][1] = 0.0f;
+ }
}
} else {
bufferSkip--;
int histLast = latencyHistogramLastNonzeroCellIndex();
for (int i = histStart; i <= histLast; ++i) {
int lhi = latencyHistogram[i];
- if (lhi > lhMax) { lhMax = lhi; }
+ if (lhi > lhMax) {
+ lhMax = lhi;
+ }
}
return lhMax;
}
int latencyHistogramFirstNonzeroCellIndex()
{
for (int i = latencyHistogramCellMin; i <= latencyHistogramCellMax; i++) {
- if (latencyHistogram[i] > 0) { return i; }
+ if (latencyHistogram[i] > 0) {
+ return i;
+ }
}
std::cerr << "*** AudioTester: LATENCY HISTOGRAM IS EMPTY!\n";
return -1;
int latencyHistogramLastNonzeroCellIndex()
{
for (int i = latencyHistogramCellMax; i >= latencyHistogramCellMin; i--) {
- if (latencyHistogram[i] > 0) { return i; }
+ if (latencyHistogram[i] > 0) {
+ return i;
+ }
}
std::cerr << "*** AudioTester: LATENCY HISTOGRAM IS EMPTY!\n";
return -1;
std::to_string(int(latencyHistogramCellWidth * double(i + 1)));
// std::string histr = boost::format("%02d",hi);
std::string histr = std::to_string(hi);
- while (histr.length() < 3) { histr = " " + histr; }
+ while (histr.length() < 3) {
+ histr = " " + histr;
+ }
std::string row = "[" + istrm1 + "-" + istr + "ms]=" + histr + ":";
- for (int j = 0; j < hin; j++) { row += marker; }
+ for (int j = 0; j < hin; j++) {
+ row += marker;
+ }
rows += row + "\n";
}
- if (histLast == latencyHistogramCellMax) { rows += " and above\n"; }
+ if (histLast == latencyHistogramCellMax) {
+ rows += " and above\n";
+ }
return rows;
}
};
#include <QThread>
#include <iostream>
-Auth::Auth(QString fileName)
- : m_days({"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"}), m_authFileName(fileName)
+Auth::Auth(const QString& fileName, QObject* parent)
+ : QObject(parent)
+ , m_days({"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"})
+ , m_authFileName(fileName)
{
// Load our credentials file.
loadAuthFile(m_authFileName);
&Auth::reloadAuthFile, Qt::QueuedConnection);
}
-Auth::AuthResponseT Auth::checkCredentials(QString username, QString password)
+Auth::AuthResponseT Auth::checkCredentials(const QString& username,
+ const QString& password)
{
- if (username.isEmpty() || password.isEmpty()) { return WRONGCREDS; }
+ if (username.isEmpty() || password.isEmpty()) {
+ return WRONGCREDS;
+ }
if (m_passwordTable.contains(username)) {
// Check our generated hash against our stored hash.
- QString salt = m_passwordTable[username].section("$", 2, 2);
+ QString salt = m_passwordTable[username].section(QStringLiteral("$"), 2, 2);
QString hash(generateSha512Hash(password, salt));
if (hash == m_passwordTable[username]) {
loadAuthFile(m_authFileName);
}
-void Auth::loadAuthFile(QString filename)
+void Auth::loadAuthFile(const QString& filename)
{
QFile file(filename);
if (file.open(QIODevice::ReadOnly)) {
int lineNumber = 0;
while (!input.atEnd()) {
lineNumber++;
- QStringList lineParts = input.readLine().split(":");
+ QStringList lineParts = input.readLine().split(QStringLiteral(":"));
if (lineParts.count() < 3) {
// We don't have a correctly formatted line. Ignore it.
std::cout
// Check that our password hash is useable.
bool invalid = false;
- if (lineParts.at(1).startsWith("$6$")) {
- QStringList hashParts = lineParts.at(1).split("$");
+ if (lineParts.at(1).startsWith(QLatin1String("$6$"))) {
+ QStringList hashParts = lineParts.at(1).split(QStringLiteral("$"));
if (hashParts.count() < 4) {
invalid = true;
} else if (hashParts.at(2).isEmpty() || hashParts.at(3).isEmpty()) {
}
}
-bool Auth::checkTime(QString username)
+bool Auth::checkTime(const QString& username)
{
- QStringList times = m_timesTable[username].split(",");
+ QStringList times = m_timesTable[username].split(QStringLiteral(","));
// First check for the all or none cases.
if (times.count() == 1 && times.at(0).isEmpty()) {
return false;
- } else if (times.contains("*")) {
+ } else if (times.contains(QStringLiteral("*"))) {
return true;
}
if (times.at(i).startsWith(dayOfWeek)) {
QString accessTime = QString(times.at(i)).remove(0, 2);
// Check for the all day option first.
- if (accessTime == "*") { return true; }
+ if (accessTime == QLatin1String("*")) {
+ return true;
+ }
// See if we can interpret it as a time range.
bool valid = false;
- QStringList range = accessTime.split("-");
+ QStringList range = accessTime.split(QStringLiteral("-"));
if (range.count() == 2) {
- QTime start = QTime::fromString(range.at(0), "hhmm");
- QTime end = QTime::fromString(range.at(1), "hhmm");
+ QTime start = QTime::fromString(range.at(0), QStringLiteral("hhmm"));
+ QTime end = QTime::fromString(range.at(1), QStringLiteral("hhmm"));
if (start.isValid() && end.isValid()) {
valid = true;
{
// Returns a base 64 enconding using the following characters:
// ./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
- if (value < 0 || value >= 64) { return 0; }
+ if (value < 0 || value >= 64) {
+ return 0;
+ }
if (value < 12) {
return (value + 46);
return output;
}
-QByteArray Auth::generateSha512Hash(QString passwordString, QString saltString)
+QByteArray Auth::generateSha512Hash(const QString& passwordString,
+ const QString& saltString)
{
// Qt implementation of the unix crypt using SHA-512
// (Should give the same output as openssl passwd -6)
// Step 9 and 10
int n;
- for (n = passwd.length(); n > 64; n -= 64) { a.addData(bResult); }
+ for (n = passwd.length(); n > 64; n -= 64) {
+ a.addData(bResult);
+ }
a.addData(bResult.constData(), n);
// Step 11
// Step 13
// Reuse a as dp.
a.reset();
- for (n = 0; n < passwd.length(); n++) { a.addData(passwd); }
+ for (n = 0; n < passwd.length(); n++) {
+ a.addData(passwd);
+ }
QByteArray dp = a.result();
// Step 16
QByteArray p;
- for (n = passwd.length(); n > 64; n -= 64) { p.append(dp); }
+ for (n = passwd.length(); n > 64; n -= 64) {
+ p.append(dp);
+ }
p.append(dp.constData(), n);
// Step 17
// Reuse b as ds
b.reset();
- for (n = 16 + (unsigned char)aResult.at(0); n > 0; n--) { b.addData(salt); }
+ for (n = 16 + (unsigned char)aResult.at(0); n > 0; n--) {
+ b.addData(salt);
+ }
QByteArray ds = b.result();
// Step 20
QByteArray s;
- for (n = salt.length(); n > 64; n -= 64) { s.append(ds); }
+ for (n = salt.length(); n > 64; n -= 64) {
+ s.append(ds);
+ }
s.append(ds.constData(), n);
// Step 21
a.addData(aResult);
}
- if (n % 3) { a.addData(s); }
- if (n % 7) { a.addData(p); }
+ if (n % 3) {
+ a.addData(s);
+ }
+ if (n % 7) {
+ a.addData(p);
+ }
if (n & 1) {
a.addData(aResult);
WRONGTIME = 5 << 16
};
- Auth(QString fileName);
+ Auth(const QString& fileName, QObject* parent = nullptr);
~Auth();
- AuthResponseT checkCredentials(QString username, QString password);
+ AuthResponseT checkCredentials(const QString& username, const QString& password);
private slots:
void reloadAuthFile();
private:
- void loadAuthFile(QString filename);
- bool checkTime(QString username);
+ void loadAuthFile(const QString& filename);
+ bool checkTime(const QString& username);
char char64(int value);
QByteArray charGroup(unsigned char byte3, unsigned char byte2, unsigned char byte1,
unsigned int n);
- QByteArray generateSha512Hash(QString passwordString, QString saltString);
+ QByteArray generateSha512Hash(const QString& passwordString,
+ const QString& saltString);
QStringList m_days;
QHash<QString, QString> m_passwordTable;
#ifndef __DATAPROTOCOL_H__
#define __DATAPROTOCOL_H__
-#ifdef __WIN_32__
+#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
-#ifndef __WIN_32__
+#ifndef _WIN32
#include <arpa/inet.h> //inet(3) functions
#include <netdb.h>
#include <netinet/in.h> //sockaddr_in{} and other Internet defns
// virtual void getPeerAddressFromFirstPacket(QHostAddress& peerHostAddress,
// uint16_t& port) = 0;
-#if defined(__WIN_32__)
+#if defined(_WIN32)
virtual void setSocket(SOCKET& socket) = 0;
#else
virtual void setSocket(int& socket) = 0;
void signalError(const char* error_message);
void signalReceivedConnectionFromPeer();
- void signalCeaseTransmission(const QString& reason = "");
+ void signalCeaseTransmission(const QString& reason = QLatin1String(""));
protected:
/** \brief Get the Run Mode of the object
assert(inCompressorP == nullptr);
inCompressorP =
new Compressor(mNumIncomingChans, gVerboseFlag, inCompressorPreset);
- if (gVerboseFlag) { std::cout << "Set up INCOMING COMPRESSOR\n"; }
+ if (gVerboseFlag) {
+ std::cout << "Set up INCOMING COMPRESSOR\n";
+ }
incomingEffects.push_back(inCompressorP);
}
if (inZitarev) {
assert(inZitarevP == nullptr);
inZitarevP =
new Reverb(mNumIncomingChans, mNumIncomingChans, 1.0 + zitarevInLevel);
- if (gVerboseFlag) { std::cout << "Set up INCOMING REVERB (Zitarev)\n"; }
+ if (gVerboseFlag) {
+ std::cout << "Set up INCOMING REVERB (Zitarev)\n";
+ }
incomingEffects.push_back(inZitarevP);
}
if (inFreeverb) {
assert(inFreeverbP == nullptr);
inFreeverbP =
new Reverb(mNumIncomingChans, mNumIncomingChans, freeverbInLevel);
- if (gVerboseFlag) { std::cout << "Set up INCOMING REVERB (Freeverb)\n"; }
+ if (gVerboseFlag) {
+ std::cout << "Set up INCOMING REVERB (Freeverb)\n";
+ }
incomingEffects.push_back(inFreeverbP);
}
// LIMITER MUST GO LAST:
assert(outCompressorP == nullptr);
outCompressorP =
new Compressor(mNumOutgoingChans, gVerboseFlag, outCompressorPreset);
- if (gVerboseFlag) { std::cout << "Set up OUTGOING COMPRESSOR\n"; }
+ if (gVerboseFlag) {
+ std::cout << "Set up OUTGOING COMPRESSOR\n";
+ }
outgoingEffects.push_back(outCompressorP);
}
if (outZitarev) {
assert(outZitarevP == nullptr);
outZitarevP =
new Reverb(mNumOutgoingChans, mNumOutgoingChans, 1.0 + zitarevOutLevel);
- if (gVerboseFlag) { std::cout << "Set up OUTGOING REVERB (Zitarev)\n"; }
+ if (gVerboseFlag) {
+ std::cout << "Set up OUTGOING REVERB (Zitarev)\n";
+ }
outgoingEffects.push_back(outZitarevP);
}
if (outFreeverb) {
assert(outFreeverbP == nullptr);
outFreeverbP =
new Reverb(mNumOutgoingChans, mNumOutgoingChans, freeverbOutLevel);
- if (gVerboseFlag) { std::cout << "Set up OUTGOING REVERB (Freeverb)\n"; }
+ if (gVerboseFlag) {
+ std::cout << "Set up OUTGOING REVERB (Freeverb)\n";
+ }
outgoingEffects.push_back(outFreeverbP);
}
// LIMITER MUST GO LAST:
ulong argLen = strlen(optarg);
for (ulong i = 0; i < argLen; i++) {
- if (optarg[i] != ')' && parenLevel > 0) { continue; }
+ if (optarg[i] != ')' && parenLevel > 0) {
+ continue;
+ }
switch (optarg[i]) {
case ' ':
break;
// be brought as a parameters, e.g. w(0.5)
}
if (gVerboseFlag) {
- if (haveIncoming) { std::cout << "Set up INCOMING Overflow Limiter\n"; }
- if (haveOutgoing) { std::cout << "Set up OUTGOING Overflow Limiter\n"; }
+ if (haveIncoming) {
+ std::cout << "Set up INCOMING Overflow Limiter\n";
+ }
+ if (haveOutgoing) {
+ std::cout << "Set up OUTGOING Overflow Limiter\n";
+ }
if (haveWarnings) {
std::cout << "Enable DISTORTION WARNINGS in Overflow Limiters\n";
}
mClient = jack_client_open("lsp", JackNoStartServer, &mStatus);
if (mClient == NULL) {
if (mStatus & JackServerFailed) {
- cerr << "JACK server not running" << endl;
+ std::cerr << "JACK server not running"
+ << "\n";
} else {
- cerr << "jack_client_open() failed, "
- << "status = 0x%2.0x\n"
- << mStatus << endl;
+ std::cerr << "jack_client_open() failed, "
+ << "status = 0x%2.0x\n"
+ << mStatus << "\n";
}
exit(1);
}
JMess::~JMess()
{
if (jack_client_close(mClient))
- cerr << "ERROR: Could not close the hidden jmess jack client." << endl;
-}
-
-//-------------------------------------------------------------------------------
-/*! \brief Write an XML file with the name specified at xmlOutFile.
- *
- */
-//-------------------------------------------------------------------------------
-void JMess::writeOutput(QString /*xmlOutFile*/)
-{
- // QDomDocument jmess_xml; QDomElement root;
- // QDomElement connection; QDomElement output;
- // QDomElement input; QDomText output_name;
- // QDomText input_name;
-
- // QVector<QString> OutputInput(2);
-
- // this->setConnectedPorts();
-
- // root = jmess_xml.createElement("jmess");
- // for (QVector<QVector<QString> >::iterator it = mConnectedPorts.begin();
- // it != mConnectedPorts.end(); ++it) {
- // OutputInput = *it;
- // //cout << "Output ===> " <<qPrintable(OutputInput[0]) << endl;
- // //cout << "Input ===> " <<qPrintable(OutputInput[1]) << endl;
-
- // //Initialize XML elements
- // connection = jmess_xml.createElement("connection");
- // output = jmess_xml.createElement("output");
- // input = jmess_xml.createElement("input");
- // output_name = jmess_xml.createTextNode(OutputInput[0]);
- // input_name = jmess_xml.createTextNode(OutputInput[1]);
-
- // jmess_xml.appendChild(root); root.appendChild(connection);
- // connection.appendChild(output); connection.appendChild(input);
- // output.appendChild(output_name); input.appendChild(input_name);
- // }
-
- // //Write output file
- // QFile file(xmlOutFile);
- // string answer = "";
- // //Check for existing file first, and confirm before overwriting
- // if (file.exists()) {
- // while ((answer != "yes") && (answer != "no")) {
- // cout << "WARNING: The File " <<qPrintable(xmlOutFile)
- // << " exists. Do you want to overwrite it? (yes/no): ";
- // cin >> answer;
- // }
- // }
- // else {
- // answer = "yes";
- // }
-
- // if (answer == "yes") {
- // if (!file.open(QIODevice::WriteOnly)) {
- // cerr << "Cannot open file for writing: "
- // << qPrintable(file.errorString()) << endl;
- // exit(1);
- // }
-
- // QTextStream out(&file);
- // jmess_xml.save(out, Indent);
- // cout << qPrintable(xmlOutFile) << " written." << endl;
- // }
-}
-
-//-------------------------------------------------------------------------------
-/*! \brief Set list of ouput ports that have connections.
- *
- */
-//-------------------------------------------------------------------------------
-void JMess::setConnectedPorts()
-{
- mConnectedPorts.clear();
-
- const char **ports, **connections; // vector of ports and connections
- QVector<QString> OutputInput(2); // helper variable
-
- // Get active output ports.
- ports = jack_get_ports(mClient, NULL, NULL, JackPortIsOutput);
-
- for (unsigned int out_i = 0; ports[out_i]; ++out_i) {
- if ((connections = jack_port_get_all_connections(
- mClient, jack_port_by_name(mClient, ports[out_i])))
- != 0) {
- for (unsigned int in_i = 0; connections[in_i]; ++in_i) {
- OutputInput[0] = ports[out_i];
- // cout << "Output ===> " <<qPrintable(OutputInput[0]) << endl;
- OutputInput[1] = connections[in_i];
- // cout << "Input ===> " << qPrintable(OutputInput[1]) << endl;
- mConnectedPorts.append(OutputInput);
- }
- }
- }
-
- free(ports);
-}
-//*******************************************************************************
-void JMess::connectSpawnedPorts(int nChans, int hubPatch)
-// called from UdpHubListener::connectMesh
-{
- QMutexLocker locker(&sJMessMutex);
-
- QString IPS[gMAX_WAIRS];
- int ctr = 0;
-
- const char** ports; //, **connections; //vector of ports and connections
-
- // Get active output ports.
- ports = jack_get_ports(mClient, NULL, NULL, JackPortIsOutput);
-
- for (unsigned int out_i = 0; ports[out_i]; ++out_i) {
- // qDebug() << QString(ports[out_i]);
- bool systemPort = QString(ports[out_i]).contains(QString("system"));
-
- QString str = QString(ports[out_i]);
- // for example "171.64.197.121:receive_1"
- QString s = str.section(':', 0, 0);
- // qDebug() << s << systemPort;
- // for example "171.64.197.121"
-
- bool newOne = !systemPort;
- for (int i = 0; i < ctr; i++)
- if (newOne && (IPS[i] == s)) newOne = false;
- if (newOne) {
- IPS[ctr] = s;
- ctr++;
- // qDebug() << ports[out_i] << systemPort << s;
- }
- }
- // for (int i = 0; i<ctr; i++) qDebug() << IPS[i];
- disconnectAll();
-
- int k = 0;
- int jLimit = 1;
-
- // FULLMIX is the union of CLIENTFOFI, CLIENTECHO
-
- // implements CLIENTFOFI, CLIENTECHO -- also FULLMIX part which is CLIENTECHO
- for (int i = 0; i < ctr; i++) {
- if (hubPatch == JackTrip::CLIENTFOFI) jLimit = (ctr - 1);
- for (int j = 0; j < jLimit; j++) {
- if ((hubPatch == JackTrip::CLIENTECHO) || (hubPatch == JackTrip::FULLMIX))
- k = i;
- else if (hubPatch == JackTrip::CLIENTFOFI)
- k = (j + (i + 1)) % ctr;
- for (int l = 1; l <= nChans; l++) { // chans are 1-based
- // qDebug() << "connect " << IPS[i]+":receive_"+QString::number(l)
- //<<"with " << IPS[k]+":send_"+QString::number(l);
-
- QString left = IPS[i] + ":receive_" + QString::number(l);
- QString right = IPS[k] + ":send_" + QString::number(l);
-
- if (0
- != jack_connect(mClient, left.toStdString().c_str(),
- right.toStdString().c_str())) {
- qDebug() << "WARNING: port: " << left << "and port: " << right
- << " could not be connected.";
- }
- }
- }
- }
-
- // do it again to implement the FULLMIX part which is CLIENTFOFI
- if (hubPatch == JackTrip::FULLMIX) {
- jLimit = (ctr - 1); // same as CLIENTFOFI
- /*************/
- // todo: the next block should be in a method, it's a repeat of the above
- for (int i = 0; i < ctr; i++) {
- for (int j = 0; j < jLimit; j++) {
- k = (j + (i + 1)) % ctr;
- for (int l = 1; l <= nChans; l++) { // chans are 1-based
- // qDebug() << "connect " << IPS[i]+":receive_"+QString::number(l)
- //<<"with " << IPS[k]+":send_"+QString::number(l);
-
- QString left = IPS[i] + ":receive_" + QString::number(l);
- QString right = IPS[k] + ":send_" + QString::number(l);
-
- if (0
- != jack_connect(mClient, left.toStdString().c_str(),
- right.toStdString().c_str())) {
- qDebug() << "WARNING: port: " << left << "and port: " << right
- << " could not be connected.";
- }
- }
- }
- }
- }
-
- free(ports);
+ std::cerr << "ERROR: Could not close the hidden jmess jack client."
+ << "\n";
}
//*******************************************************************************
{
// jacktrip to SC
QString client =
- gDOMAIN_TRIPLE + QString(".") + QString::number(gMIN_TUB + i);
- QString serverAudio = QString(HARDWIRED_AUDIO_PROCESS_ON_SERVER);
+ gDOMAIN_TRIPLE + QStringLiteral(".") + QString::number(gMIN_TUB + i);
+ QString serverAudio = QStringLiteral(HARDWIRED_AUDIO_PROCESS_ON_SERVER);
int tmp =
i + l; // only works for mono... completely wrong for 2 or more chans
qDebug() << "connect " << client << ":receive_ " << l << "with "
<< tmp << "with " << client << ":send_" << l;
left = QString(serverAudio + HARDWIRED_AUDIO_PROCESS_ON_SERVER_OUT
- + QString::number(tmp));
+ + QString::number(tmp));
right = QString(client + ":send_" + QString::number(l));
if (0
}
}
}
-
-//-------------------------------------------------------------------------------
-/*! \brief Disconnect all the clients.
- *
- */
-//-------------------------------------------------------------------------------
-void JMess::disconnectAll()
-{
- this->setConnectedPorts();
-
- for (auto& OutputInput : mConnectedPorts) {
- if (jack_disconnect(mClient, OutputInput[0].toUtf8(), OutputInput[1].toUtf8())) {
- cerr << "WARNING: port: " << qPrintable(OutputInput[0])
- << "and port: " << qPrintable(OutputInput[1])
- << " could not be disconnected.\n";
- }
- }
-}
-
-//-------------------------------------------------------------------------------
-/*! \brief Parse the XML input file.
- *
- * Returns 0 on success, or 1 if the file has an incorrect format or cannot
- * read the file.
- */
-//-------------------------------------------------------------------------------
-int JMess::parseXML(QString /*xmlInFile*/)
-{
- // mPortsToConnect.clear();
- // QString errorStr;
- // int errorLine;
- // int errorColumn;
-
- // QFile file(xmlInFile);
- // if (!file.open(QIODevice::ReadOnly)) {
- // cerr << "Cannot open file for reading: "
- // << qPrintable(file.errorString()) << endl;
- // return 1;
- // }
-
- // QDomDocument doc;
- // if (!doc.setContent(&file, true, &errorStr, &errorLine,
- // &errorColumn)) {
- // cerr << "===================================================\n"
- // << "Error parsing XML input file:\n"
- // << "Parse error at line " << errorLine
- // << ", column " << errorColumn << "\n"
- // << qPrintable(errorStr) << "\n"
- // << "===================================================\n";
- // return 1;
- // }
-
- // QDomElement jmess = doc.documentElement();
- // if (jmess.tagName() != "jmess") {
- // cerr << "Error: Root tag should be <jmess>: "
- // << qPrintable(jmess.tagName()) << endl;
- // return 1;
- // }
-
- // QVector<QString> OutputInput(2);
- // //First check for <connection> tag
- // for(QDomNode n_cntn = jmess.firstChild();
- // !n_cntn.isNull(); n_cntn = n_cntn.nextSibling()) {
- // QDomElement cntn = n_cntn.toElement();
- // if (cntn.tagName() == "connection") {
- // //Now check for ouput & input tag
- // for(QDomNode n_sck = cntn.firstChild();
- // !n_sck.isNull(); n_sck = n_sck.nextSibling()) {
- // QDomElement sck = n_sck.toElement();
- // //cout << qPrintable(sck.tagName()) << endl;
- // //cout << qPrintable(sck.text()) << endl;
- // if (sck.tagName() == "output") {
- // OutputInput[0] = sck.text();
- // }
- // else if (sck.tagName() == "input") {
- // OutputInput[1] = sck.text();
- // }
- // }
- // mPortsToConnect.append(OutputInput);
- // }
- // }
-
- return 0;
-}
-
-//-------------------------------------------------------------------------------
-/*! \brief Connect ports specified in input XML file xmlInFile
- *
- */
-//-------------------------------------------------------------------------------
-void JMess::connectPorts(QString /*xmlInFile*/)
-{
- // QVector<QString> OutputInput(2);
-
- // if ( !(this->parseXML(xmlInFile)) ) {
- // for (QVector<QVector<QString> >::iterator it = mPortsToConnect.begin();
- // it != mPortsToConnect.end(); ++it) {
- // OutputInput = *it;
-
- // if (jack_connect(mClient, OutputInput[0].toLatin1(),
- // OutputInput[1].toLatin1())) {
- // //Display a warining only if the error is not because the ports are already
- // //connected, in case the program doesn't display anyting.
- // if (EEXIST !=
- // jack_connect(mClient, OutputInput[0].toLatin1(), OutputInput[1].toLatin1()))
- // {
- // cerr << "WARNING: port: " << qPrintable(OutputInput[0])
- // << "and port: " << qPrintable(OutputInput[1])
- // << " could not be connected.\n";
- // }
- // }
- // }
- // }
-}
#ifndef __JMESS_H
#define __JMESS_H
-#include <QIODevice>
#include <QString>
-#include <QVector>
-#include <cerrno>
-#include <iostream>
-#include <string>
-//#include <QtXml>
-//#include <QXmlSimpleReader>
-//#include <QXmlInputSource>
-//#include <QXmlContentHandler>
#ifdef USE_WEAK_JACK
#include "weak_libjack.h"
#else
#include <QMutexLocker>
-using namespace std;
-
const int Indent = 2;
//-------------------------------------------------------------------------------
JMess();
virtual ~JMess();
- void disconnectAll();
- void writeOutput(QString xmlOutFile);
- void connectPorts(QString xmlInFile);
- void setConnectedPorts();
- /// \brief Cross connect ports between net combs, -l LAIR mode
- void connectSpawnedPorts(int nChans, int hubPatch);
void connectTUB(int nChans);
private:
- int parseXML(QString xmlInFile);
-
jack_client_t* mClient; // Class client
jack_status_t mStatus; // Class client status
- // Vectors of Connected Ports and Ports to connects
- // This are a matrix (Nx2) of string like this:
- // OuputPort1 InputPort1
- // ...
- // OuputPortN InputPortN
- QVector<QVector<QString> > mConnectedPorts;
- QVector<QVector<QString> > mPortsToConnect;
static QMutex sJMessMutex; ///< Mutex to make thread safe jack functions that are not
};
#endif
#ifdef WAIR // wair
int NumNetRevChans,
#endif // endwhere
- AudioInterface::audioBitResolutionT AudioBitResolution, QString ClientName)
+ AudioInterface::audioBitResolutionT AudioBitResolution, const QString& ClientName)
: AudioInterface(jacktrip, NumInChans, NumOutChans,
#ifdef WAIR // wair
NumNetRevChans,
if (clientName.length() > maxSize) {
int length = maxSize;
// Make sure we don't cut mid multi-byte character.
- while ((length > 0) && ((clientName.at(length) & 0xc0) == 0x80)) { length--; }
+ while ((length > 0) && ((clientName.at(length) & 0xc0) == 0x80)) {
+ length--;
+ }
clientName.truncate(length);
}
}
mAssignedClientName = jack_get_client_name(mClient);
- if (status & JackServerStarted) { fprintf(stderr, "JACK server started\n"); }
+ if (status & JackServerStarted) {
+ fprintf(stderr, "JACK server started\n");
+ }
if (status & JackNameNotUnique) {
fprintf(stderr, "unique name `%s' assigned\n",
mAssignedClientName.toUtf8().constData());
int NumNetRevChans,
#endif // endwhere
AudioInterface::audioBitResolutionT AudioBitResolution = AudioInterface::BIT16,
- QString ClientName = "JackTrip");
+ const QString& ClientName = QStringLiteral("JackTrip"));
/// \brief The class destructor
virtual ~JackAudioInterface();
//--------------SETTERS---------------------------------------------
/// \brief Set Client Name to something different that the default (JackTrip)
- virtual void setClientName(QString ClientName) { mClientName = ClientName; }
+ virtual void setClientName(const QString& ClientName) { mClientName = ClientName; }
virtual void setSampleRate(uint32_t /*sample_rate*/)
{
std::cout << "WARNING: Setting the Sample Rate in Jack mode has no effect."
#include "JackTrip.h"
-#ifndef __NO_JACK__
+#ifndef NO_JACK
#include "JackAudioInterface.h"
#endif
#include "Auth.h"
#include "RingBufferWavetable.h"
#include "UdpDataProtocol.h"
#include "jacktrip_globals.h"
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
#include "RtAudioInterface.h"
#endif
// the following function has to remain outside the Jacktrip class definition
// its purpose is to close the app when control c is hit by the user in rtaudio/asio4all
// mode
-/*if defined __WIN_32__
+/*if defined _WIN32
void sigint_handler(int sig)
{
exit(0);
DataProtocol::packetHeaderTypeT PacketHeaderType,
underrunModeT UnderRunMode, int receiver_bind_port,
int sender_bind_port, int receiver_peer_port, int sender_peer_port,
- int tcp_peer_port)
- : mJackTripMode(JacktripMode)
+ int tcp_peer_port, QObject* parent)
+ : QObject(parent)
+ , mJackTripMode(JacktripMode)
, mDataProtocol(DataProtocolType)
, mPacketHeaderType(PacketHeaderType)
, mAudiointerfaceMode(JackTrip::JACK)
// Create AudioInterface Client Object
if (mAudiointerfaceMode == JackTrip::JACK) {
-#ifndef __NO_JACK__
+#ifndef NO_JACK
if (gVerboseFlag)
std::cout << " JackTrip:setupAudio before new JackAudioInterface"
<< std::endl;
// Set our Jack client name if we're a hub server or a custom name hasn't been set
if (mJackClientName.isEmpty()) {
if (!mPeerAddress.isEmpty()) {
- mJackClientName = QString(mPeerAddress).replace(":", "_");
+ mJackClientName =
+ QString(mPeerAddress).replace(QLatin1String(":"), QLatin1String("_"));
} else {
mJackClientName = gJackDefaultClientName;
}
#endif // endwhere
mAudioInterface->setClientName(mJackClientName);
- if (0 < mBroadcastQueueLength) { mAudioInterface->enableBroadcastOutput(); }
+ if (0 < mBroadcastQueueLength) {
+ mAudioInterface->enableBroadcastOutput();
+ }
if (gVerboseFlag)
std::cout << " JackTrip:setupAudio before mAudioInterface->setup"
<< " JackTrip:setupAudio before mAudioInterface->getBufferSizeInSamples"
<< std::endl;
mAudioBufferSize = mAudioInterface->getBufferSizeInSamples();
-#endif //__NON_JACK__
-#ifdef __NO_JACK__ /// \todo FIX THIS REPETITION OF CODE
-#ifdef __RT_AUDIO__
+#endif //__NON_JACK__
+#ifdef NO_JACK /// \todo FIX THIS REPETITION OF CODE
+#ifdef RT_AUDIO
cout << "Warning: using non jack version, RtAudio will be used instead" << endl;
mAudioInterface = new RtAudioInterface(this, mNumAudioChansIn, mNumAudioChansOut,
mAudioBitResolution);
#endif
#endif
} else if (mAudiointerfaceMode == JackTrip::RTAUDIO) {
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
mAudioInterface = new RtAudioInterface(this, mNumAudioChansIn, mNumAudioChansOut,
mAudioBitResolution);
mAudioInterface->setSampleRate(mSampleRate);
}
mAudioInterface->setLoopBack(mLoopBack);
- if (!mAudioTesterP
- .isNull()) { // if we're a hub server, this will be a nullptr - MAJOR
- // REFACTOR NEEDED, in my opinion
+ if (!mAudioTesterP.isNull()) { // if we're a hub server, this will be a nullptr -
+ // MAJOR REFACTOR NEEDED, in my opinion
mAudioTesterP->setSampleRate(mSampleRate);
}
mAudioInterface->setAudioTesterP(mAudioTesterP.data());
}
//*******************************************************************************
-void JackTrip::setPeerAddress(QString PeerHostOrIP) { mPeerAddress = PeerHostOrIP; }
+void JackTrip::setPeerAddress(const QString& PeerHostOrIP)
+{
+ mPeerAddress = PeerHostOrIP;
+}
//*******************************************************************************
void JackTrip::appendProcessPluginToNetwork(ProcessPlugin* plugin)
#endif // endwhere
)
{ // signal that catches ctrl c in rtaudio-asio mode
- /*#if defined (__WIN_32__)
+ /*#if defined (_WIN32)
if (signal(SIGINT, sigint_handler) == SIG_ERR) {
perror("signal");
exit(1);
#endif*/
// Check if ports are already binded by another process on this machine
// ------------------------------------------------------------------
- if (gVerboseFlag) std::cout << "step 1" << std::endl;
+ if (gVerboseFlag)
+ std::cout << "step 1" << std::endl;
if (gVerboseFlag)
std::cout
<< " JackTrip:startProcess before checkIfPortIsBinded(mReceiverBindPort)"
<< std::endl;
-#if defined __WIN_32__
+#if defined _WIN32
// cc fixed windows crash with this print statement!
// qDebug() << "before mJackTrip->startProcess" << mReceiverBindPort<<
// mSenderBindPort;
// -------------------------
QObject::connect(mPacketHeader, &PacketHeader::signalError, this,
&JackTrip::slotStopProcessesDueToError, Qt::QueuedConnection);
- QObject::connect(mDataProtocolReceiver, SIGNAL(signalReceivedConnectionFromPeer()),
- this, SLOT(slotReceivedConnectionFromPeer()), Qt::QueuedConnection);
+ QObject::connect(mDataProtocolReceiver,
+ &DataProtocol::signalReceivedConnectionFromPeer, this,
+ &JackTrip::slotReceivedConnectionFromPeer, Qt::QueuedConnection);
// QObject::connect(this, SIGNAL(signalUdpTimeOut()),
// this, SLOT(slotStopProcesses()), Qt::QueuedConnection);
QObject::connect(static_cast<UdpDataProtocol*>(mDataProtocolReceiver),
// ---------------------------------------
switch (mJackTripMode) {
case CLIENT:
- if (gVerboseFlag) std::cout << "step 2c client only" << std::endl;
+ if (gVerboseFlag)
+ std::cout << "step 2c client only" << std::endl;
if (gVerboseFlag)
std::cout << " JackTrip:startProcess case CLIENT before clientStart"
<< std::endl;
clientStart();
break;
case SERVER:
- if (gVerboseFlag) std::cout << "step 2s server only" << std::endl;
+ if (gVerboseFlag)
+ std::cout << "step 2s server only" << std::endl;
if (gVerboseFlag)
std::cout << " JackTrip:startProcess case SERVER before serverStart"
<< std::endl;
serverStart();
break;
case CLIENTTOPINGSERVER:
- if (gVerboseFlag) std::cout << "step 2C client only" << std::endl;
+ if (gVerboseFlag)
+ std::cout << "step 2C client only" << std::endl;
if (gVerboseFlag)
std::cout << " JackTrip:startProcess case CLIENTTOPINGSERVER before "
"clientPingToServerStart"
<< std::endl;
if (clientPingToServerStart()
== -1) { // if error on server start (-1) we return inmediatly
- stop("Peer Address has to be set if you run in CLIENTTOPINGSERVER mode");
+ stop(QStringLiteral(
+ "Peer Address has to be set if you run in CLIENTTOPINGSERVER mode"));
return;
}
break;
case SERVERPINGSERVER:
- if (gVerboseFlag) std::cout << "step 2S server only (same as 2s)" << std::endl;
+ if (gVerboseFlag)
+ std::cout << "step 2S server only (same as 2s)" << std::endl;
if (gVerboseFlag)
std::cout
<< " JackTrip:startProcess case SERVERPINGSERVER before serverStart"
void JackTrip::completeConnection()
{
// Have the threads share a single socket that operates at full duplex.
-#if defined(__WIN_32__)
+#if defined(_WIN32)
SOCKET sock_fd = INVALID_SOCKET;
#else
int sock_fd = -1;
* system call new QThread::msleep(1); to allow sender to start
*/
QThread::msleep(1);
- if (gVerboseFlag) std::cout << "step 5" << std::endl;
+ if (gVerboseFlag)
+ std::cout << "step 5" << std::endl;
if (gVerboseFlag)
std::cout << " JackTrip:startProcess before mAudioInterface->startProcess"
<< std::endl;
mAudioInterface->initPlugins(); // mSampleRate known now, which plugins require
mAudioInterface->startProcess(); // Tell JACK server we are ready for audio flow now
- if (mConnectDefaultAudioPorts) { mAudioInterface->connectDefaultPorts(); }
+ if (mConnectDefaultAudioPorts) {
+ mAudioInterface->connectDefaultPorts();
+ }
emit signalAudioStarted();
// Start our IO stat timer
mIOStatLogStream.rdbuf((mIOStatStream.data()->rdbuf()));
}
QTimer* timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(onStatTimer()));
+ connect(timer, &QTimer::timeout, this, &JackTrip::onStatTimer);
timer->start(mIOStatTimeout * 1000);
}
}
void JackTrip::onStatTimer()
{
DataProtocol::PktStat pkt_stat;
- if (!mDataProtocolReceiver->getStats(&pkt_stat)) { return; }
+ if (!mDataProtocolReceiver->getStats(&pkt_stat)) {
+ return;
+ }
bool reset = (0 == pkt_stat.statCount);
RingBuffer::IOStat recv_io_stat;
- if (!mReceiveRingBuffer->getStats(&recv_io_stat, reset)) { return; }
+ if (!mReceiveRingBuffer->getStats(&recv_io_stat, reset)) {
+ return;
+ }
RingBuffer::IOStat send_io_stat;
- if (!mSendRingBuffer->getStats(&send_io_stat, reset)) { return; }
+ if (!mSendRingBuffer->getStats(&send_io_stat, reset)) {
+ return;
+ }
QString now = QDateTime::currentDateTime().toString(Qt::ISODate);
static QMutex mutex;
{
{
QMutexLocker lock(&mTimerMutex);
- if (!mAwaitingTcp) { return; }
+ if (!mAwaitingTcp) {
+ return;
+ }
mAwaitingTcp = false;
mTimeoutTimer.stop();
}
- if (gVerboseFlag) cout << "TCP Socket Connected to Server!" << endl;
+ if (gVerboseFlag)
+ cout << "TCP Socket Connected to Server!" << endl;
emit signalTcpClientConnected();
// If we're planning to authenticate, signal the server.
char port_buf[sizeof(qint32)];
qToLittleEndian<qint32>(Auth::OK, port_buf);
mTcpClient.write(port_buf, sizeof(port_buf));
- if (gVerboseFlag) cout << "Auth request sent to Server" << endl;
+ if (gVerboseFlag)
+ cout << "Auth request sent to Server" << endl;
return;
}
// Send Client Port Number to Server
/*while ( mTcpClient.bytesToWrite() > 0 ) {
mTcpClient.waitForBytesWritten(-1);
}*/
- if (gVerboseFlag) cout << "Port " << mReceiverBindPort << " sent to Server" << endl;
+ if (gVerboseFlag)
+ cout << "Port " << mReceiverBindPort << " sent to Server" << endl;
// Continued in receivedDataTCP slot
}
if (authResponse == Auth::NOTREQUIRED) {
std::cout << "ERROR: The Server does not require authentication."
<< std::endl;
- stop("The server does not require authentication");
+ stop(QStringLiteral("The server does not require authentication"));
} else {
std::cout << "ERROR: The Server does not support authentication."
<< std::endl;
- stop("The server does not support authentication");
+ stop(QStringLiteral("The server does not support authentication"));
// Send a header sized packet to the server so we don't lock up the
// main/UdpHubListener thread on the server. (Prevents a denial of
// service.) TODO: This should ultimately be fixed server side, but work
return;
}
- if (mTcpClient.bytesAvailable() < (int)sizeof(qint32)) { return; }
+ if (mTcpClient.bytesAvailable() < (int)sizeof(qint32)) {
+ return;
+ }
// Read the size of the package
// ----------------------------
- if (gVerboseFlag) cout << "Reading UDP port from Server..." << endl;
- if (gVerboseFlag) cout << "Ready To Read From Socket!" << endl;
+ if (gVerboseFlag)
+ cout << "Reading UDP port from Server..." << endl;
+ if (gVerboseFlag)
+ cout << "Ready To Read From Socket!" << endl;
// Read UDP Port Number from Server
// --------------------------------
if (mUseAuth && udp_port > 65535) {
QString error_message;
if (udp_port == Auth::WRONGCREDS) {
- error_message = "Incorrect username or password.";
+ error_message = QStringLiteral("Incorrect username or password.");
} else if (udp_port == Auth::WRONGTIME) {
- error_message = "You are not authorized to access the server at this time.";
+ error_message = QStringLiteral(
+ "You are not authorized to access the server at this time.");
} else {
- error_message = "Unknown authentication error.";
+ error_message = QStringLiteral("Unknown authentication error.");
}
std::cout << "ERROR: " << error_message.toStdString() << std::endl;
stop(error_message);
} else if (udp_port > 65535) {
QString error_message;
if (udp_port == Auth::REQUIRED) {
- error_message =
- "The server you are attempting to connect to requires authentication.";
+ error_message = QStringLiteral(
+ "The server you are attempting to connect to requires authentication.");
} else {
- error_message = "Unknown authentication error.";
+ error_message = QStringLiteral("Unknown authentication error.");
}
std::cout << "ERROR: " << error_message.toStdString() << std::endl;
stop(error_message);
return;
}
- if (gVerboseFlag) cout << "Connection Succesfull!" << endl;
+ if (gVerboseFlag)
+ cout << "Connection Succesfull!" << endl;
// Set with the received UDP port
// ------------------------------
// Stop our timer.
{
QMutexLocker lock(&mTimerMutex);
- if (!mAwaitingUdp) { return; }
+ if (!mAwaitingUdp) {
+ return;
+ }
mAwaitingUdp = false;
mTimeoutTimer.stop();
}
void JackTrip::udpTimerTick()
{
QMutexLocker lock(&mTimerMutex);
- if (!mAwaitingUdp) { return; }
+ if (!mAwaitingUdp) {
+ return;
+ }
if (mStopped || sSigInt || sJackStopped) {
// Stop everything.
stop();
}
- if (gVerboseFlag) std::cout << mSleepTime << "ms " << std::flush;
+ if (gVerboseFlag)
+ std::cout << mSleepTime << "ms " << std::flush;
mElapsedTime += mSleepTime;
if (mEndTime > 0 && mElapsedTime >= mEndTime) {
mAwaitingUdp = false;
mUdpSockTemp.close();
mTimeoutTimer.stop();
cout << "JackTrip Server Timed Out!" << endl;
- stop("JackTrip Server Timed Out");
+ stop(QStringLiteral("JackTrip Server Timed Out"));
}
}
void JackTrip::tcpTimerTick()
{
QMutexLocker lock(&mTimerMutex);
- if (!mAwaitingTcp) { return; }
+ if (!mAwaitingTcp) {
+ return;
+ }
if (mStopped || sSigInt || sJackStopped) {
// Stop everything.
mTcpClient.close();
mTimeoutTimer.stop();
cout << "JackTrip Server Timed Out!" << endl;
- stop("Initial TCP Connection Timed Out");
+ stop(QStringLiteral("Initial TCP Connection Timed Out"));
}
}
//*******************************************************************************
-void JackTrip::stop(QString errorMessage)
+void JackTrip::stop(const QString& errorMessage)
{
mStopped = true;
// Make sure we're only run once
- if (mHasShutdown) { return; }
+ if (mHasShutdown) {
+ return;
+ }
mHasShutdown = true;
std::cout << "Stopping JackTrip..." << std::endl;
// Emit the jack stopped signal
if (sJackStopped) {
- emit signalError("The Jack Server was shut down!");
+ emit signalError(QStringLiteral("The Jack Server was shut down!"));
} else if (errorMessage.isEmpty()) {
emit signalProcessesStopped();
} else {
QMutexLocker lock(&mTimerMutex);
mAwaitingUdp = true;
mElapsedTime = 0;
- if (timeout) { mEndTime = udpTimeout; }
+ if (timeout) {
+ mEndTime = udpTimeout;
+ }
mTimeoutTimer.setInterval(mSleepTime);
connect(&mTimeoutTimer, &QTimer::timeout, this, &JackTrip::udpTimerTick);
mTimeoutTimer.start();
QHostInfo info = QHostInfo::fromName(mPeerAddress);
if (!info.addresses().isEmpty()) {
// use the first IP address
- serverHostAddress = info.addresses().first();
+ serverHostAddress = info.addresses().constFirst();
}
}
// Set socket to be reusable, this is platform dependent
int one = 1;
-#if defined ( __LINUX__ )
+#if defined ( __linux__ )
::setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
#endif
-#if defined ( __MAC_OSX__ )
+#if defined ( __APPLE__ )
// This option is not avialable on Linux, and without it MAC OS X
// has problems rebinding a socket
::setsockopt(sock_fd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one));
#include "AudioInterface.h"
#include "DataProtocol.h"
-#ifndef __NO_JACK__
+#ifndef NO_JACK
#include "JackAudioInterface.h"
-#endif //__NO_JACK__
+#endif // NO_JACK
#include "AudioTester.h"
#include "PacketHeader.h"
RESERVEDMATRIX, ///< Reserved for custom patch matrix (for TUB ensemble)
FULLMIX, ///< Client Fan Out to Clients and Fan In from Clients (including
///< self-to-self)
- NOAUTO ///< No automatic patching
+ NOAUTO, ///< No automatic patching
+ SERVFOFI, ///< Like CLIENTFOFI, but include the server in the mix
+ SERVFULLMIX ///< Like FULLMIX, but include the server in the mix
};
//---------------------------------------------------------
DataProtocol::packetHeaderTypeT PacketHeaderType = DataProtocol::DEFAULT,
underrunModeT UnderRunMode = WAVETABLE, int receiver_bind_port = gDefaultPort,
int sender_bind_port = gDefaultPort, int receiver_peer_port = gDefaultPort,
- int sender_peer_port = gDefaultPort, int tcp_peer_port = gDefaultPort);
+ int sender_peer_port = gDefaultPort, int tcp_peer_port = gDefaultPort,
+ QObject* parent = nullptr);
/// \brief The class destructor
virtual ~JackTrip();
}*/
/// \brief Set the Peer Address for jacktripModeT::CLIENT mode only
- virtual void setPeerAddress(QString PeerHostOrIP);
+ virtual void setPeerAddress(const QString& PeerHostOrIP);
/** \brief Append a process plugin. Processes will be appended in order
* \param plugin Pointer to ProcessPlugin Class
virtual void completeConnection();
/// \brief Stop the processing threads
- virtual void stop(QString errorMessage = "");
+ virtual void stop(const QString& errorMessage = QLatin1String(""));
/// \brief Wait for all the threads to finish. This functions is used when JackTrip is
/// run as a thread
}
void setPeerHandshakePort(int port) { mTcpServerPort = port; }
void setUseAuth(bool auth) { mUseAuth = auth; }
- void setUsername(QString username) { mUsername = username; }
- void setPassword(QString password) { mPassword = password; }
+ void setUsername(const QString& username) { mUsername = username; }
+ void setPassword(const QString& password) { mPassword = password; }
/// \brief Set Client Name to something different that the default (JackTrip)
- virtual void setClientName(QString clientName) { mJackClientName = clientName; }
- virtual void setRemoteClientName(QString remoteClientName)
+ virtual void setClientName(const QString& clientName)
+ {
+ mJackClientName = clientName;
+ }
+ virtual void setRemoteClientName(const QString& remoteClientName)
{
mRemoteClientName = remoteClientName;
}
{
return mNumAudioChansOut; /*return mAudioInterface->getNumOutputChannels();*/
}
-#ifndef __NO_JACK__
+#ifndef NO_JACK
QString getAssignedClientName()
{
if (mAudioInterface && mAudiointerfaceMode == JackTrip::JACK) {
return static_cast<JackAudioInterface*>(mAudioInterface)
->getAssignedClientName();
} else {
- return "";
+ return QLatin1String("");
}
}
#endif
int wait_time = 10000; // msec
if (!(wait_msec % wait_time)) {
std::cerr << "UDP WAITED MORE THAN 10 seconds." << std::endl;
- if (mStopOnTimeout) { stop("No network data received for 10 seconds"); }
+ if (mStopOnTimeout) {
+ stop(QStringLiteral("No network data received for 10 seconds"));
+ }
emit signalNoUdpPacketsForSeconds();
}
}
//*******************************************************************************
JackTripWorker::JackTripWorker(UdpHubListener* udphublistener, int BufferQueueLength,
- JackTrip::underrunModeT UnderRunMode, QString clientName)
+ JackTrip::underrunModeT UnderRunMode,
+ const QString& clientName)
: mAppendThreadID(false)
, mSleepTime(100)
, mUdpHubListener(udphublistener)
}
//*******************************************************************************
-void JackTripWorker::setJackTrip(int id, QString client_address, uint16_t server_port,
- uint16_t client_port, bool connectDefaultAudioPorts)
+void JackTripWorker::setJackTrip(int id, const QString& client_address,
+ uint16_t server_port, uint16_t client_port,
+ bool connectDefaultAudioPorts)
{
QMutexLocker locker(&mMutex);
mUdpSockTemp.close();
if (mRunning) {
mJackTrip->slotStopProcesses();
-#ifndef __NO_JACK__
+#ifndef NO_JACK
if (mPatched) {
mUdpHubListener->unregisterClientWithPatcher(mAssignedClientName);
mPatched = false;
mServerPort = server_port;
mClientPort = client_port;
m_connectDefaultAudioPorts = connectDefaultAudioPorts;
- mAssignedClientName = "";
+ mAssignedClientName = QLatin1String("");
// Create and setup JackTrip Object
// JackTrip jacktrip(JackTrip::SERVER, JackTrip::UDP, mNumChans, 2);
- if (gVerboseFlag) cout << "---> JackTripWorker: Creating jacktrip objects..." << endl;
+ if (gVerboseFlag)
+ cout << "---> JackTripWorker: Creating jacktrip objects..." << endl;
#ifdef WAIR // WAIR
// forces BufferQueueLength to 2
mJackTrip->setIOStatStream(mIOStatStream);
}
- if (!mClientName.isEmpty()) { mJackTrip->setClientName(mClientName); }
+ if (!mClientName.isEmpty()) {
+ mJackTrip->setClientName(mClientName);
+ }
// ClientAddress.setAddress(mClientAddress);
// If I don't type this line, I get a bus error in the next line.
// I still haven't figure out why
// ClientAddress.toString().toLatin1().constData();
// jacktrip.setPeerAddress(ClientAddress.toString().toLatin1().constData());
- if (mAppendThreadID) { mJackTrip->setID(mID + 1); }
+ if (mAppendThreadID) {
+ mJackTrip->setID(mID + 1);
+ }
mJackTrip->setPeerAddress(mClientAddress);
mJackTrip->setBindPorts(mServerPort);
// jacktrip.setPeerPorts(mClientPort);
if (mRunning) {
mRunning = false;
mJackTrip->slotStopProcesses();
-#ifndef __NO_JACK__
+#ifndef NO_JACK
if (mPatched) {
mUdpHubListener->unregisterClientWithPatcher(mAssignedClientName);
mPatched = false;
&JackTripWorker::jacktripStopped, Qt::QueuedConnection);
connect(mJackTrip.data(), &JackTrip::signalError, this,
&JackTripWorker::jacktripStopped, Qt::QueuedConnection);
-#ifndef __NO_JACK__
+#ifndef NO_JACK
connect(mJackTrip.data(), &JackTrip::signalAudioStarted, this,
&JackTripWorker::alertPatcher, Qt::QueuedConnection);
#endif
connect(this, &JackTripWorker::signalRemoveThread, mJackTrip.data(),
&JackTrip::slotStopProcesses, Qt::QueuedConnection);
- if (gVerboseFlag) cout << "---> JackTripWorker: startProcess..." << endl;
+ if (gVerboseFlag)
+ cout << "---> JackTripWorker: startProcess..." << endl;
mJackTrip->startProcess(
#ifdef WAIRTOHUB // wair
mID
return;
}
mElapsedTime += mSleepTime;
- if (gVerboseFlag) cout << "---------> ELAPSED TIME: " << mElapsedTime << endl;
+ if (gVerboseFlag)
+ cout << "---------> ELAPSED TIME: " << mElapsedTime << endl;
// Check if we've timed out.
if (gTimeOutMultiThreadedServer > 0 && mElapsedTime >= gTimeOutMultiThreadedServer) {
std::cerr << "--->JackTripWorker: is not receiving Datagrams (timeout)" << endl;
return;
}
mRunning = false;
-#ifndef __NO_JACK__
+#ifndef NO_JACK
if (mPatched) {
mUdpHubListener->unregisterClientWithPatcher(mAssignedClientName);
mPatched = false;
void JackTripWorker::alertPatcher()
{
-#ifndef __NO_JACK__
+#ifndef NO_JACK
QMutexLocker lock(&mMutex);
if (mRunning) {
mAssignedClientName = mJackTrip->getAssignedClientName();
JackTripWorker(UdpHubListener* udphublistener,
int BufferQueueLength = gDefaultQueueLength,
JackTrip::underrunModeT UnderRunMode = JackTrip::WAVETABLE,
- QString clientName = "");
+ const QString& clientName = QLatin1String(""));
/// \brief The class destructor
~JackTripWorker() = default;
/// \brief Sets the JackTripWorker properties
/// \param id ID number
/// \param address
- void setJackTrip(int id, QString client_address, uint16_t server_port,
+ void setJackTrip(int id, const QString& client_address, uint16_t server_port,
uint16_t client_port, bool connectDefaultAudioPorts);
/// Stop thread
void stopThread();
//*******************************************************************************
bool JitterBuffer::insertSlotNonBlocking(const int8_t* ptrToSlot, int len, int lostLen)
{
- if (0 == len) { len = mSlotSize; }
+ if (0 == len) {
+ len = mSlotSize;
+ }
QMutexLocker locker(&mMutex);
mInSlotSize = len;
- if (!mActive) { mActive = true; }
- if (mMaxLatency < len + mSlotSize) { mMaxLatency = len + mSlotSize; }
- if (0 < lostLen) { processPacketLoss(lostLen); }
+ if (!mActive) {
+ mActive = true;
+ }
+ if (mMaxLatency < len + mSlotSize) {
+ mMaxLatency = len + mSlotSize;
+ }
+ if (0 < lostLen) {
+ processPacketLoss(lostLen);
+ }
mSkewRaw += mReadsNew - len;
mReadsNew = 0;
mUnderruns += mUnderrunsNew;
} else if (mInSlotSize + mSlotSize < mAutoQueueCorr) {
mAutoQueueCorr -= mAutoQRate * mAutoQFactor;
}
- if (mAutoQRate > mAutoQRateMin) { mAutoQRate *= mAutoQRateDecay; }
+ if (mAutoQRate > mAutoQRateMin) {
+ mAutoQRate *= mAutoQRateDecay;
+ }
if (0 != mAutoQueue) {
int PPS = mSampleRate / mFPP;
if (2 * PPS == mAutoQueue++ % (4 * PPS)) {
// cout << "split read: " << read_len << "-" << n << endl;
std::memcpy(ptrToReadSlot + n, mRingBuffer, read_len - n);
}
- if (read_len < len) { std::memset(ptrToReadSlot + read_len, 0, len - read_len); }
+ if (read_len < len) {
+ std::memset(ptrToReadSlot + read_len, 0, len - read_len);
+ }
} else {
// interpolation len => mSlotSize
double K = 1.0 * len / mSlotSize;
#include "PacketHeader.h"
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
#include <sys/time.h>
#endif
// below is the gettimeofday definition for windows: this function is not defined in
// sys/time.h as it is in unix for more info check:
// http://www.halcode.com/archives/2008/08/26/retrieving-system-time-gettimeofday/
-#if defined __WIN_32__
+#if defined _WIN32
#ifdef __cplusplus
// void GetSystemTimeAsFileTime(FILETIME*);
-inline int gettimeofday(struct timeval* p, void* tz /* IGNORED */)
+inline int gettimeofday(struct timeval* p, [[maybe_unused]] void* tz)
{
union {
long long ns100; /*time since 1 Jan 1601 in 100ns units */
std::cerr << "Make sure both machines use same buffer size" << endl;
std::cerr << gPrintSeparator << endl;
error = true;
- report.append(QString("\n\nPeer Buffer Size is %1\nLocal Buffer Size is "
- "%2\nMake sure both machines use the same Buffer Size")
- .arg(peer_header->BufferSize)
- .arg(mHeader.BufferSize));
+ report.append(
+ QStringLiteral("\n\nPeer Buffer Size is %1\nLocal Buffer Size is "
+ "%2\nMake sure both machines use the same Buffer Size")
+ .arg(peer_header->BufferSize)
+ .arg(mHeader.BufferSize));
} else {
std::cerr << "WARNING: Peer Buffer Size is : " << peer_header->BufferSize
<< endl;
std::cerr << "Make sure both machines use the same Sampling Rate" << endl;
std::cerr << gPrintSeparator << endl;
error = true;
- report.append(QString("\n\nPeer Sampling Rate is %1\nLocal Sampling Rate is "
- "%2\nMake sure both machines use the same Sampling Rate")
- .arg(peerRate)
- .arg(localRate));
+ report.append(
+ QStringLiteral("\n\nPeer Sampling Rate is %1\nLocal Sampling Rate is "
+ "%2\nMake sure both machines use the same Sampling Rate")
+ .arg(peerRate)
+ .arg(localRate));
}
// Check Audio Bit Resolution
std::cerr << gPrintSeparator << endl;
error = true;
report.append(
- QString("\n\nPeer Audio Bit Resolution is %1\nLocal Audio Bit Resolution is "
- "%2\nMake sure both machines use the same Bit Resolution")
+ QStringLiteral(
+ "\n\nPeer Audio Bit Resolution is %1\nLocal Audio Bit Resolution is "
+ "%2\nMake sure both machines use the same Bit Resolution")
.arg(peer_header->BitResolution)
.arg(mHeader.BitResolution));
}
// std::cerr << "Exiting program..." << endl;
// std::exit(1);
// throw std::logic_error("Local and Peer Settings don't match");
- emit signalError(QString("Local and Peer Settings don't match").append(report));
+ emit signalError(
+ QStringLiteral("Local and Peer Settings don't match").append(report));
}
return !error;
// std::cerr << "WARINING: JamLink only support ONE channel. Run JackTrip using
// only one channel" << endl; throw std::logic_error("JamLink only support ONE
// channel. Run JackTrip using only one channel");
- emit signalError(
- "JamLink only supports ONE channel. Run JackTrip using only one channel");
+ emit signalError(QStringLiteral(
+ "JamLink only supports ONE channel. Run JackTrip using only one channel"));
}
// Sampling Rate
// JackTrip at the moment." << endl; throw std::logic_error("ERROR: JamLink only
// support 48kHz for communication with JackTrip at the moment.");
emit signalError(
- "JamLink only supports 48kHz for communication with JackTrip at the moment.");
+ QStringLiteral("JamLink only supports 48kHz for communication with JackTrip "
+ "at the moment."));
}
// Check Buffer Size
// std::cerr << "WARINING: JamLink only support 64 buffer size for communication
// with JackTrip at the moment." << endl; throw std::logic_error("ERROR: JamLink
// only support 64 buffer size for communication with JackTrip at the moment.");
- emit signalError(
+ emit signalError(QStringLiteral(
"JamLink only supports a buffer size of 64 for communication with JackTrip "
- "at the moment.");
+ "at the moment."));
}
mHeader.Common = (ETX_MONO | ETX_16BIT | ETX_XTND) + 64;
// std::cerr << "ERROR: Sample rate not supported by JamLink" << endl;
// std::exit(1);
// throw std::out_of_range("Sample rate not supported by JamLink");
- emit signalError("Sample rate not supported by JamLink.");
+ emit signalError(QStringLiteral("Sample rate not supported by JamLink."));
break;
}
}
*/
class PacketHeader : public QObject
{
- Q_OBJECT;
+ Q_OBJECT
public:
/// \brief The class Constructor
*/
class DefaultHeader : public PacketHeader
{
+ Q_OBJECT
+
public:
DefaultHeader(JackTrip* jacktrip);
virtual ~DefaultHeader() {}
*/
class JamLinkHeader : public PacketHeader
{
+ Q_OBJECT
+
public:
JamLinkHeader(JackTrip* jacktrip);
virtual ~JamLinkHeader() {}
*/
class EmptyHeader : public PacketHeader
{
+ Q_OBJECT
+
public:
EmptyHeader(JackTrip* jacktrip);
virtual ~EmptyHeader() {}
*/
#include "Patcher.h"
+
#include <QVector>
void Patcher::setPatchMode(JackTrip::hubConnectionModeT patchMode)
{
- m_patchMode = patchMode;
+ QMutexLocker locker(&m_connectionMutex);
+ m_fan = patchMode == JackTrip::CLIENTFOFI || patchMode == JackTrip::FULLMIX
+ || patchMode == JackTrip::SERVFOFI || patchMode == JackTrip::SERVFULLMIX;
+ m_loop = patchMode == JackTrip::CLIENTECHO || patchMode == JackTrip::FULLMIX
+ || patchMode == JackTrip::SERVFULLMIX;
+ m_includeServer = patchMode == JackTrip::SERVERTOCLIENT
+ || patchMode == JackTrip::SERVFOFI
+ || patchMode == JackTrip::SERVFULLMIX;
}
void Patcher::setStereoUpmix(bool upmix)
{
QMutexLocker locker(&m_connectionMutex);
- if (!(m_patchMode == JackTrip::CLIENTECHO || m_patchMode == JackTrip::CLIENTFOFI
- || m_patchMode == JackTrip::FULLMIX)) {
- // Nothing to do here other than track our clients.
- m_clients.append(clientName);
- return;
- }
-
// If our jack client isn't running, start it.
if (!m_jackClient) {
m_jackClient = jack_client_open("jthubpatcher", JackNoStartServer, &m_status);
// Find the ports belonging to our client.
QVector<const char*> clientOutPorts;
QVector<const char*> clientInPorts;
-
+
for (int i = 0; outPorts[i]; i++) {
// Exclude broadcast ports.
- if (QString(outPorts[i]).section(":", 0, 0) == clientName
- && !QString(outPorts[i]).contains("broadcast")) {
+ if (QString(outPorts[i]).section(QStringLiteral(":"), 0, 0) == clientName
+ && !QString(outPorts[i]).contains(QLatin1String("broadcast"))) {
clientOutPorts.append(outPorts[i]);
}
}
for (int i = 0; inPorts[i]; i++) {
- if (QString(inPorts[i]).section(":", 0, 0) == clientName) {
+ if (QString(inPorts[i]).section(QStringLiteral(":"), 0, 0) == clientName) {
clientInPorts.append(inPorts[i]);
}
}
bool clientIsMono = (clientOutPorts.count() == 1);
- // Start with our receiving ports.
- for (int i = 0; i < clientOutPorts.count(); i++) {
- QString channel = QString(clientOutPorts.at(i)).section("_", -1, -1);
- for (int j = 0; inPorts[j]; j++) {
- QString otherClient = QString(inPorts[j]).section(":", 0, 0);
- QString otherChannel = QString(inPorts[j]).section("_", -1, -1);
-
- // First check if this is one of our other clients. (Fan out/in and full mix.)
- if (m_patchMode == JackTrip::CLIENTFOFI || m_patchMode == JackTrip::FULLMIX) {
- if (m_clients.contains(otherClient) && otherChannel == channel) {
- jack_connect(m_jackClient, clientOutPorts.at(i), inPorts[j]);
- } else if (m_steroUpmix && clientIsMono) {
- // Deal with the special case of stereo upmix
- if (m_clients.contains(otherClient) && otherChannel == "2") {
+ if (m_includeServer && clientIsMono && m_steroUpmix) {
+ // Most connections in server to client modes are created already by the code in
+ // JackAudioInterface. We only need to handle any upmixing of mono clients here.
+ const char** systemInPorts = jack_get_ports(m_jackClient, NULL, NULL,
+ JackPortIsPhysical | JackPortIsInput);
+ if (systemInPorts[0] && systemInPorts[1]) {
+ jack_connect(m_jackClient, clientOutPorts.at(0), systemInPorts[1]);
+ }
+ jack_free(systemInPorts);
+ }
+
+ if (m_fan || m_loop) {
+ // Start with our receiving ports.
+ for (int i = 0; i < clientOutPorts.count(); i++) {
+ QString channel =
+ QString(clientOutPorts.at(i)).section(QStringLiteral("_"), -1, -1);
+ for (int j = 0; inPorts[j]; j++) {
+ QString otherClient =
+ QString(inPorts[j]).section(QStringLiteral(":"), 0, 0);
+ QString otherChannel =
+ QString(inPorts[j]).section(QStringLiteral("_"), -1, -1);
+
+ // First check if this is one of our other clients. (Fan out/in and full
+ // mix.)
+ if (m_fan) {
+ if (m_clients.contains(otherClient) && otherChannel == channel) {
jack_connect(m_jackClient, clientOutPorts.at(i), inPorts[j]);
+ } else if (m_steroUpmix && clientIsMono) {
+ // Deal with the special case of stereo upmix
+ if (m_clients.contains(otherClient)
+ && otherChannel == QLatin1String("2")) {
+ jack_connect(m_jackClient, clientOutPorts.at(i), inPorts[j]);
+ }
}
}
- }
- // Then check if it's our registering client. (Client Echo and full mix.)
- if (m_patchMode == JackTrip::CLIENTECHO || m_patchMode == JackTrip::FULLMIX) {
- if (otherClient == clientName && otherChannel == channel) {
- jack_connect(m_jackClient, clientOutPorts.at(i), inPorts[j]);
- } else if (m_steroUpmix && clientIsMono) {
- if (otherClient == clientName && otherChannel == "2") {
+ // Then check if it's our registering client. (Client Echo and full mix.)
+ if (m_loop) {
+ if (otherClient == clientName && otherChannel == channel) {
jack_connect(m_jackClient, clientOutPorts.at(i), inPorts[j]);
+ } else if (m_steroUpmix && clientIsMono) {
+ if (otherClient == clientName
+ && otherChannel == QLatin1String("2")) {
+ jack_connect(m_jackClient, clientOutPorts.at(i), inPorts[j]);
+ }
}
}
}
}
- }
- // Then our sending ports. We only need to check for other clients here.
- // (Any loopback connections will have been made in the previous loop.)
- if (m_patchMode == JackTrip::CLIENTFOFI || m_patchMode == JackTrip::FULLMIX) {
- for (int i = 0; i < clientInPorts.count(); i++) {
- QString channel = QString(clientInPorts.at(i)).section("_", -1, -1);
- for (int j = 0; outPorts[j]; j++) {
- QString otherClient = QString(outPorts[j]).section(":", 0, 0);
- QString otherChannel = QString(outPorts[j]).section("_", -1, -1);
- if (m_clients.contains(otherClient)
- && !QString(outPorts[j]).contains("broadcast")) {
- if (otherChannel == channel ||
- (m_steroUpmix && channel == "2" && m_monoClients.contains(otherClient))) {
- jack_connect(m_jackClient, outPorts[j], clientInPorts.at(i));
+ // Then our sending ports. We only need to check for other clients here.
+ // (Any loopback connections will have been made in the previous loop.)
+ if (m_fan) {
+ for (int i = 0; i < clientInPorts.count(); i++) {
+ QString channel =
+ QString(clientInPorts.at(i)).section(QStringLiteral("_"), -1, -1);
+ for (int j = 0; outPorts[j]; j++) {
+ QString otherClient =
+ QString(outPorts[j]).section(QStringLiteral(":"), 0, 0);
+ QString otherChannel =
+ QString(outPorts[j]).section(QStringLiteral("_"), -1, -1);
+ if (m_clients.contains(otherClient)
+ && !QString(outPorts[j]).contains(QLatin1String("broadcast"))) {
+ if (otherChannel == channel
+ || (m_steroUpmix && channel == QLatin1String("2")
+ && m_monoClients.contains(otherClient))) {
+ jack_connect(m_jackClient, outPorts[j], clientInPorts.at(i));
+ }
}
}
}
Patcher::~Patcher()
{
- if (m_jackClient) { jack_client_close(m_jackClient); }
+ if (m_jackClient) {
+ jack_client_close(m_jackClient);
+ }
}
Q_OBJECT
public:
- Patcher() = default;
+ Patcher(QObject* parent = nullptr) : QObject(parent) {}
virtual ~Patcher();
void setPatchMode(JackTrip::hubConnectionModeT patchMode);
private:
QStringList m_clients;
QStringList m_monoClients;
- JackTrip::hubConnectionModeT m_patchMode = JackTrip::SERVERTOCLIENT;
- bool m_steroUpmix = false;
+
+ bool m_fan = false;
+ bool m_loop = false;
+ bool m_includeServer = true;
+ bool m_steroUpmix = false;
jack_client_t* m_jackClient = nullptr;
jack_status_t m_status;
mHist++; // min packets
else if (mHist > 6)
mHist = 6; // max packets
- if (gVerboseFlag) cout << "mHist = " << mHist << " at " << mFPP << "\n";
+ if (gVerboseFlag)
+ cout << "mHist = " << mHist << " at " << mFPP << "\n";
// qDebug() << "mHist =" << mHist << "@" << mFPP;
mBytes = mFPP * mNumChannels * mBitResolutionMode;
mXfrBuffer = new int8_t[mBytes];
memcpy(mZeros, mXfrBuffer, mBytes);
mIncomingCnt = 0;
mIndexPool.resize(mPoolSize);
- for (int i = 0; i < mPoolSize; i++) mIndexPool[i] = -1;
+ for (int i = 0; i < mPoolSize; i++)
+ mIndexPool[i] = -1;
mTimer0 = new QElapsedTimer();
mTimer0->start();
mGlitchCnt = 0;
mPoolSize = newPoolSize;
}
if (newPoolSize != mPoolSize) {
- if (newPoolSize < mQlen) newPoolSize = mQlen; // avoid insanely small pool
+ if (newPoolSize < mQlen)
+ newPoolSize = mQlen; // avoid insanely small pool
if (gVerboseFlag)
cout << "shrinking to " << newPoolSize << " from " << mPoolSize << "\n";
mPoolSize = newPoolSize;
int oldest = 999999;
int oldestIndex = 0;
for (int i = 0; i < mPoolSize; i++) {
- if (mIndexPool[i] == target) { targetIndex = i; }
+ if (mIndexPool[i] == target) {
+ targetIndex = i;
+ }
if (mIndexPool[i] < oldest) {
oldest = mIndexPool[i];
oldestIndex = i;
// INITIALIZE f and b
vector<long double> f;
f.resize(x.size());
- for (unsigned int i = 0; i < x.size(); i++) f[i] = x[i];
+ for (unsigned int i = 0; i < x.size(); i++)
+ f[i] = x[i];
vector<long double> b(f);
// INITIALIZE Dk
for (size_t k = 0; k < m; k++) {
// COMPUTE MU
long double mu = 0.0;
- for (size_t n = 0; n <= N - k - 1; n++) { mu += f[n + k + 1] * b[n]; }
+ for (size_t n = 0; n <= N - k - 1; n++) {
+ mu += f[n + k + 1] * b[n];
+ }
- if (Dk == 0.0) Dk = 0.0000001; // CC: from testing, needs eps
+ if (Dk == 0.0)
+ Dk = 0.0000001; // CC: from testing, needs eps
// if ( classify(Dk) ) qDebug() << pCnt << "run";
mu *= -2.0 / Dk;
// qDebug() << "m" << m << "tail.size()" << tail.size();
for (size_t i = m; i < tail.size(); i++) {
tail[i] = 0.0;
- for (size_t j = 0; j < m; j++) { tail[i] -= coeffs[j] * tail[i - 1 - j]; }
+ for (size_t j = 0; j < m; j++) {
+ tail[i] -= coeffs[j] * tail[i - 1 - j];
+ }
}
}
* methods except init, which is optional for processing that are sampling rate dependent
* or that need specific initialization.
*/
-class ProcessPlugin : public QObject
+class ProcessPlugin
{
public:
/// \brief The Class Constructor
virtual void init(int samplingRate)
{
fSamplingFreq = samplingRate;
- if (verbose) { printf("%s: init(%d)\n", getName(), samplingRate); }
+ if (verbose) {
+ printf("%s: init(%d)\n", getName(), samplingRate);
+ }
}
virtual bool getInited() { return inited; }
virtual void setVerbose(bool v) { verbose = v; }
while (mFullSlots == 0) {
// std::cerr << "READ UNDER-RUN BLOCKING before" << endl;
mBufferIsNotEmpty.wait(&mMutex, 200);
- if (JackTrip::sJackStopped) { return; }
+ if (JackTrip::sJackStopped) {
+ return;
+ }
}
// Copy mSlotSize bytes to ReadSlot
}
//*******************************************************************************
-RtAudioInterface::~RtAudioInterface() { delete mRtAudio; }
+RtAudioInterface::~RtAudioInterface()
+{
+ delete mRtAudio;
+}
//*******************************************************************************
void RtAudioInterface::setup()
RtAudio::StreamOptions options;
// The second flag affects linux and mac only
options.flags = RTAUDIO_NONINTERLEAVED | RTAUDIO_SCHEDULE_REALTIME;
-#ifdef __WIN_32__
+#ifdef _WIN32
options.flags = options.flags | RTAUDIO_MINIMIZE_LATENCY;
#endif
// linux only
cout << sampleRates[ii] << " ";
}
cout << endl;
- if (info.isDefaultOutput) { cout << " --Default Output Device--" << endl; }
- if (info.isDefaultInput) { cout << " --Default Intput Device--" << endl; }
- if (info.probed) { cout << " --Probed Successful--" << endl; }
+ if (info.isDefaultOutput) {
+ cout << " --Default Output Device--" << endl;
+ }
+ if (info.isDefaultInput) {
+ cout << " --Default Intput Device--" << endl;
+ }
+ if (info.probed) {
+ cout << " --Probed Successful--" << endl;
+ }
}
//*******************************************************************************
//--------------SETTERS---------------------------------------------
/// \brief This has no effect in RtAudio
- virtual void setClientName(QString /*ClientName*/) {}
+ virtual void setClientName(const QString& /*ClientName*/) {}
//------------------------------------------------------------------
//--------------GETTERS---------------------------------------------
#include "jacktrip_globals.h"
-#ifdef __WIN_32__
+#ifdef _WIN32
#include <windows.h>
#else
#include <termios.h>
#include <unistd.h>
#endif
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
#include "RtAudioInterface.h"
#endif
{"remotename", required_argument, NULL, 'K'}, // Client name on hub server
{"appendthreadid", no_argument, NULL,
OPT_APPENDTHREADID}, // Append thread id to client names
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
{"rtaudio", no_argument, NULL, 'R'}, // Run in JamLink mode
{"srate", required_argument, NULL, 'T'}, // Set Sample Rate
{"deviceid", required_argument, NULL,
{"verbose", no_argument, NULL, 'V'}, // Verbose mode
{"hubpatch", required_argument, NULL,
'p'}, // Set hubConnectionMode for auto patch in Jack
- {"upmix", no_argument, NULL, 'u'}, // Upmix mono clients when patching
+ {"includeserver", no_argument, NULL, 'i'}, // Include server audio in patch
+ {"upmix", no_argument, NULL, 'u'}, // Upmix mono clients when patching
{"iostat", required_argument, NULL, 'I'}, // Set IO stat timeout
{"iostatlog", required_argument, NULL, 'G'}, // Set IO stat log file
{"effects", required_argument, NULL,
//----------------------------------------------------------------------------
/// \todo Specify mandatory arguments
int ch;
- while (
- (ch = getopt_long(argc, argv,
- "n:N:H:sc:SC:o:B:P:U:q:r:b:ztlwjeJ:K:RTd:F:p:uDvVhI:G:f:O:a:x:A",
- longopts, NULL))
- != -1)
+ while ((ch = getopt_long(
+ argc, argv,
+ "n:N:H:sc:SC:o:B:P:U:q:r:b:ztlwjeJ:K:RTd:F:p:uiDvVhI:G:f:O:a:x:A",
+ longopts, NULL))
+ != -1)
switch (ch) {
case OPT_NUMRECEIVE:
if (0 < atoi(optarg)) {
//-------------------------------------------------------
if (0 == strncmp(optarg, "auto", 4)) {
mBufferQueueLength = -atoi(optarg + 4);
- if (0 == mBufferQueueLength) { mBufferQueueLength = -500; }
+ if (0 == mBufferQueueLength) {
+ mBufferQueueLength = -500;
+ }
} else if (atoi(optarg) <= 0) {
printUsage();
std::cerr << "--queue ERROR: The queue has to be equal or greater than 2"
case OPT_APPENDTHREADID:
mAppendThreadID = true;
break;
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
case 'R': // RtAudio
//-------------------------------------------------------
mUseJack = false;
case 'V':
//-------------------------------------------------------
gVerboseFlag = true;
- if (gVerboseFlag) std::cout << "Verbose mode" << std::endl;
+ if (gVerboseFlag)
+ std::cout << "Verbose mode" << std::endl;
mEffects.setVerboseFlag(gVerboseFlag);
break;
case 'p':
std::exit(1);
}
break;
+ case 'i':
+ mPatchServerAudio = true;
+ break;
case 'u':
mStereoUpmix = true;
break;
case 'G': // IO Stat log file
//-------------------------------------------------------
{
- std::ofstream *outStream = new std::ofstream(optarg);
+ std::ofstream* outStream = new std::ofstream(optarg);
if (!outStream->is_open()) {
printUsage();
- std::cerr << "--iostatlog FAILED to open " << optarg << " for writing."
- << endl;
+ std::cerr << "--iostatlog FAILED to open " << optarg
+ << " for writing." << endl;
std::exit(1);
}
mIOStatStream.reset(outStream);
case 'O': { // Overflow limiter (i, o, or io)
//-------------------------------------------------------
char cmd[]{"--overflowlimiting (-O)"};
- if (gVerboseFlag) { printf("%s argument = %s\n", cmd, optarg); }
+ if (gVerboseFlag) {
+ printf("%s argument = %s\n", cmd, optarg);
+ }
int returnCode = mEffects.parseLimiterOptArg(cmd, optarg);
if (returnCode > 1) {
mEffects.printHelp(cmd, ch);
case 'a': { // assumed number of clients (applies to outgoing limiter)
//-------------------------------------------------------
char cmd[]{"--assumednumclients (-a)"};
- if (gVerboseFlag) { printf("%s argument = %s\n", cmd, optarg); }
+ if (gVerboseFlag) {
+ printf("%s argument = %s\n", cmd, optarg);
+ }
int returnCode = mEffects.parseAssumedNumClientsOptArg(cmd, optarg);
if (returnCode > 1) {
mEffects.printHelp(cmd, ch);
if (strcmp(argv[optind], "help") != 0) {
cout << gPrintSeparator << endl;
cout << "*** Unexpected command-line argument(s): ";
- for (; optind < argc; optind++) { cout << argv[optind] << " "; }
+ for (; optind < argc; optind++) {
+ cout << argv[optind] << " ";
+ }
cout << endl << gPrintSeparator << endl;
}
printUsage();
cout << " -b, --bitres # (8, 16, 24, 32) Audio Bit Rate Resolutions "
"(default: 16, 32 uses floating-point)"
<< endl;
- cout << " -p, --hubpatch # (0, 1, 2, 3, 4, 5) Hub auto audio patch, only has "
- "effect if running HUB SERVER mode, 0=server-to-clients, 1=client loopback, "
- "2=client fan out/in but not loopback, 3=reserved for TUB, 4=full mix, 5=no "
- "auto patching (default: 0)"
- << endl;
- cout << " -u, --upmix Upmix mono clients to stereo when "
- "patching in HUB SERVER mode"
- << endl;
cout << " -z, --zerounderrun Set buffer to zeros when underrun "
"occurs (default: wavetable)"
<< endl;
"network I/O"
<< endl;
cout << endl;
+ cout << "OPTIONS FOR AUDIO PATCHING IN HUB SERVER MODE:" << endl;
+ cout << " -p, --hubpatch # (0, 1, 2, 3, 4, 5) Hub auto audio patch, only has "
+ "effect if running HUB SERVER mode, 0=server-to-clients, 1=client loopback, "
+ "2=client fan out/in but not loopback, 3=reserved for TUB, 4=full mix, 5=no "
+ "auto patching (default: 0)"
+ << endl;
+ cout << " -i, --includeserver Include audio to and from the "
+ "server in the mix when patching. Only affects -p 2 (client fan out/in "
+ "but not loopback) and -p 4 (full mix) patch modes."
+ << endl;
+ cout << " -u, --upmix Upmix mono clients to stereo when "
+ "patching"
+ << endl;
+ cout << endl;
cout << "OPTIONAL SIGNAL PROCESSING: " << endl;
cout << " -f, --effects # | paramString | help Turn on incoming and/or outgoing "
"compressor and/or reverb in Client - see `-f help' for details"
"(sources) mixing at Hub Server (otherwise 2 assumed by -O)"
<< endl;
cout << endl;
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
cout << "ARGUMENTS TO USE JACKTRIP WITHOUT JACK:" << endl;
cout << " -R, --rtaudio Use system's default sound system "
"instead of Jack"
// clang-format on
}
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
void Settings::setDevicesByString(std::string nameArg)
{
size_t commaPos;
#ifdef WAIR // WAIR
udpHub->setWAIR(mWAIR);
#endif // endwhere
+ if (mPatchServerAudio) {
+ if (mHubConnectionMode == JackTrip::CLIENTFOFI) {
+ mHubConnectionMode = JackTrip::SERVFOFI;
+ } else if (mHubConnectionMode == JackTrip::FULLMIX) {
+ mHubConnectionMode = JackTrip::SERVFULLMIX;
+ } else {
+ std::cout << "WARNING: The -i (--includeserver) flag has no effect in this "
+ "patch mode and will be ignored."
+ << std::endl;
+ }
+ }
udpHub->setHubPatch(mHubConnectionMode);
udpHub->setStereoUpmix(mStereoUpmix);
// Connect default audio ports must be set after the connection mode.
udpHub->setBroadcast(mBroadcastQueue);
udpHub->setUseRtUdpPriority(mUseRtUdpPriority);
- if (true == mAppendThreadID) { udpHub->mAppendThreadID = true; }
+ if (true == mAppendThreadID) {
+ udpHub->mAppendThreadID = true;
+ }
if (mIOStatTimeout > 0) {
udpHub->setIOStatTimeout(mIOStatTimeout);
jackTrip->setConnectDefaultAudioPorts(mConnectDefaultAudioPorts);
// Change client name if different from default
- if (!mClientName.isEmpty()) { jackTrip->setClientName(mClientName); }
+ if (!mClientName.isEmpty()) {
+ jackTrip->setClientName(mClientName);
+ }
if (!mRemoteClientName.isEmpty() && (mJackTripMode == JackTrip::CLIENTTOPINGSERVER)) {
jackTrip->setRemoteClientName(mRemoteClientName);
}
// Set RtAudio
-#ifdef __RT_AUDIO__
- if (!mUseJack) { jackTrip->setAudiointerfaceMode(JackTrip::RTAUDIO); }
+#ifdef RT_AUDIO
+ if (!mUseJack) {
+ jackTrip->setAudiointerfaceMode(JackTrip::RTAUDIO);
+ }
// Change default Sampling Rate
- if (mChangeDefaultSR) { jackTrip->setSampleRate(mSampleRate); }
+ if (mChangeDefaultSR) {
+ jackTrip->setSampleRate(mSampleRate);
+ }
// Change defualt device ID
- if (mChangeDefaultID) { jackTrip->setDeviceID(mDeviceID); }
+ if (mChangeDefaultID) {
+ jackTrip->setDeviceID(mDeviceID);
+ }
// Change default Buffer Size
- if (mChangeDefaultBS) { jackTrip->setAudioBufferSizeInSamples(mAudioBufferSize); }
+ if (mChangeDefaultBS) {
+ jackTrip->setAudioBufferSizeInSamples(mAudioBufferSize);
+ }
// Set device names
jackTrip->setInputDevice(mInputDeviceName);
std::vector<ProcessPlugin*> outgoingEffects =
mEffects.allocateOutgoingEffects(mNumAudioInputChans - nReservedChans);
- for (auto p : outgoingEffects) { jackTrip->appendProcessPluginToNetwork(p); }
+ for (auto p : outgoingEffects) {
+ jackTrip->appendProcessPluginToNetwork(p);
+ }
std::vector<ProcessPlugin*> incomingEffects =
mEffects.allocateIncomingEffects(mNumAudioOutputChans - nReservedChans);
- for (auto p : incomingEffects) { jackTrip->appendProcessPluginFromNetwork(p); }
+ for (auto p : incomingEffects) {
+ jackTrip->appendProcessPluginFromNetwork(p);
+ }
#ifdef WAIR // WAIR
if (mWAIR) {
"Settings: mNumNetRevChans doesn't correspond to Faust plugin");
break;
}
- break;
- default:
- throw std::invalid_argument(
- "Settings: mNumNetRevChans doesn't correspond to Faust plugin");
- break;
}
-}
#endif // endwhere
-return jackTrip;
+ return jackTrip;
}
void Settings::disableEcho(bool disabled)
{
-#ifdef __WIN_32__
+#ifdef _WIN32
HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;
GetConsoleMode(hStdin, &mode);
#include "DataProtocol.h"
-#ifndef __NO_JACK__
+#ifndef NO_JACK
#include "JackAudioInterface.h"
-#endif //__NO_JACK__
+#endif // NO_JACK
#include "AudioTester.h"
#include "Effects.h"
Q_OBJECT;
public:
- Settings() : mAudioTester(new AudioTester) {}
+ Settings(QObject* parent = nullptr) : QObject(parent), mAudioTester(new AudioTester)
+ {
+ }
/// \brief Parses command line input
void parseInput(int argc, char** argv);
/// \brief Prints usage help
void printUsage();
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
void setDevicesByString(std::string nameArg);
#endif
bool mChangeDefaultSR = false; ///< Change Default Sampling Rate
bool mChangeDefaultID = 0; ///< Change Default device ID
bool mChangeDefaultBS = false; ///< Change Default Buffer Size
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
unsigned int mSampleRate;
unsigned int mDeviceID;
unsigned int mAudioBufferSize;
std::string mInputDeviceName, mOutputDeviceName;
#endif
unsigned int mHubConnectionMode = JackTrip::SERVERTOCLIENT;
+ bool mPatchServerAudio = false;
bool mStereoUpmix = false;
bool mConnectDefaultAudioPorts = true; ///< Connect or not jack audio ports
int mIOStatTimeout = 0;
m_certificate = certificate;
}
-void SslServer::setPrivateKey(const QSslKey& key) { m_privateKey = key; }
+void SslServer::setPrivateKey(const QSslKey& key)
+{
+ m_privateKey = key;
+}
SslServer::~SslServer() = default;
#include "JackTrip.h"
#include "jacktrip_globals.h"
-#ifdef __WIN_32__
+#ifdef _WIN32
//#include <winsock.h>
#include <winsock2.h> //cc need SD_SEND
#endif
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
#include <sys/fcntl.h>
#include <sys/socket.h> // for POSIX Sockets
#include <unistd.h>
#endif
-#if defined(__MAC_OSX__) && !defined(__MANUAL_POLL__)
+#if defined(__APPLE__) && !defined(__MANUAL_POLL__)
#include <sys/event.h>
-#elif defined(__LINUX__) && !defined(__MANUAL_POLL__)
+#elif defined(__linux__) && !defined(__MANUAL_POLL__)
#include <sys/epoll.h>
#endif
mPeerAddr6.sin6_port = htons(mPeerPort);
if (mRunMode == RECEIVER) {
- QObject::connect(this, SIGNAL(signalWaitingTooLong(int)), jacktrip,
- SLOT(slotUdpWaitingTooLongClientGoneProbably(int)),
+ QObject::connect(this, &UdpDataProtocol::signalWaitingTooLong, jacktrip,
+ &JackTrip::slotUdpWaitingTooLongClientGoneProbably,
Qt::QueuedConnection);
}
mSimulatedLossRate = 0.0;
delete[] mAudioPacket;
delete[] mFullPacket;
if (mRunMode == RECEIVER) {
-#ifdef __WIN_32__
+#ifdef _WIN32
closesocket(mSocket);
#else
::close(mSocket);
void UdpDataProtocol::setPeerAddress(const char* peerHostOrIP)
{
// Get DNS Address
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
// Don't make the following code conditional on windows
//(Addresses a weird timing bug when in hub client mode)
if (!mPeerAddress.setAddress(peerHostOrIP)) {
QHostInfo info = QHostInfo::fromName(peerHostOrIP);
if (!info.addresses().isEmpty()) {
// use the first IP address
- mPeerAddress = info.addresses().first();
+ mPeerAddress = info.addresses().constFirst();
}
// cout << "UdpDataProtocol::setPeerAddress IP Address Number: "
// << mPeerAddress.toString().toStdString() << endl;
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
}
#endif
if (mPeerAddress.protocol() == QAbstractSocket::IPv6Protocol) {
mIPv6 = true;
} else if (mPeerAddress.protocol() != QAbstractSocket::IPv4Protocol) {
- QString error_message = "Incorrect presentation format address\n'";
+ QString error_message =
+ QStringLiteral("Incorrect presentation format address\n'");
error_message.append(peerHostOrIP);
error_message.append("' is not a valid IP address or Host Name");
// std::cerr << "ERROR: Incorrect presentation format address" << endl;
}
}
-#if defined(__WIN_32__)
+#if defined(_WIN32)
void UdpDataProtocol::setSocket(SOCKET& socket)
#else
void UdpDataProtocol::setSocket(int& socket)
#endif
{
// If we haven't been passed a valid socket, then we should bind one.
-#if defined(__WIN_32__)
+#if defined(_WIN32)
if (socket == INVALID_SOCKET) {
#else
if (socket == -1) {
}
//*******************************************************************************
-#if defined(__WIN_32__)
+#if defined(_WIN32)
SOCKET UdpDataProtocol::bindSocket()
#else
int UdpDataProtocol::bindSocket()
{
QMutexLocker locker(&sUdpMutex);
-#if defined __WIN_32__
+#if defined _WIN32
WORD wVersionRequested;
WSADATA wsaData;
int err;
SOCKET sock_fd;
#endif
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
int sock_fd;
#endif
// Set socket to be reusable, this is platform dependent
int one = 1;
-#if defined(__LINUX__)
+#if defined(__linux__)
::setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
#endif
-#if defined(__MAC_OSX__)
+#if defined(__APPLE__)
// This option is not avialable on Linux, and without it MAC OS X
// has problems rebinding a socket
::setsockopt(sock_fd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one));
#endif
-#if defined(__WIN_32__)
+#if defined(_WIN32)
// make address/port reusable
setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (char*)&one, sizeof(one));
#endif
if ((::connect(sock_fd, (struct sockaddr*)&mPeerAddr, sizeof(mPeerAddr))) < 0) {
throw std::runtime_error("ERROR: Could not connect UDP socket");
}
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
// if ( (::shutdown(sock_fd,SHUT_WR)) < 0)
//{ throw std::runtime_error("ERROR: Could shutdown SHUT_WR UDP socket"); }
#endif
-#if defined __WIN_32__
+#if defined _WIN32
/*int shut_sr = shutdown(sock_fd, SD_SEND); //shut down sender's receive function
if ( shut_sr< 0)
{
}
if (exit && !mStopSignalSent) {
mStopSignalSent = true;
- emit signalCeaseTransmission("Peer Stopped");
+ emit signalCeaseTransmission(QStringLiteral("Peer Stopped"));
std::cout << "Peer Stopped" << std::endl;
}
return 0;
//*******************************************************************************
int UdpDataProtocol::sendPacket(const char* buf, const size_t n)
{
- /*#if defined (__WIN_32__)
+ /*#if defined (_WIN32)
//Alternative windows specific code that uses winsock equivalents of the bsd socket
functions. DWORD n_bytes; WSABUF buffer; int error; buffer.len = n; buffer.buf = (char
*)buf;
void UdpDataProtocol::getPeerAddressFromFirstPacket(QHostAddress& peerHostAddress,
uint16_t& port)
{
- while (!datagramAvailable()) { msleep(100); }
+ while (!datagramAvailable()) {
+ msleep(100);
+ }
char buf[1];
struct sockaddr_storage addr;
//*******************************************************************************
void UdpDataProtocol::run()
{
- if (gVerboseFlag) switch (mRunMode) {
+ if (gVerboseFlag)
+ switch (mRunMode) {
case RECEIVER: {
std::cout << "step 3" << std::endl;
break;
cout << "UDP Socket Receiving in Port: " << mBindPort << endl;
cout << gPrintSeparator << endl;
// Make sure our socket is in non-blocking mode.
-#ifdef __WIN_32__
+#ifdef _WIN32
u_long nonblock = 1;
ioctlsocket(mSocket, FIONBIO, &nonblock);
#else
if (mRunMode == RECEIVER) {
mChans = mJackTrip->getNumOutputChannels();
- if (0 == mChans) return;
+ if (0 == mChans)
+ return;
full_packet_size = mJackTrip->getReceivePacketSizeInBytes();
mFullPacket = new int8_t[full_packet_size];
std::memset(mFullPacket, 0, full_packet_size); // set buffer to 0
} else {
mChans = mJackTrip->getNumInputChannels();
- if (0 == mChans) return;
+ if (0 == mChans)
+ return;
full_packet_size = mJackTrip->getSendPacketSizeInBytes();
mFullPacket = new int8_t[full_packet_size];
std::memset(mFullPacket, 0, full_packet_size); // set buffer to 0
// std::endl;
// Anton Runov: making setRealtimeProcessPriority optional
if (mUseRtPriority) {
-#if defined(__MAC_OSX__)
+#if defined(__APPLE__)
setRealtimeProcessPriority(mJackTrip->getBufferSizeInSamples(),
mJackTrip->getSampleRate());
#else
switch (mRunMode) {
case RECEIVER: {
// Connect signals and slots for packets arriving too late notifications
- QObject::connect(this, SIGNAL(signalWaitingTooLong(int)), this,
- SLOT(printUdpWaitedTooLong(int)), Qt::QueuedConnection);
+ QObject::connect(this, &UdpDataProtocol::signalWaitingTooLong, this,
+ &UdpDataProtocol::printUdpWaitedTooLong, Qt::QueuedConnection);
//-----------------------------------------------------------------------------------
// Wait for the first packet to be ready and obtain address
// from that packet
mStatCount = 0;
//Set up our platform specific polling mechanism. (kqueue, epoll)
-#if !defined (__MANUAL_POLL__) && !defined (__WIN_32__)
-#if defined (__MAC_OSX__)
+#if !defined (__MANUAL_POLL__) && !defined (_WIN32)
+#if defined (__APPLE__)
int kq = kqueue();
struct kevent change;
struct kevent event;
// arrive for a longer time
//timeout = UdpSocket.waitForReadyRead(30);
// timeout = cc unused!
-#if defined (__WIN_32__) || defined (__MANUAL_POLL__)
+#if defined (_WIN32) || defined (__MANUAL_POLL__)
waitForReady(60000); //60 seconds
receivePacketRedundancy(full_redundant_packet, full_redundant_packet_size,
full_packet_size, current_seq_num, last_seq_num,
*/
//----------------------------------------------------------------------------------
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
int n = kevent(kq, &change, 1, &event, 1, &timeout);
#else
int n = epoll_wait(epollfd, &event, 1, 10);
emit signalWaitingTooLong(waitTime);
}
}
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
close(kq);
#else
close(epollfd);
#endif
-#endif // __WIN_32__ || __MANUAL_POLL__
+#endif // _WIN32 || __MANUAL_POLL__
break; }
case SENDER : {
//Currently using a simplified version of the way QUdpSocket checks for datagrams.
//TODO: Consider changing to use poll() or select().
char c;
-#if defined(__WIN_32__)
+#if defined(_WIN32)
//Need to use the winsock version of the function for MSG_PEEK
WSABUF buffer;
buffer.buf = &c;
*/
void setPeerAddress(const char* peerHostOrIP);
-#if defined(__WIN_32__)
+#if defined(_WIN32)
void setSocket(SOCKET& socket);
#else
void setSocket(int& socket);
protected:
/** \brief Binds the UDP socket to the available address and specified port
*/
-#if defined(__WIN_32__)
+#if defined(_WIN32)
SOCKET bindSocket();
#else
int bindSocket();
QHostAddress mPeerAddress; ///< The Peer Address
struct sockaddr_in mPeerAddr;
struct sockaddr_in6 mPeerAddr6;
-#if defined(__WIN_32__)
+#if defined(_WIN32)
SOCKET mSocket;
#else
int mSocket;
#include <iostream>
#include <stdexcept>
-#ifndef __NO_JACK__
+#ifndef NO_JACK
#include "JMess.h"
#endif
bool UdpHubListener::sSigInt = false;
//*******************************************************************************
-UdpHubListener::UdpHubListener(int server_port, int server_udp_port)
- : mTcpServer(this)
+UdpHubListener::UdpHubListener(int server_port, int server_udp_port, QObject* parent)
+ : QObject(parent)
+ , mTcpServer(this)
, mServerPort(server_port)
, mServerUdpPort(server_udp_port)
, // final udp base port number
, mWAIR(false)
#endif // endwhere
, mTotalRunningThreads(0)
- , mHubPatchDescriptions({"server-to-clients", "client loopback",
- "client fan out/in but not loopback", "reserved for TUB",
- "full mix", "no auto patching"})
+ , mHubPatchDescriptions(
+ {"server-to-clients", "client loopback", "client fan out/in but not loopback",
+ "reserved for TUB", "full mix", "no auto patching",
+ "client fan out/in, including server", "full mix, including server"})
, m_connectDefaultAudioPorts(false)
, mIOStatTimeout(0)
{
// Register JackTripWorker with the hub listener
// mJTWorker = new JackTripWorker(this);
mJTWorkers = new QVector<JackTripWorker*>;
- for (int i = 0; i < gMaxThreads; i++) { mJTWorkers->append(nullptr); }
+ for (int i = 0; i < gMaxThreads; i++) {
+ mJTWorkers->append(nullptr);
+ }
qDebug() << "mThreadPool default maxThreadCount =" << QThread::idealThreadCount();
qDebug() << "mThreadPool maxThreadCount previously set to"
{
QMutexLocker lock(&mMutex);
// delete mJTWorker;
- for (int i = 0; i < gMaxThreads; i++) { delete mJTWorkers->at(i); }
+ for (int i = 0; i < gMaxThreads; i++) {
+ delete mJTWorkers->at(i);
+ }
delete mJTWorkers;
}
QObject::connect(&mTcpServer, &SslServer::newConnection, this,
&UdpHubListener::receivedNewConnection);
if (!mTcpServer.listen(QHostAddress::Any, mServerPort)) {
- QString error_message = QString("TCP Socket Server on Port %1 ERROR: %2")
+ QString error_message = QStringLiteral("TCP Socket Server on Port %1 ERROR: %2")
.arg(mServerPort)
.arg(mTcpServer.errorString());
std::cerr << error_message.toStdString() << endl;
if (mCertFile.isEmpty()) {
error = true;
- error_message = "No certificate file specified.";
+ error_message = QStringLiteral("No certificate file specified.");
} else if (mKeyFile.isEmpty()) {
error = true;
- error_message = "No private key file specified.";
+ error_message = QStringLiteral("No private key file specified.");
}
// Load our certificate and private key
mTcpServer.setCertificate(cert);
} else {
error = true;
- error_message = "Unable to load certificate file.";
+ error_message = QStringLiteral("Unable to load certificate file.");
}
} else {
error = true;
- error_message = "Could not find certificate file.";
+ error_message = QStringLiteral("Could not find certificate file.");
}
}
if (!key.isNull()) {
mTcpServer.setPrivateKey(key);
} else {
- error = true;
- error_message = "Unable to read RSA private key file.";
+ error = true;
+ error_message =
+ QStringLiteral("Unable to read RSA private key file.");
}
} else {
error = true;
- error_message = "Could not find RSA private key file.";
+ error_message = QStringLiteral("Could not find RSA private key file.");
}
}
QFileInfo credsInfo(mCredsFile);
if (!credsInfo.exists() || !credsInfo.isFile()) {
error = true;
- error_message = "Could not find credentials file.";
+ error_message = QStringLiteral("Could not find credentials file.");
}
}
{
QSslSocket* clientSocket =
static_cast<QSslSocket*>(mTcpServer.nextPendingConnection());
- connect(clientSocket, &QAbstractSocket::readyRead, this,
- [=] { receivedClientInfo(clientSocket); });
+ connect(clientSocket, &QAbstractSocket::readyRead, this, [=] {
+ receivedClientInfo(clientSocket);
+ });
cout << "JackTrip HUB SERVER: Client Connection Received!" << endl;
}
}
}
// If we haven't received our port, wait for more data to arrive.
- if (peer_udp_port == 0) { return; }
+ if (peer_udp_port == 0) {
+ return;
+ }
// At this stage, we should definitely only be dealing with a 16 bit integer. (Ignore
// the upper bytes.)
// Returns 0 on error
int UdpHubListener::readClientUdpPort(QSslSocket* clientConnection, QString& clientName)
{
- if (gVerboseFlag) cout << "Ready To Read From Client!" << endl;
+ if (gVerboseFlag)
+ cout << "Ready To Read From Client!" << endl;
// Read UDP Port Number from Server
// --------------------------------
qint32 udp_port;
int UdpHubListener::checkAuthAndReadPort(QSslSocket* clientConnection,
QString& clientName)
{
- if (gVerboseFlag) cout << "Ready To Read Authentication Data From Client!" << endl;
+ if (gVerboseFlag)
+ cout << "Ready To Read Authentication Data From Client!" << endl;
// Because we don't know how long our username and password are, we have to peek at
// our data to read the expected lengths and know if we have enough to work with.
// Variable length: Our username and password, each with added null terminator.
int size = gMaxRemoteNameLength + (3 * sizeof(qint32));
- if (clientConnection->bytesAvailable() < size) { return 0; }
+ if (clientConnection->bytesAvailable() < size) {
+ return 0;
+ }
qint32 usernameLength, passwordLength;
char* buf = new char[size];
}
//*******************************************************************************
-int UdpHubListener::getJackTripWorker(QString address, [[maybe_unused]] uint16_t port,
- QString& clientName)
+int UdpHubListener::getJackTripWorker(const QString& address,
+ [[maybe_unused]] uint16_t port, QString& clientName)
{
// Find our first empty slot in our vector of worker object pointers.
// Return -1 if we have no space left for additional threads, or the index of the new
if (id >= 0) {
mTotalRunningThreads++;
- if (mAppendThreadID) { clientName = clientName + QString("_%1").arg(id + 1); }
+ if (mAppendThreadID) {
+ clientName = clientName + QStringLiteral("_%1").arg(id + 1);
+ }
mJTWorkers->replace(
id, new JackTripWorker(this, mBufferQueueLength, mUnderRunMode, clientName));
mJTWorkers->at(id)->setJackTrip(
}
//*******************************************************************************
-int UdpHubListener::getPoolID(QString address, uint16_t port)
+int UdpHubListener::getPoolID(const QString& address, uint16_t port)
{
QMutexLocker lock(&mMutex);
// for (int id = 0; id<mThreadPool.activeThreadCount(); id++ )
return -1;
}
-#ifndef __NO_JACK__
+#ifndef NO_JACK
void UdpHubListener::registerClientWithPatcher(QString& clientName)
{
cout << "JackTrip HUB SERVER: Total Running Threads: " << mTotalRunningThreads
<< endl;
cout << "===============================================================" << endl;
-#ifdef WAIR // WAIR
- if (isWAIR()) connectMesh(true); // invoked with -Sw
-#endif // endwhere
+#ifdef WAIR // WAIR
+ if (isWAIR())
+ connectMesh(true); // invoked with -Sw
+#endif // endwhere
// qDebug() << "mPeerAddress" << mActiveAddress[id].address <<
// mActiveAddress[id].port;
connectPatch(true, clientName);
void UdpHubListener::unregisterClientWithPatcher(QString& clientName)
{
-#ifdef WAIR // wair
- if (isWAIR()) connectMesh(false); // invoked with -Sw
-#endif // endwhere
+#ifdef WAIR // wair
+ if (isWAIR())
+ connectMesh(false); // invoked with -Sw
+#endif // endwhere
connectPatch(false, clientName);
}
-#endif // __NO_JACK__
+#endif // NO_JACK
//*******************************************************************************
int UdpHubListener::releaseThread(int id)
{
QMutexLocker lock(&mMutex);
mTotalRunningThreads--;
-#ifdef WAIR // wair
- if (isWAIR()) connectMesh(false); // invoked with -Sw
-#endif // endwhere
+#ifdef WAIR // wair
+ if (isWAIR())
+ connectMesh(false); // invoked with -Sw
+#endif // endwhere
mJTWorkers->at(id)->deleteLater();
mJTWorkers->replace(id, nullptr);
return 0; /// \todo Check if we really need to return an argument here
worker->setClientPort(actual_peer_port);
}
-#ifndef __NO_JACK__
+#ifndef NO_JACK
#ifdef WAIR // wair
//*******************************************************************************
void UdpHubListener::connectMesh(bool spawn)
void UdpHubListener::enumerateRunningThreadIDs()
{
for (int id = 0; id < gMaxThreads; id++) {
- if (mJTWorkers->at(id) != nullptr) { qDebug() << id; }
+ if (mJTWorkers->at(id) != nullptr) {
+ qDebug() << id;
+ }
}
}
#endif // endwhere
}
}
}
-#endif // __NO_JACK__
+#endif // NO_JACK
void UdpHubListener::stopAllThreads()
{
#include "JackTrip.h"
#include "jacktrip_globals.h"
#include "jacktrip_types.h"
-#ifndef __NO_JACK__
+#ifndef NO_JACK
#include "Patcher.h"
#endif
#include "Auth.h"
Q_OBJECT;
public:
- UdpHubListener(int server_port = gServerUdpPort, int server_udp_port = 0);
+ UdpHubListener(int server_port = gServerUdpPort, int server_udp_port = 0,
+ QObject* parent = nullptr);
virtual ~UdpHubListener();
/// \brief Starts the TCP server
/// \brief Stops the execution of the Thread
void stop() { mStopped = true; }
-#ifndef __NO_JACK__
+#ifndef NO_JACK
void registerClientWithPatcher(QString& clientName);
void unregisterClientWithPatcher(QString& clientName);
#endif
* \param address as string (IPv4 or IPv6)
* \return id number of JackTripWorker
*/
- int getJackTripWorker(QString address, uint16_t port, QString& clientName);
+ int getJackTripWorker(const QString& address, uint16_t port, QString& clientName);
/** \brief Returns the ID of the client in the pool. If the client
* is not in the pool yet, returns -1.
*/
- int getPoolID(QString address, uint16_t port);
+ int getPoolID(const QString& address, uint16_t port);
void stopAllThreads();
QStringList mHubPatchDescriptions;
bool m_connectDefaultAudioPorts;
-#ifndef __NO_JACK__
+#ifndef NO_JACK
Patcher mPatcher;
#endif
bool mStereoUpmix;
void setWAIR(int b) { mWAIR = b; }
bool isWAIR() { return mWAIR; }
#endif // endwhere
-#ifndef __NO_JACK__
+#ifndef NO_JACK
void connectPatch(bool spawn, const QString& clientName);
#endif
public:
void setRequireAuth(bool requireAuth) { mRequireAuth = requireAuth; }
- void setCertFile(QString certFile) { mCertFile = certFile; }
- void setKeyFile(QString keyFile) { mKeyFile = keyFile; }
- void setCredsFile(QString credsFile) { mCredsFile = credsFile; }
+ void setCertFile(const QString& certFile) { mCertFile = certFile; }
+ void setKeyFile(const QString& keyFile) { mKeyFile = keyFile; }
+ void setCredsFile(const QString& credsFile) { mCredsFile = credsFile; }
unsigned int mHubPatch;
void setHubPatch(unsigned int p)
{
mHubPatch = p;
-#ifndef __NO_JACK__
+#ifndef NO_JACK
mPatcher.setPatchMode(static_cast<JackTrip::hubConnectionModeT>(p));
#endif
// Set the correct audio port connection setting for our chosen patch mode.
- if (mHubPatch == JackTrip::SERVERTOCLIENT) {
+ if (mHubPatch == JackTrip::SERVERTOCLIENT || mHubPatch == JackTrip::SERVFOFI
+ || mHubPatch == JackTrip::SERVFULLMIX) {
m_connectDefaultAudioPorts = true;
} else {
m_connectDefaultAudioPorts = false;
}
}
unsigned int getHubPatch() { return mHubPatch; }
-
- void setStereoUpmix([[maybe_unused]] bool upmix) {
-#ifndef __NO_JACK__
+
+ void setStereoUpmix([[maybe_unused]] bool upmix)
+ {
+#ifndef NO_JACK
mPatcher.setStereoUpmix(upmix);
#endif
}
{
FAUSTFLOAT* zone = fZone[p];
for (size_t i = 0; i < table[val].size(); i++) {
- if (zone == table[val][i]->getZone()) return int(i);
+ if (zone == table[val][i]->getZone())
+ return int(i);
}
return -1;
}
int id3 = getZoneIndex(table, p, 2);
// Deactivates everywhere..
- if (id1 != -1) table[0][id1]->setActive(false);
- if (id2 != -1) table[1][id2]->setActive(false);
- if (id3 != -1) table[2][id3]->setActive(false);
+ if (id1 != -1)
+ table[0][id1]->setActive(false);
+ if (id2 != -1)
+ table[1][id2]->setActive(false);
+ if (id3 != -1)
+ table[2][id3]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
virtual ~APIUI()
{
- for (auto& it : fConversion) delete it;
+ for (auto& it : fConversion)
+ delete it;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i]) delete it;
- for (auto& it : fGyr[i]) delete it;
+ for (auto& it : fAcc[i])
+ delete it;
+ for (auto& it : fGyr[i])
+ delete it;
}
delete fRedReader;
delete fGreenReader;
{
std::map<const char*, const char*> res;
std::map<std::string, std::string> metadata = fMetaData[p];
- for (const auto& it : metadata) { res[it.first.c_str()] = it.second.c_str(); }
+ for (const auto& it : metadata) {
+ res[it.first.c_str()] = it.second.c_str();
+ }
return res;
}
*/
void propagateAcc(int acc, double value)
{
- for (size_t i = 0; i < fAcc[acc].size(); i++) { fAcc[acc][i]->update(value); }
+ for (size_t i = 0; i < fAcc[acc].size(); i++) {
+ fAcc[acc][i]->update(value);
+ }
}
/**
*/
void propagateGyr(int gyr, double value)
{
- for (size_t i = 0; i < fGyr[gyr].size(); i++) { fGyr[gyr][i]->update(value); }
+ for (size_t i = 0; i < fGyr[gyr].size(); i++) {
+ fGyr[gyr][i]->update(value);
+ }
}
/**
virtual void instanceClear()
{
- for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec5[l0] = 0.0f; }
- for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) { fRec4[l1] = 0.0f; }
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec3[l2] = 0.0f; }
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { fRec2[l3] = 0.0f; }
- for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec1[l4] = 0.0f; }
- for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { fRec0[l5] = 0.0f; }
+ for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
+ fRec5[l0] = 0.0f;
+ }
+ for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) {
+ fRec4[l1] = 0.0f;
+ }
+ for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
+ fRec3[l2] = 0.0f;
+ }
+ for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
+ fRec2[l3] = 0.0f;
+ }
+ for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
+ fRec1[l4] = 0.0f;
+ }
+ for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
+ fRec0[l5] = 0.0f;
+ }
}
virtual void init(int sample_rate)
{
FAUSTFLOAT* zone = fZone[p];
for (size_t i = 0; i < table[val].size(); i++) {
- if (zone == table[val][i]->getZone()) return int(i);
+ if (zone == table[val][i]->getZone())
+ return int(i);
}
return -1;
}
int id3 = getZoneIndex(table, p, 2);
// Deactivates everywhere..
- if (id1 != -1) table[0][id1]->setActive(false);
- if (id2 != -1) table[1][id2]->setActive(false);
- if (id3 != -1) table[2][id3]->setActive(false);
+ if (id1 != -1)
+ table[0][id1]->setActive(false);
+ if (id2 != -1)
+ table[1][id2]->setActive(false);
+ if (id3 != -1)
+ table[2][id3]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
virtual ~APIUI()
{
- for (auto& it : fConversion) delete it;
+ for (auto& it : fConversion)
+ delete it;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i]) delete it;
- for (auto& it : fGyr[i]) delete it;
+ for (auto& it : fAcc[i])
+ delete it;
+ for (auto& it : fGyr[i])
+ delete it;
}
delete fRedReader;
delete fGreenReader;
{
std::map<const char*, const char*> res;
std::map<std::string, std::string> metadata = fMetaData[p];
- for (const auto& it : metadata) { res[it.first.c_str()] = it.second.c_str(); }
+ for (const auto& it : metadata) {
+ res[it.first.c_str()] = it.second.c_str();
+ }
return res;
}
*/
void propagateAcc(int acc, double value)
{
- for (size_t i = 0; i < fAcc[acc].size(); i++) { fAcc[acc][i]->update(value); }
+ for (size_t i = 0; i < fAcc[acc].size(); i++) {
+ fAcc[acc][i]->update(value);
+ }
}
/**
*/
void propagateGyr(int gyr, double value)
{
- for (size_t i = 0; i < fGyr[gyr].size(); i++) { fGyr[gyr][i]->update(value); }
+ for (size_t i = 0; i < fGyr[gyr].size(); i++) {
+ fGyr[gyr][i]->update(value);
+ }
}
/**
virtual void instanceClear()
{
- for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec9[l0] = 0.0f; }
+ for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
+ fRec9[l0] = 0.0f;
+ }
IOTA = 0;
- for (int l1 = 0; (l1 < 8192); l1 = (l1 + 1)) { fVec0[l1] = 0.0f; }
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec8[l2] = 0.0f; }
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { fRec11[l3] = 0.0f; }
- for (int l4 = 0; (l4 < 8192); l4 = (l4 + 1)) { fVec1[l4] = 0.0f; }
- for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { fRec10[l5] = 0.0f; }
- for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) { fRec13[l6] = 0.0f; }
- for (int l7 = 0; (l7 < 8192); l7 = (l7 + 1)) { fVec2[l7] = 0.0f; }
- for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) { fRec12[l8] = 0.0f; }
- for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { fRec15[l9] = 0.0f; }
- for (int l10 = 0; (l10 < 8192); l10 = (l10 + 1)) { fVec3[l10] = 0.0f; }
- for (int l11 = 0; (l11 < 2); l11 = (l11 + 1)) { fRec14[l11] = 0.0f; }
- for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) { fRec17[l12] = 0.0f; }
- for (int l13 = 0; (l13 < 8192); l13 = (l13 + 1)) { fVec4[l13] = 0.0f; }
- for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { fRec16[l14] = 0.0f; }
- for (int l15 = 0; (l15 < 2); l15 = (l15 + 1)) { fRec19[l15] = 0.0f; }
- for (int l16 = 0; (l16 < 8192); l16 = (l16 + 1)) { fVec5[l16] = 0.0f; }
- for (int l17 = 0; (l17 < 2); l17 = (l17 + 1)) { fRec18[l17] = 0.0f; }
- for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) { fRec21[l18] = 0.0f; }
- for (int l19 = 0; (l19 < 8192); l19 = (l19 + 1)) { fVec6[l19] = 0.0f; }
- for (int l20 = 0; (l20 < 2); l20 = (l20 + 1)) { fRec20[l20] = 0.0f; }
- for (int l21 = 0; (l21 < 2); l21 = (l21 + 1)) { fRec23[l21] = 0.0f; }
- for (int l22 = 0; (l22 < 8192); l22 = (l22 + 1)) { fVec7[l22] = 0.0f; }
- for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) { fRec22[l23] = 0.0f; }
- for (int l24 = 0; (l24 < 2048); l24 = (l24 + 1)) { fVec8[l24] = 0.0f; }
- for (int l25 = 0; (l25 < 2); l25 = (l25 + 1)) { fRec6[l25] = 0.0f; }
- for (int l26 = 0; (l26 < 2048); l26 = (l26 + 1)) { fVec9[l26] = 0.0f; }
- for (int l27 = 0; (l27 < 2); l27 = (l27 + 1)) { fRec4[l27] = 0.0f; }
- for (int l28 = 0; (l28 < 2048); l28 = (l28 + 1)) { fVec10[l28] = 0.0f; }
- for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) { fRec2[l29] = 0.0f; }
- for (int l30 = 0; (l30 < 1024); l30 = (l30 + 1)) { fVec11[l30] = 0.0f; }
- for (int l31 = 0; (l31 < 2); l31 = (l31 + 1)) { fRec0[l31] = 0.0f; }
- for (int l32 = 0; (l32 < 2); l32 = (l32 + 1)) { fRec33[l32] = 0.0f; }
- for (int l33 = 0; (l33 < 8192); l33 = (l33 + 1)) { fVec12[l33] = 0.0f; }
- for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) { fRec32[l34] = 0.0f; }
- for (int l35 = 0; (l35 < 2); l35 = (l35 + 1)) { fRec35[l35] = 0.0f; }
- for (int l36 = 0; (l36 < 8192); l36 = (l36 + 1)) { fVec13[l36] = 0.0f; }
- for (int l37 = 0; (l37 < 2); l37 = (l37 + 1)) { fRec34[l37] = 0.0f; }
- for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) { fRec37[l38] = 0.0f; }
- for (int l39 = 0; (l39 < 8192); l39 = (l39 + 1)) { fVec14[l39] = 0.0f; }
- for (int l40 = 0; (l40 < 2); l40 = (l40 + 1)) { fRec36[l40] = 0.0f; }
- for (int l41 = 0; (l41 < 2); l41 = (l41 + 1)) { fRec39[l41] = 0.0f; }
- for (int l42 = 0; (l42 < 8192); l42 = (l42 + 1)) { fVec15[l42] = 0.0f; }
- for (int l43 = 0; (l43 < 2); l43 = (l43 + 1)) { fRec38[l43] = 0.0f; }
- for (int l44 = 0; (l44 < 2); l44 = (l44 + 1)) { fRec41[l44] = 0.0f; }
- for (int l45 = 0; (l45 < 8192); l45 = (l45 + 1)) { fVec16[l45] = 0.0f; }
- for (int l46 = 0; (l46 < 2); l46 = (l46 + 1)) { fRec40[l46] = 0.0f; }
- for (int l47 = 0; (l47 < 2); l47 = (l47 + 1)) { fRec43[l47] = 0.0f; }
- for (int l48 = 0; (l48 < 8192); l48 = (l48 + 1)) { fVec17[l48] = 0.0f; }
- for (int l49 = 0; (l49 < 2); l49 = (l49 + 1)) { fRec42[l49] = 0.0f; }
- for (int l50 = 0; (l50 < 2); l50 = (l50 + 1)) { fRec45[l50] = 0.0f; }
- for (int l51 = 0; (l51 < 8192); l51 = (l51 + 1)) { fVec18[l51] = 0.0f; }
- for (int l52 = 0; (l52 < 2); l52 = (l52 + 1)) { fRec44[l52] = 0.0f; }
- for (int l53 = 0; (l53 < 2); l53 = (l53 + 1)) { fRec47[l53] = 0.0f; }
- for (int l54 = 0; (l54 < 8192); l54 = (l54 + 1)) { fVec19[l54] = 0.0f; }
- for (int l55 = 0; (l55 < 2); l55 = (l55 + 1)) { fRec46[l55] = 0.0f; }
- for (int l56 = 0; (l56 < 2048); l56 = (l56 + 1)) { fVec20[l56] = 0.0f; }
- for (int l57 = 0; (l57 < 2); l57 = (l57 + 1)) { fRec30[l57] = 0.0f; }
- for (int l58 = 0; (l58 < 2048); l58 = (l58 + 1)) { fVec21[l58] = 0.0f; }
- for (int l59 = 0; (l59 < 2); l59 = (l59 + 1)) { fRec28[l59] = 0.0f; }
- for (int l60 = 0; (l60 < 2048); l60 = (l60 + 1)) { fVec22[l60] = 0.0f; }
- for (int l61 = 0; (l61 < 2); l61 = (l61 + 1)) { fRec26[l61] = 0.0f; }
- for (int l62 = 0; (l62 < 2048); l62 = (l62 + 1)) { fVec23[l62] = 0.0f; }
- for (int l63 = 0; (l63 < 2); l63 = (l63 + 1)) { fRec24[l63] = 0.0f; }
+ for (int l1 = 0; (l1 < 8192); l1 = (l1 + 1)) {
+ fVec0[l1] = 0.0f;
+ }
+ for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
+ fRec8[l2] = 0.0f;
+ }
+ for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
+ fRec11[l3] = 0.0f;
+ }
+ for (int l4 = 0; (l4 < 8192); l4 = (l4 + 1)) {
+ fVec1[l4] = 0.0f;
+ }
+ for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
+ fRec10[l5] = 0.0f;
+ }
+ for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) {
+ fRec13[l6] = 0.0f;
+ }
+ for (int l7 = 0; (l7 < 8192); l7 = (l7 + 1)) {
+ fVec2[l7] = 0.0f;
+ }
+ for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) {
+ fRec12[l8] = 0.0f;
+ }
+ for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) {
+ fRec15[l9] = 0.0f;
+ }
+ for (int l10 = 0; (l10 < 8192); l10 = (l10 + 1)) {
+ fVec3[l10] = 0.0f;
+ }
+ for (int l11 = 0; (l11 < 2); l11 = (l11 + 1)) {
+ fRec14[l11] = 0.0f;
+ }
+ for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) {
+ fRec17[l12] = 0.0f;
+ }
+ for (int l13 = 0; (l13 < 8192); l13 = (l13 + 1)) {
+ fVec4[l13] = 0.0f;
+ }
+ for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) {
+ fRec16[l14] = 0.0f;
+ }
+ for (int l15 = 0; (l15 < 2); l15 = (l15 + 1)) {
+ fRec19[l15] = 0.0f;
+ }
+ for (int l16 = 0; (l16 < 8192); l16 = (l16 + 1)) {
+ fVec5[l16] = 0.0f;
+ }
+ for (int l17 = 0; (l17 < 2); l17 = (l17 + 1)) {
+ fRec18[l17] = 0.0f;
+ }
+ for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) {
+ fRec21[l18] = 0.0f;
+ }
+ for (int l19 = 0; (l19 < 8192); l19 = (l19 + 1)) {
+ fVec6[l19] = 0.0f;
+ }
+ for (int l20 = 0; (l20 < 2); l20 = (l20 + 1)) {
+ fRec20[l20] = 0.0f;
+ }
+ for (int l21 = 0; (l21 < 2); l21 = (l21 + 1)) {
+ fRec23[l21] = 0.0f;
+ }
+ for (int l22 = 0; (l22 < 8192); l22 = (l22 + 1)) {
+ fVec7[l22] = 0.0f;
+ }
+ for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) {
+ fRec22[l23] = 0.0f;
+ }
+ for (int l24 = 0; (l24 < 2048); l24 = (l24 + 1)) {
+ fVec8[l24] = 0.0f;
+ }
+ for (int l25 = 0; (l25 < 2); l25 = (l25 + 1)) {
+ fRec6[l25] = 0.0f;
+ }
+ for (int l26 = 0; (l26 < 2048); l26 = (l26 + 1)) {
+ fVec9[l26] = 0.0f;
+ }
+ for (int l27 = 0; (l27 < 2); l27 = (l27 + 1)) {
+ fRec4[l27] = 0.0f;
+ }
+ for (int l28 = 0; (l28 < 2048); l28 = (l28 + 1)) {
+ fVec10[l28] = 0.0f;
+ }
+ for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) {
+ fRec2[l29] = 0.0f;
+ }
+ for (int l30 = 0; (l30 < 1024); l30 = (l30 + 1)) {
+ fVec11[l30] = 0.0f;
+ }
+ for (int l31 = 0; (l31 < 2); l31 = (l31 + 1)) {
+ fRec0[l31] = 0.0f;
+ }
+ for (int l32 = 0; (l32 < 2); l32 = (l32 + 1)) {
+ fRec33[l32] = 0.0f;
+ }
+ for (int l33 = 0; (l33 < 8192); l33 = (l33 + 1)) {
+ fVec12[l33] = 0.0f;
+ }
+ for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) {
+ fRec32[l34] = 0.0f;
+ }
+ for (int l35 = 0; (l35 < 2); l35 = (l35 + 1)) {
+ fRec35[l35] = 0.0f;
+ }
+ for (int l36 = 0; (l36 < 8192); l36 = (l36 + 1)) {
+ fVec13[l36] = 0.0f;
+ }
+ for (int l37 = 0; (l37 < 2); l37 = (l37 + 1)) {
+ fRec34[l37] = 0.0f;
+ }
+ for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) {
+ fRec37[l38] = 0.0f;
+ }
+ for (int l39 = 0; (l39 < 8192); l39 = (l39 + 1)) {
+ fVec14[l39] = 0.0f;
+ }
+ for (int l40 = 0; (l40 < 2); l40 = (l40 + 1)) {
+ fRec36[l40] = 0.0f;
+ }
+ for (int l41 = 0; (l41 < 2); l41 = (l41 + 1)) {
+ fRec39[l41] = 0.0f;
+ }
+ for (int l42 = 0; (l42 < 8192); l42 = (l42 + 1)) {
+ fVec15[l42] = 0.0f;
+ }
+ for (int l43 = 0; (l43 < 2); l43 = (l43 + 1)) {
+ fRec38[l43] = 0.0f;
+ }
+ for (int l44 = 0; (l44 < 2); l44 = (l44 + 1)) {
+ fRec41[l44] = 0.0f;
+ }
+ for (int l45 = 0; (l45 < 8192); l45 = (l45 + 1)) {
+ fVec16[l45] = 0.0f;
+ }
+ for (int l46 = 0; (l46 < 2); l46 = (l46 + 1)) {
+ fRec40[l46] = 0.0f;
+ }
+ for (int l47 = 0; (l47 < 2); l47 = (l47 + 1)) {
+ fRec43[l47] = 0.0f;
+ }
+ for (int l48 = 0; (l48 < 8192); l48 = (l48 + 1)) {
+ fVec17[l48] = 0.0f;
+ }
+ for (int l49 = 0; (l49 < 2); l49 = (l49 + 1)) {
+ fRec42[l49] = 0.0f;
+ }
+ for (int l50 = 0; (l50 < 2); l50 = (l50 + 1)) {
+ fRec45[l50] = 0.0f;
+ }
+ for (int l51 = 0; (l51 < 8192); l51 = (l51 + 1)) {
+ fVec18[l51] = 0.0f;
+ }
+ for (int l52 = 0; (l52 < 2); l52 = (l52 + 1)) {
+ fRec44[l52] = 0.0f;
+ }
+ for (int l53 = 0; (l53 < 2); l53 = (l53 + 1)) {
+ fRec47[l53] = 0.0f;
+ }
+ for (int l54 = 0; (l54 < 8192); l54 = (l54 + 1)) {
+ fVec19[l54] = 0.0f;
+ }
+ for (int l55 = 0; (l55 < 2); l55 = (l55 + 1)) {
+ fRec46[l55] = 0.0f;
+ }
+ for (int l56 = 0; (l56 < 2048); l56 = (l56 + 1)) {
+ fVec20[l56] = 0.0f;
+ }
+ for (int l57 = 0; (l57 < 2); l57 = (l57 + 1)) {
+ fRec30[l57] = 0.0f;
+ }
+ for (int l58 = 0; (l58 < 2048); l58 = (l58 + 1)) {
+ fVec21[l58] = 0.0f;
+ }
+ for (int l59 = 0; (l59 < 2); l59 = (l59 + 1)) {
+ fRec28[l59] = 0.0f;
+ }
+ for (int l60 = 0; (l60 < 2048); l60 = (l60 + 1)) {
+ fVec22[l60] = 0.0f;
+ }
+ for (int l61 = 0; (l61 < 2); l61 = (l61 + 1)) {
+ fRec26[l61] = 0.0f;
+ }
+ for (int l62 = 0; (l62 < 2048); l62 = (l62 + 1)) {
+ fVec23[l62] = 0.0f;
+ }
+ for (int l63 = 0; (l63 < 2); l63 = (l63 + 1)) {
+ fRec24[l63] = 0.0f;
+ }
}
virtual void init(int sample_rate)
{
FAUSTFLOAT* zone = fZone[p];
for (size_t i = 0; i < table[val].size(); i++) {
- if (zone == table[val][i]->getZone()) return int(i);
+ if (zone == table[val][i]->getZone())
+ return int(i);
}
return -1;
}
int id3 = getZoneIndex(table, p, 2);
// Deactivates everywhere..
- if (id1 != -1) table[0][id1]->setActive(false);
- if (id2 != -1) table[1][id2]->setActive(false);
- if (id3 != -1) table[2][id3]->setActive(false);
+ if (id1 != -1)
+ table[0][id1]->setActive(false);
+ if (id2 != -1)
+ table[1][id2]->setActive(false);
+ if (id3 != -1)
+ table[2][id3]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
virtual ~APIUI()
{
- for (auto& it : fConversion) delete it;
+ for (auto& it : fConversion)
+ delete it;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i]) delete it;
- for (auto& it : fGyr[i]) delete it;
+ for (auto& it : fAcc[i])
+ delete it;
+ for (auto& it : fGyr[i])
+ delete it;
}
delete fRedReader;
delete fGreenReader;
{
std::map<const char*, const char*> res;
std::map<std::string, std::string> metadata = fMetaData[p];
- for (auto it : metadata) { res[it.first.c_str()] = it.second.c_str(); }
+ for (auto it : metadata) {
+ res[it.first.c_str()] = it.second.c_str();
+ }
return res;
}
*/
void propagateAcc(int acc, double value)
{
- for (size_t i = 0; i < fAcc[acc].size(); i++) { fAcc[acc][i]->update(value); }
+ for (size_t i = 0; i < fAcc[acc].size(); i++) {
+ fAcc[acc][i]->update(value);
+ }
}
/**
*/
void propagateGyr(int gyr, double value)
{
- for (size_t i = 0; i < fGyr[gyr].size(); i++) { fGyr[gyr][i]->update(value); }
+ for (size_t i = 0; i < fGyr[gyr].size(); i++) {
+ fGyr[gyr][i]->update(value);
+ }
}
/**
virtual void instanceClear()
{
- for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { fRec9[l0] = 0.0f; }
+ for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
+ fRec9[l0] = 0.0f;
+ }
IOTA = 0;
- for (int l1 = 0; (l1 < 8192); l1 = (l1 + 1)) { fVec0[l1] = 0.0f; }
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec8[l2] = 0.0f; }
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { fRec11[l3] = 0.0f; }
- for (int l4 = 0; (l4 < 8192); l4 = (l4 + 1)) { fVec1[l4] = 0.0f; }
- for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { fRec10[l5] = 0.0f; }
- for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) { fRec13[l6] = 0.0f; }
- for (int l7 = 0; (l7 < 8192); l7 = (l7 + 1)) { fVec2[l7] = 0.0f; }
- for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) { fRec12[l8] = 0.0f; }
- for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { fRec15[l9] = 0.0f; }
- for (int l10 = 0; (l10 < 8192); l10 = (l10 + 1)) { fVec3[l10] = 0.0f; }
- for (int l11 = 0; (l11 < 2); l11 = (l11 + 1)) { fRec14[l11] = 0.0f; }
- for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) { fRec17[l12] = 0.0f; }
- for (int l13 = 0; (l13 < 8192); l13 = (l13 + 1)) { fVec4[l13] = 0.0f; }
- for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { fRec16[l14] = 0.0f; }
- for (int l15 = 0; (l15 < 2); l15 = (l15 + 1)) { fRec19[l15] = 0.0f; }
- for (int l16 = 0; (l16 < 8192); l16 = (l16 + 1)) { fVec5[l16] = 0.0f; }
- for (int l17 = 0; (l17 < 2); l17 = (l17 + 1)) { fRec18[l17] = 0.0f; }
- for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) { fRec21[l18] = 0.0f; }
- for (int l19 = 0; (l19 < 8192); l19 = (l19 + 1)) { fVec6[l19] = 0.0f; }
- for (int l20 = 0; (l20 < 2); l20 = (l20 + 1)) { fRec20[l20] = 0.0f; }
- for (int l21 = 0; (l21 < 2); l21 = (l21 + 1)) { fRec23[l21] = 0.0f; }
- for (int l22 = 0; (l22 < 8192); l22 = (l22 + 1)) { fVec7[l22] = 0.0f; }
- for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) { fRec22[l23] = 0.0f; }
- for (int l24 = 0; (l24 < 2048); l24 = (l24 + 1)) { fVec8[l24] = 0.0f; }
- for (int l25 = 0; (l25 < 2); l25 = (l25 + 1)) { fRec6[l25] = 0.0f; }
- for (int l26 = 0; (l26 < 2048); l26 = (l26 + 1)) { fVec9[l26] = 0.0f; }
- for (int l27 = 0; (l27 < 2); l27 = (l27 + 1)) { fRec4[l27] = 0.0f; }
- for (int l28 = 0; (l28 < 2048); l28 = (l28 + 1)) { fVec10[l28] = 0.0f; }
- for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) { fRec2[l29] = 0.0f; }
- for (int l30 = 0; (l30 < 2048); l30 = (l30 + 1)) { fVec11[l30] = 0.0f; }
- for (int l31 = 0; (l31 < 2); l31 = (l31 + 1)) { fRec0[l31] = 0.0f; }
- for (int l32 = 0; (l32 < 2); l32 = (l32 + 1)) { fRec33[l32] = 0.0f; }
- for (int l33 = 0; (l33 < 8192); l33 = (l33 + 1)) { fVec12[l33] = 0.0f; }
- for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) { fRec32[l34] = 0.0f; }
- for (int l35 = 0; (l35 < 2); l35 = (l35 + 1)) { fRec35[l35] = 0.0f; }
- for (int l36 = 0; (l36 < 8192); l36 = (l36 + 1)) { fVec13[l36] = 0.0f; }
- for (int l37 = 0; (l37 < 2); l37 = (l37 + 1)) { fRec34[l37] = 0.0f; }
- for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) { fRec37[l38] = 0.0f; }
- for (int l39 = 0; (l39 < 8192); l39 = (l39 + 1)) { fVec14[l39] = 0.0f; }
- for (int l40 = 0; (l40 < 2); l40 = (l40 + 1)) { fRec36[l40] = 0.0f; }
- for (int l41 = 0; (l41 < 2); l41 = (l41 + 1)) { fRec39[l41] = 0.0f; }
- for (int l42 = 0; (l42 < 8192); l42 = (l42 + 1)) { fVec15[l42] = 0.0f; }
- for (int l43 = 0; (l43 < 2); l43 = (l43 + 1)) { fRec38[l43] = 0.0f; }
- for (int l44 = 0; (l44 < 2); l44 = (l44 + 1)) { fRec41[l44] = 0.0f; }
- for (int l45 = 0; (l45 < 8192); l45 = (l45 + 1)) { fVec16[l45] = 0.0f; }
- for (int l46 = 0; (l46 < 2); l46 = (l46 + 1)) { fRec40[l46] = 0.0f; }
- for (int l47 = 0; (l47 < 2); l47 = (l47 + 1)) { fRec43[l47] = 0.0f; }
- for (int l48 = 0; (l48 < 8192); l48 = (l48 + 1)) { fVec17[l48] = 0.0f; }
- for (int l49 = 0; (l49 < 2); l49 = (l49 + 1)) { fRec42[l49] = 0.0f; }
- for (int l50 = 0; (l50 < 2); l50 = (l50 + 1)) { fRec45[l50] = 0.0f; }
- for (int l51 = 0; (l51 < 8192); l51 = (l51 + 1)) { fVec18[l51] = 0.0f; }
- for (int l52 = 0; (l52 < 2); l52 = (l52 + 1)) { fRec44[l52] = 0.0f; }
- for (int l53 = 0; (l53 < 2); l53 = (l53 + 1)) { fRec47[l53] = 0.0f; }
- for (int l54 = 0; (l54 < 8192); l54 = (l54 + 1)) { fVec19[l54] = 0.0f; }
- for (int l55 = 0; (l55 < 2); l55 = (l55 + 1)) { fRec46[l55] = 0.0f; }
- for (int l56 = 0; (l56 < 2048); l56 = (l56 + 1)) { fVec20[l56] = 0.0f; }
- for (int l57 = 0; (l57 < 2); l57 = (l57 + 1)) { fRec30[l57] = 0.0f; }
- for (int l58 = 0; (l58 < 2048); l58 = (l58 + 1)) { fVec21[l58] = 0.0f; }
- for (int l59 = 0; (l59 < 2); l59 = (l59 + 1)) { fRec28[l59] = 0.0f; }
- for (int l60 = 0; (l60 < 2048); l60 = (l60 + 1)) { fVec22[l60] = 0.0f; }
- for (int l61 = 0; (l61 < 2); l61 = (l61 + 1)) { fRec26[l61] = 0.0f; }
- for (int l62 = 0; (l62 < 1024); l62 = (l62 + 1)) { fVec23[l62] = 0.0f; }
- for (int l63 = 0; (l63 < 2); l63 = (l63 + 1)) { fRec24[l63] = 0.0f; }
+ for (int l1 = 0; (l1 < 8192); l1 = (l1 + 1)) {
+ fVec0[l1] = 0.0f;
+ }
+ for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
+ fRec8[l2] = 0.0f;
+ }
+ for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
+ fRec11[l3] = 0.0f;
+ }
+ for (int l4 = 0; (l4 < 8192); l4 = (l4 + 1)) {
+ fVec1[l4] = 0.0f;
+ }
+ for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
+ fRec10[l5] = 0.0f;
+ }
+ for (int l6 = 0; (l6 < 2); l6 = (l6 + 1)) {
+ fRec13[l6] = 0.0f;
+ }
+ for (int l7 = 0; (l7 < 8192); l7 = (l7 + 1)) {
+ fVec2[l7] = 0.0f;
+ }
+ for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) {
+ fRec12[l8] = 0.0f;
+ }
+ for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) {
+ fRec15[l9] = 0.0f;
+ }
+ for (int l10 = 0; (l10 < 8192); l10 = (l10 + 1)) {
+ fVec3[l10] = 0.0f;
+ }
+ for (int l11 = 0; (l11 < 2); l11 = (l11 + 1)) {
+ fRec14[l11] = 0.0f;
+ }
+ for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) {
+ fRec17[l12] = 0.0f;
+ }
+ for (int l13 = 0; (l13 < 8192); l13 = (l13 + 1)) {
+ fVec4[l13] = 0.0f;
+ }
+ for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) {
+ fRec16[l14] = 0.0f;
+ }
+ for (int l15 = 0; (l15 < 2); l15 = (l15 + 1)) {
+ fRec19[l15] = 0.0f;
+ }
+ for (int l16 = 0; (l16 < 8192); l16 = (l16 + 1)) {
+ fVec5[l16] = 0.0f;
+ }
+ for (int l17 = 0; (l17 < 2); l17 = (l17 + 1)) {
+ fRec18[l17] = 0.0f;
+ }
+ for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) {
+ fRec21[l18] = 0.0f;
+ }
+ for (int l19 = 0; (l19 < 8192); l19 = (l19 + 1)) {
+ fVec6[l19] = 0.0f;
+ }
+ for (int l20 = 0; (l20 < 2); l20 = (l20 + 1)) {
+ fRec20[l20] = 0.0f;
+ }
+ for (int l21 = 0; (l21 < 2); l21 = (l21 + 1)) {
+ fRec23[l21] = 0.0f;
+ }
+ for (int l22 = 0; (l22 < 8192); l22 = (l22 + 1)) {
+ fVec7[l22] = 0.0f;
+ }
+ for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) {
+ fRec22[l23] = 0.0f;
+ }
+ for (int l24 = 0; (l24 < 2048); l24 = (l24 + 1)) {
+ fVec8[l24] = 0.0f;
+ }
+ for (int l25 = 0; (l25 < 2); l25 = (l25 + 1)) {
+ fRec6[l25] = 0.0f;
+ }
+ for (int l26 = 0; (l26 < 2048); l26 = (l26 + 1)) {
+ fVec9[l26] = 0.0f;
+ }
+ for (int l27 = 0; (l27 < 2); l27 = (l27 + 1)) {
+ fRec4[l27] = 0.0f;
+ }
+ for (int l28 = 0; (l28 < 2048); l28 = (l28 + 1)) {
+ fVec10[l28] = 0.0f;
+ }
+ for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) {
+ fRec2[l29] = 0.0f;
+ }
+ for (int l30 = 0; (l30 < 2048); l30 = (l30 + 1)) {
+ fVec11[l30] = 0.0f;
+ }
+ for (int l31 = 0; (l31 < 2); l31 = (l31 + 1)) {
+ fRec0[l31] = 0.0f;
+ }
+ for (int l32 = 0; (l32 < 2); l32 = (l32 + 1)) {
+ fRec33[l32] = 0.0f;
+ }
+ for (int l33 = 0; (l33 < 8192); l33 = (l33 + 1)) {
+ fVec12[l33] = 0.0f;
+ }
+ for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) {
+ fRec32[l34] = 0.0f;
+ }
+ for (int l35 = 0; (l35 < 2); l35 = (l35 + 1)) {
+ fRec35[l35] = 0.0f;
+ }
+ for (int l36 = 0; (l36 < 8192); l36 = (l36 + 1)) {
+ fVec13[l36] = 0.0f;
+ }
+ for (int l37 = 0; (l37 < 2); l37 = (l37 + 1)) {
+ fRec34[l37] = 0.0f;
+ }
+ for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) {
+ fRec37[l38] = 0.0f;
+ }
+ for (int l39 = 0; (l39 < 8192); l39 = (l39 + 1)) {
+ fVec14[l39] = 0.0f;
+ }
+ for (int l40 = 0; (l40 < 2); l40 = (l40 + 1)) {
+ fRec36[l40] = 0.0f;
+ }
+ for (int l41 = 0; (l41 < 2); l41 = (l41 + 1)) {
+ fRec39[l41] = 0.0f;
+ }
+ for (int l42 = 0; (l42 < 8192); l42 = (l42 + 1)) {
+ fVec15[l42] = 0.0f;
+ }
+ for (int l43 = 0; (l43 < 2); l43 = (l43 + 1)) {
+ fRec38[l43] = 0.0f;
+ }
+ for (int l44 = 0; (l44 < 2); l44 = (l44 + 1)) {
+ fRec41[l44] = 0.0f;
+ }
+ for (int l45 = 0; (l45 < 8192); l45 = (l45 + 1)) {
+ fVec16[l45] = 0.0f;
+ }
+ for (int l46 = 0; (l46 < 2); l46 = (l46 + 1)) {
+ fRec40[l46] = 0.0f;
+ }
+ for (int l47 = 0; (l47 < 2); l47 = (l47 + 1)) {
+ fRec43[l47] = 0.0f;
+ }
+ for (int l48 = 0; (l48 < 8192); l48 = (l48 + 1)) {
+ fVec17[l48] = 0.0f;
+ }
+ for (int l49 = 0; (l49 < 2); l49 = (l49 + 1)) {
+ fRec42[l49] = 0.0f;
+ }
+ for (int l50 = 0; (l50 < 2); l50 = (l50 + 1)) {
+ fRec45[l50] = 0.0f;
+ }
+ for (int l51 = 0; (l51 < 8192); l51 = (l51 + 1)) {
+ fVec18[l51] = 0.0f;
+ }
+ for (int l52 = 0; (l52 < 2); l52 = (l52 + 1)) {
+ fRec44[l52] = 0.0f;
+ }
+ for (int l53 = 0; (l53 < 2); l53 = (l53 + 1)) {
+ fRec47[l53] = 0.0f;
+ }
+ for (int l54 = 0; (l54 < 8192); l54 = (l54 + 1)) {
+ fVec19[l54] = 0.0f;
+ }
+ for (int l55 = 0; (l55 < 2); l55 = (l55 + 1)) {
+ fRec46[l55] = 0.0f;
+ }
+ for (int l56 = 0; (l56 < 2048); l56 = (l56 + 1)) {
+ fVec20[l56] = 0.0f;
+ }
+ for (int l57 = 0; (l57 < 2); l57 = (l57 + 1)) {
+ fRec30[l57] = 0.0f;
+ }
+ for (int l58 = 0; (l58 < 2048); l58 = (l58 + 1)) {
+ fVec21[l58] = 0.0f;
+ }
+ for (int l59 = 0; (l59 < 2); l59 = (l59 + 1)) {
+ fRec28[l59] = 0.0f;
+ }
+ for (int l60 = 0; (l60 < 2048); l60 = (l60 + 1)) {
+ fVec22[l60] = 0.0f;
+ }
+ for (int l61 = 0; (l61 < 2); l61 = (l61 + 1)) {
+ fRec26[l61] = 0.0f;
+ }
+ for (int l62 = 0; (l62 < 1024); l62 = (l62 + 1)) {
+ fVec23[l62] = 0.0f;
+ }
+ for (int l63 = 0; (l63 < 2); l63 = (l63 + 1)) {
+ fRec24[l63] = 0.0f;
+ }
}
virtual void init(int sample_rate)
fRec24[0] = fVec23[((IOTA - iConst19) & 1023)];
float fRec25 = (0.0f - (0.5f * fTemp9));
output0[i] = FAUSTFLOAT(
- (fRec0[1] + ((fRec24[1] + (fRec25 + fRec1)) + (fSlow19 * fTemp0))));
+ (fRec0[1] + ((fRec24[1] + (fRec25 + fRec1)) + (fSlow19 * fTemp0))));
fRec9[1] = fRec9[0];
IOTA = (IOTA + 1);
fRec8[1] = fRec8[0];
#include "../jacktrip_globals.h"
#include "ui_about.h"
-#ifndef BUILD_TYPE
-#define BUILD_TYPE "";
+#ifdef BUILD_TYPE
+const QString About::s_buildType = QStringLiteral(BUILD_TYPE);
+#else
+const QString About::s_buildType = QLatin1String("");
#endif
-#ifndef BUILD_ID
-#define BUILD_ID "";
+#ifdef BUILD_ID
+const QString About::s_buildID = QStringLiteral(BUILD_ID);
+#else
+const QString About::s_buildID = QLatin1String("");
#endif
-const QString About::s_buildType = BUILD_TYPE;
-const QString About::s_buildID = BUILD_ID;
-
About::About(QWidget* parent) : QDialog(parent), m_ui(new Ui::About)
{
m_ui->setupUi(this);
- connect(m_ui->closeButton, &QPushButton::clicked, this, [=]() { this->done(0); });
+ connect(m_ui->closeButton, &QPushButton::clicked, this, [=]() {
+ this->done(0);
+ });
- m_ui->aboutLabel->setText(m_ui->aboutLabel->text().replace("%VERSION%", gVersion));
-#ifdef QT_OPENSOURCE
m_ui->aboutLabel->setText(
- m_ui->aboutLabel->text().replace("%LICENSE%", "This build of JackTrip is subject to LGPL license. "));
+ m_ui->aboutLabel->text().replace(QLatin1String("%VERSION%"), gVersion));
+#ifdef QT_OPENSOURCE
+ m_ui->aboutLabel->setText(m_ui->aboutLabel->text().replace(
+ QLatin1String("%LICENSE%"),
+ QLatin1String("This build of JackTrip is subject to LGPL license. ")));
#else
m_ui->aboutLabel->setText(m_ui->aboutLabel->text().replace("%LICENSE%", ""));
#endif
if (!s_buildType.isEmpty() || !s_buildID.isEmpty()) {
- QString buildString = "<br/>(";
+ QString buildString = QStringLiteral("<br/>(");
if (!s_buildType.isEmpty()) {
buildString.append(s_buildType);
if (!s_buildID.isEmpty()) {
- buildString.append(QString(", build %1").arg(s_buildID));
+ buildString.append(QStringLiteral(", build %1").arg(s_buildID));
}
} else {
- buildString.append(QString("Build %1").arg(s_buildID));
+ buildString.append(QStringLiteral("Build %1").arg(s_buildID));
}
buildString.append(")");
m_ui->aboutLabel->setText(
- m_ui->aboutLabel->text().replace("%BUILD%", buildString));
+ m_ui->aboutLabel->text().replace(QLatin1String("%BUILD%"), buildString));
} else {
- m_ui->aboutLabel->setText(m_ui->aboutLabel->text().replace("%BUILD%", ""));
+ m_ui->aboutLabel->setText(m_ui->aboutLabel->text().replace(
+ QLatin1String("%BUILD%"), QLatin1String("")));
}
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
m_ui->aboutImage->setPixmap(QPixmap(":/qjacktrip/about@2x.png"));
#endif
#include "messageDialog.h"
-#include "ui_messageDialog.h"
-#include <iostream>
-#include <QScrollBar>
#include <QMenu>
+#include <QScrollBar>
#include <QSettings>
+#include <iostream>
-MessageDialog::MessageDialog(QWidget* parent, QString windowFunction, quint32 streamCount)
+#include "ui_messageDialog.h"
+
+MessageDialog::MessageDialog(QWidget* parent, const QString& windowFunction,
+ quint32 streamCount)
: QDialog(parent)
, m_ui(new Ui::MessageDialog)
, m_outStreams(streamCount)
for (quint32 i = 0; i < streamCount; i++) {
m_outBufs[i].reset(new textbuf);
m_outStreams[i].reset(new std::ostream(m_outBufs.at(i).data()));
- connect(m_outBufs.at(i).data(), &textbuf::outputString, this, &MessageDialog::receiveOutput, Qt::QueuedConnection);
+ connect(m_outBufs.at(i).data(), &textbuf::outputString, this,
+ &MessageDialog::receiveOutput, Qt::QueuedConnection);
}
-
+
m_ui->messagesTextEdit->setContextMenuPolicy(Qt::CustomContextMenu);
- connect(m_ui->messagesTextEdit, &QPlainTextEdit::customContextMenuRequested, this, &MessageDialog::provideContextMenu);
+ connect(m_ui->messagesTextEdit, &QPlainTextEdit::customContextMenuRequested, this,
+ &MessageDialog::provideContextMenu);
m_ui->messagesTextEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
connect(this, &QDialog::rejected, this, &MessageDialog::savePosition);
-
+
if (!m_windowFunction.isEmpty()) {
setWindowTitle(m_windowFunction);
}
QDialog::showEvent(event);
if (!m_windowFunction.isEmpty()) {
QSettings settings;
- settings.beginGroup("Window");
+ settings.beginGroup(QStringLiteral("Window"));
QByteArray geometry = settings.value(m_windowFunction + "Geometry").toByteArray();
if (geometry.size() > 0) {
restoreGeometry(geometry);
QSharedPointer<std::ostream> MessageDialog::getOutputStream(int index)
{
- if (index >=0 && index < m_outStreams.size()) {
+ if (index >= 0 && index < m_outStreams.size()) {
return m_outStreams.at(index);
}
return QSharedPointer<std::ostream>();
}
-bool MessageDialog::setRelayStream(std::ostream *relay, int index)
+bool MessageDialog::setRelayStream(std::ostream* relay, int index)
{
- if (index >=0 && index < m_outBufs.size()) {
+ if (index >= 0 && index < m_outBufs.size()) {
m_outBufs.at(index)->setOutStream(relay);
}
return false;
void MessageDialog::receiveOutput(const QString& output)
{
// Automatically scroll if we're at the bottom of the text box.
- bool autoScroll = (m_ui->messagesTextEdit->verticalScrollBar()->value() == m_ui->messagesTextEdit->verticalScrollBar()->maximum());
+ bool autoScroll = (m_ui->messagesTextEdit->verticalScrollBar()->value()
+ == m_ui->messagesTextEdit->verticalScrollBar()->maximum());
// Make sure our cursor is at the end.
m_ui->messagesTextEdit->moveCursor(QTextCursor::End);
m_ui->messagesTextEdit->insertPlainText(output);
if (autoScroll) {
- m_ui->messagesTextEdit->verticalScrollBar()->setValue(m_ui->messagesTextEdit->verticalScrollBar()->maximum());
+ m_ui->messagesTextEdit->verticalScrollBar()->setValue(
+ m_ui->messagesTextEdit->verticalScrollBar()->maximum());
}
}
void MessageDialog::provideContextMenu()
{
// Add a custom context menu entry to clear the output.
- QMenu *menu = m_ui->messagesTextEdit->createStandardContextMenu();
- QAction *action = menu->addAction(QIcon::fromTheme("edit-delete"), "Clear");
+ QMenu* menu = m_ui->messagesTextEdit->createStandardContextMenu();
+ QAction* action = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-delete")),
+ QStringLiteral("Clear"));
connect(action, &QAction::triggered, this, &MessageDialog::clearOutput);
menu->exec(QCursor::pos());
}
{
if (!m_windowFunction.isEmpty()) {
QSettings settings;
- settings.beginGroup("Window");
+ settings.beginGroup(QStringLiteral("Window"));
settings.setValue(m_windowFunction + "Geometry", saveGeometry());
settings.endGroup();
}
}
-MessageDialog::~MessageDialog() {
+MessageDialog::~MessageDialog()
+{
if (isVisible()) {
savePosition();
}
#include <QScopedPointer>
#include <QSharedPointer>
#include <QVector>
+
#include "textbuf.h"
namespace Ui
Q_OBJECT
public:
- explicit MessageDialog(QWidget* parent = nullptr, QString windowFunction = "", quint32 streamCount = 1);
+ explicit MessageDialog(QWidget* parent = nullptr,
+ const QString& windowFunction = QLatin1String(""),
+ quint32 streamCount = 1);
~MessageDialog() override;
-
+
void showEvent(QShowEvent* event) override;
void closeEvent(QCloseEvent* event) override;
-
+
QSharedPointer<std::ostream> getOutputStream(int index = 0);
- bool setRelayStream(std::ostream *relay, int index = 0);
-
+ bool setRelayStream(std::ostream* relay, int index = 0);
+
public slots:
void clearOutput();
-
+
private slots:
void receiveOutput(const QString& output);
void provideContextMenu();
#include "weak_libjack.h"
#endif
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
#include "RtAudio.h"
#endif
, m_ui(new Ui::QJackTripVS)
#endif
, m_netManager(new QNetworkAccessManager(this))
- , m_statsDialog(new MessageDialog(this, "Stats"))
- , m_debugDialog(new MessageDialog(this, "Debug", 2))
+ , m_statsDialog(new MessageDialog(this, QStringLiteral("Stats")))
+ , m_debugDialog(new MessageDialog(this, QStringLiteral("Debug"), 2))
, m_realCout(std::cout.rdbuf())
, m_realCerr(std::cerr.rdbuf())
, m_jackTripRunning(false)
{
m_ui->setupUi(this);
- QCoreApplication::setOrganizationName("jacktrip");
- QCoreApplication::setOrganizationDomain("jacktrip.org");
- QCoreApplication::setApplicationName("JackTrip");
-
+ QCoreApplication::setOrganizationName(QStringLiteral("jacktrip"));
+ QCoreApplication::setOrganizationDomain(QStringLiteral("jacktrip.org"));
+ QCoreApplication::setApplicationName(QStringLiteral("JackTrip"));
+
// Set up our debug window, and relay everything to our real cout.
std::cout.rdbuf(m_debugDialog->getOutputStream()->rdbuf());
std::cerr.rdbuf(m_debugDialog->getOutputStream(1)->rdbuf());
About about(this);
about.exec();
});
+ connect(m_ui->autoPatchComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
+ this, [=]() {
+ if (m_ui->autoPatchComboBox->currentIndex() == CLIENTFOFI
+ || m_ui->autoPatchComboBox->currentIndex() == FULLMIX) {
+ m_ui->patchServerCheckBox->setEnabled(true);
+ } else {
+ m_ui->patchServerCheckBox->setEnabled(false);
+ }
+ });
connect(m_ui->authCheckBox, &QCheckBox::stateChanged, this, [=]() {
m_ui->usernameLabel->setEnabled(m_ui->authCheckBox->isChecked());
m_ui->usernameEdit->setEnabled(m_ui->authCheckBox->isChecked());
m_ui->autoQueueExplanationLabel->setEnabled(
m_ui->jitterCheckBox->isChecked() && m_ui->autoQueueCheckBox->isChecked());
if (m_ui->jitterCheckBox->isChecked() && m_ui->autoQueueCheckBox->isChecked()) {
- m_autoQueueIndicator.setText("Auto queue: enabled");
+ m_autoQueueIndicator.setText(QStringLiteral("Auto queue: enabled"));
} else {
- m_autoQueueIndicator.setText("Auto queue: disabled");
+ m_autoQueueIndicator.setText(QStringLiteral("Auto queue: disabled"));
}
});
connect(m_ui->broadcastCheckBox, &QCheckBox::stateChanged, this, [=]() {
m_ui->autoQueueExplanationLabel->setEnabled(
m_ui->jitterCheckBox->isChecked() && m_ui->autoQueueCheckBox->isChecked());
if (m_ui->jitterCheckBox->isChecked() && m_ui->autoQueueCheckBox->isChecked()) {
- m_autoQueueIndicator.setText("Auto queue: enabled");
+ m_autoQueueIndicator.setText(QStringLiteral("Auto queue: enabled"));
} else {
- m_autoQueueIndicator.setText("Auto queue: disabled");
+ m_autoQueueIndicator.setText(QStringLiteral("Auto queue: disabled"));
}
});
m_ui->outLimiterLabel->setEnabled(m_ui->outLimiterCheckBox->isChecked());
m_ui->outClientsSpinBox->setEnabled(m_ui->outLimiterCheckBox->isChecked());
});
- m_ui->autoPatchComboBox->setVisible(false);
- m_ui->autoPatchLabel->setVisible(false);
connect(m_netManager.data(), &QNetworkAccessManager::finished, this,
&QJackTrip::receivedIP);
// Use the ipify API to find our external IP address.
- m_netManager->get(QNetworkRequest(QUrl("https://api.ipify.org")));
- m_netManager->get(QNetworkRequest(QUrl("https://api6.ipify.org")));
- m_ui->statusBar->showMessage(QString("JackTrip version ").append(gVersion));
+ m_netManager->get(QNetworkRequest(QUrl(QStringLiteral("https://api.ipify.org"))));
+ m_netManager->get(QNetworkRequest(QUrl(QStringLiteral("https://api6.ipify.org"))));
+ m_ui->statusBar->showMessage(QStringLiteral("JackTrip version ").append(gVersion));
// Set up our interface for the default Client run mode.
//(loadSettings will take care of the UI in all other cases.)
m_ui->basePortLabel->setVisible(false);
m_ui->basePortSpinBox->setVisible(false);
- m_ui->upmixCheckBox->setVisible(false);
+ m_ui->autoPatchGroupBox->setVisible(false);
m_ui->requireAuthGroupBox->setVisible(false);
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
connect(m_ui->backendComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, [=](int index) {
if (index == 1) {
populateDeviceMenu(m_ui->outputDeviceComboBox, false);
});
#else
- int tabIndex = findTab("Audio Backend");
+ int tabIndex = findTab(QStringLiteral("Audio Backend"));
if (tabIndex != -1) {
m_ui->optionsTabWidget->removeTab(tabIndex);
}
int index = std::rand() % 4;
if (index < 3) {
labels.at(index)->setToolTip(m_ui->outZitarevLabel->toolTip());
- m_ui->outZitarevLabel->setToolTip("");
+ m_ui->outZitarevLabel->setToolTip(QLatin1String(""));
}
// Add an autoqueue indicator to the status bar.
m_ui->statusBar->addPermanentWidget(&m_autoQueueIndicator);
if (m_ui->jitterCheckBox->isChecked() && m_ui->autoQueueCheckBox->isChecked()) {
- m_autoQueueIndicator.setText("Auto queue: enabled");
+ m_autoQueueIndicator.setText(QStringLiteral("Auto queue: enabled"));
} else {
- m_autoQueueIndicator.setText("Auto queue: disabled");
+ m_autoQueueIndicator.setText(QStringLiteral("Auto queue: disabled"));
}
#ifdef USE_WEAK_JACK
// Check if Jack is actually available
if (have_libjack() != 0) {
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
m_ui->backendComboBox->setCurrentIndex(1);
m_ui->backendComboBox->setEnabled(false);
m_ui->backendLabel->setEnabled(false);
m_ui->typeComboBox->removeItem(HUB_SERVER);
QSettings settings;
- settings.beginGroup("Audio");
- if (!settings.value("HideJackWarning", false).toBool()) {
- QCheckBox* dontBugMe = new QCheckBox("Don't show this warning again");
+ settings.beginGroup(QStringLiteral("Audio"));
+ if (!settings.value(QStringLiteral("HideJackWarning"), false).toBool()) {
+ QCheckBox* dontBugMe =
+ new QCheckBox(QStringLiteral("Don't show this warning again"));
QMessageBox msgBox;
msgBox.setText(
"An installation of JACK was not found. Only the RtAudio\nbackend will "
"be available. (Hub Server mode is not\ncurrently supported in this "
"configuration.");
- msgBox.setWindowTitle("JACK Not Available");
+ msgBox.setWindowTitle(QStringLiteral("JACK Not Available"));
msgBox.setCheckBox(dontBugMe);
- QObject::connect(dontBugMe, &QCheckBox::stateChanged, this,
- [=]() { m_hideWarning = dontBugMe->isChecked(); });
+ QObject::connect(dontBugMe, &QCheckBox::stateChanged, this, [=]() {
+ m_hideWarning = dontBugMe->isChecked();
+ });
msgBox.exec();
- if (m_hideWarning) { settings.setValue("HideJackWarning", true); }
+ if (m_hideWarning) {
+ settings.setValue(QStringLiteral("HideJackWarning"), true);
+ }
}
settings.endGroup();
#else
"this.)");
msgBox.setWindowTitle("JACK Not Available");
msgBox.exec();
-#endif // __RT_AUDIO__
+#endif // RT_AUDIO
}
#endif // USE_WEAK_JACK
msgBox.setText(
"The GUI version of JackTrip currently\nignores any command line "
"options other\nthan the verbose option (-V).\n\nThis may change in future.");
- msgBox.setWindowTitle("Command line options");
+ msgBox.setWindowTitle(QStringLiteral("Command line options"));
msgBox.exec();
}
}
-void QJackTrip::setArgc(int argc) { m_argc = argc; }
+void QJackTrip::setArgc(int argc)
+{
+ m_argc = argc;
+}
void QJackTrip::processFinished()
{
return;
}
m_jackTripRunning = false;
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
m_noNap.enableNap();
#endif
m_ui->disconnectButton->setEnabled(false);
} else {
enableUi(true);
m_ui->connectButton->setEnabled(true);
- m_ui->statusBar->showMessage("JackTrip Processes Stopped", 2000);
+ m_ui->statusBar->showMessage(QStringLiteral("JackTrip Processes Stopped"), 2000);
}
}
void QJackTrip::processError(const QString& errorMessage)
{
QMessageBox msgBox;
- if (errorMessage == "Peer Stopped") {
+ if (errorMessage == QLatin1String("Peer Stopped")) {
// Report the other end quitting as a regular occurance rather than an error.
msgBox.setText(errorMessage);
- msgBox.setWindowTitle("Disconnected");
+ msgBox.setWindowTitle(QStringLiteral("Disconnected"));
} else {
- msgBox.setText(QString("Error: ").append(errorMessage));
- msgBox.setWindowTitle("Doh!");
+ msgBox.setText(QStringLiteral("Error: ").append(errorMessage));
+ msgBox.setWindowTitle(QStringLiteral("Doh!"));
}
msgBox.exec();
processFinished();
void QJackTrip::receivedConnectionFromPeer()
{
- m_ui->statusBar->showMessage("Received Connection from Peer!");
+ m_ui->statusBar->showMessage(QStringLiteral("Received Connection from Peer!"));
}
void QJackTrip::queueLengthChanged(int queueLength)
{
- m_autoQueueIndicator.setText(QString("Auto queue: %1").arg(queueLength));
+ m_autoQueueIndicator.setText(QStringLiteral("Auto queue: %1").arg(queueLength));
}
void QJackTrip::udpWaitingTooLong()
{
- m_ui->statusBar->showMessage("UDP waiting too long (more than 30ms)", 1000);
+ m_ui->statusBar->showMessage(QStringLiteral("UDP waiting too long (more than 30ms)"),
+ 1000);
}
void QJackTrip::chooseRunType(int index)
}
m_ui->remotePortSpinBox->setVisible(true);
m_ui->remotePortLabel->setVisible(true);
- m_ui->connectButton->setText("Connect");
- m_ui->disconnectButton->setText("Disconnect");
+ m_ui->connectButton->setText(QStringLiteral("Connect"));
+ m_ui->disconnectButton->setText(QStringLiteral("Disconnect"));
} else {
m_ui->addressComboBox->setEnabled(false);
m_ui->addressLabel->setEnabled(false);
m_ui->remotePortSpinBox->setVisible(false);
m_ui->remotePortLabel->setVisible(false);
- m_ui->connectButton->setText("Start");
- m_ui->disconnectButton->setText("Stop");
+ m_ui->connectButton->setText(QStringLiteral("Start"));
+ m_ui->disconnectButton->setText(QStringLiteral("Stop"));
m_ui->connectButton->setEnabled(true);
}
if (index == HUB_SERVER) {
m_ui->channelGroupBox->setVisible(false);
m_ui->timeoutCheckBox->setVisible(false);
- m_ui->autoPatchComboBox->setVisible(true);
- m_ui->autoPatchLabel->setVisible(true);
- m_ui->upmixCheckBox->setVisible(true);
+ m_ui->autoPatchGroupBox->setVisible(true);
m_ui->requireAuthGroupBox->setVisible(true);
advancedOptionsForHubServer(true);
- int index = findTab("Plugins");
+ int index = findTab(QStringLiteral("Plugins"));
if (index != -1) {
m_ui->optionsTabWidget->removeTab(index);
}
authFilesChanged();
-#ifdef __RT_AUDIO__
- index = findTab("Audio Backend");
+#ifdef RT_AUDIO
+ index = findTab(QStringLiteral("Audio Backend"));
if (index != -1) {
m_ui->optionsTabWidget->removeTab(index);
}
#endif
} else {
- m_ui->autoPatchComboBox->setVisible(false);
- m_ui->autoPatchLabel->setVisible(false);
- m_ui->upmixCheckBox->setVisible(false);
+ m_ui->autoPatchGroupBox->setVisible(false);
m_ui->requireAuthGroupBox->setVisible(false);
m_ui->channelGroupBox->setVisible(true);
m_ui->timeoutCheckBox->setVisible(true);
advancedOptionsForHubServer(false);
- if (findTab("Plugins") == -1) {
- m_ui->optionsTabWidget->addTab(m_ui->pluginsTab, "Plugins");
+ if (findTab(QStringLiteral("Plugins")) == -1) {
+ m_ui->optionsTabWidget->addTab(m_ui->pluginsTab, QStringLiteral("Plugins"));
}
-#ifdef __RT_AUDIO__
- if (findTab("Audio Backend") == -1) {
- m_ui->optionsTabWidget->insertTab(2, m_ui->backendTab, "Audio Backend");
+#ifdef RT_AUDIO
+ if (findTab(QStringLiteral("Audio Backend")) == -1) {
+ m_ui->optionsTabWidget->insertTab(2, m_ui->backendTab,
+ QStringLiteral("Audio Backend"));
}
#endif
}
{
// Make sure we check that JackTrip isn't running.
//(This also gets called when we save our recent address list on connecting to a
- //server.)
- if (m_jackTripRunning) { return; }
+ // server.)
+ if (m_jackTripRunning) {
+ return;
+ }
if (m_ui->typeComboBox->currentIndex() == P2P_CLIENT) {
m_ui->connectButton->setEnabled(!address.isEmpty());
} else if (m_ui->typeComboBox->currentIndex() == HUB_CLIENT) {
void QJackTrip::authFilesChanged()
{
- if (m_ui->typeComboBox->currentIndex() != HUB_SERVER) { return; }
+ if (m_ui->typeComboBox->currentIndex() != HUB_SERVER) {
+ return;
+ }
if (m_ui->requireAuthCheckBox->isChecked()
&& (m_ui->certEdit->text().isEmpty() || m_ui->keyEdit->text().isEmpty()
void QJackTrip::credentialsChanged()
{
- if (m_ui->typeComboBox->currentIndex() != HUB_CLIENT) { return; }
+ if (m_ui->typeComboBox->currentIndex() != HUB_CLIENT) {
+ return;
+ }
if (m_ui->authCheckBox->isChecked()
&& (m_ui->usernameEdit->text().isEmpty()
QString fileType;
QLineEdit* fileEdit;
if (sender == m_ui->certBrowse) {
- fileType = "Certificates (*.crt *.pem)";
+ fileType = QStringLiteral("Certificates (*.crt *.pem)");
fileEdit = m_ui->certEdit;
} else if (sender == m_ui->keyBrowse) {
- fileType = "Keys (*.key *.pem)";
+ fileType = QStringLiteral("Keys (*.key *.pem)");
fileEdit = m_ui->keyEdit;
} else {
- fileType = "";
+ fileType = QLatin1String("");
fileEdit = m_ui->credsEdit;
}
- QString fileName =
- QFileDialog::getOpenFileName(this, "Open File", m_lastPath, fileType);
+ QString fileName = QFileDialog::getOpenFileName(this, QStringLiteral("Open File"),
+ m_lastPath, fileType);
if (!fileName.isEmpty()) {
fileEdit->setText(fileName);
fileEdit->setFocus(Qt::OtherFocusReason);
{
QMutexLocker locker(&m_requestMutex);
// Check whether we're dealing with our IPv4 or IPv6 request.
- if (reply->url().host().startsWith("api6")) {
+ if (reply->url().host().startsWith(QLatin1String("api6"))) {
if (reply->error() == QNetworkReply::NoError) {
m_IPv6Address = QString(reply->readAll());
// Make sure this isn't just a repeat of our IPv4 address.
}
if (m_hasIPv4Reply) {
m_ui->ipLabel->setText(m_ui->ipLabel->text().append(
- QString("\n(IPv6: %1)").arg(m_IPv6Address)));
+ QStringLiteral("\n(IPv6: %1)").arg(m_IPv6Address)));
}
m_ui->ipLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
}
} else {
if (reply->error() != QNetworkReply::NoError) {
- m_ui->ipLabel->setText("Unable to determine external IP address.");
+ m_ui->ipLabel->setText(
+ QStringLiteral("Unable to determine external IP address."));
} else {
QByteArray address = reply->readAll();
- m_ui->ipLabel->setText(QString("External IP address: ").append(address));
+ m_ui->ipLabel->setText(
+ QStringLiteral("External IP address: ").append(address));
m_ui->ipLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
}
if (!m_IPv6Address.isEmpty()) {
- m_ui->ipLabel->setText(
- m_ui->ipLabel->text().append(QString("\n(IPv6: %1)").arg(m_IPv6Address)));
+ m_ui->ipLabel->setText(m_ui->ipLabel->text().append(
+ QStringLiteral("\n(IPv6: %1)").arg(m_IPv6Address)));
}
m_hasIPv4Reply = true;
}
m_ui->timeoutCheckBox->setChecked(false);*/
// Then advanced options
- m_ui->clientNameEdit->setText("");
- m_ui->remoteNameEdit->setText("");
+ m_ui->clientNameEdit->setText(QLatin1String(""));
+ m_ui->remoteNameEdit->setText(QLatin1String(""));
m_ui->localPortSpinBox->setValue(gDefaultPort);
m_ui->remotePortSpinBox->setValue(gDefaultPort);
m_ui->basePortSpinBox->setValue(61002);
m_ui->connectButton->setEnabled(false);
enableUi(false);
m_jackTripRunning = true;
-
+
if (gVerboseFlag) {
m_debugDialog->show();
}
m_udpHub.reset(new UdpHubListener(m_ui->localPortSpinBox->value(),
m_ui->basePortSpinBox->value()));
int hubConnectionMode = m_ui->autoPatchComboBox->currentIndex();
- if (hubConnectionMode > 2) {
+ if (hubConnectionMode > CLIENTFOFI) {
// Adjust for the RESERVEDMATRIX gap.
hubConnectionMode++;
}
+ if (m_ui->patchServerCheckBox->isChecked()) {
+ if (m_ui->autoPatchComboBox->currentIndex() == CLIENTFOFI) {
+ hubConnectionMode = JackTrip::SERVFOFI;
+ } else if (m_ui->autoPatchComboBox->currentIndex() == FULLMIX) {
+ hubConnectionMode = JackTrip::SERVFULLMIX;
+ }
+ }
m_udpHub->setHubPatch(hubConnectionMode);
m_udpHub->setStereoUpmix(m_ui->upmixCheckBox->isChecked());
}
if (m_ui->autoQueueCheckBox->isChecked()) {
m_udpHub->setBufferQueueLength(-(m_ui->autoQueueSpinBox->value()));
- m_autoQueueIndicator.setText("Auto queue: enabled");
+ m_autoQueueIndicator.setText(QStringLiteral("Auto queue: enabled"));
} else {
m_udpHub->setBufferQueueLength(m_ui->queueLengthSpinBox->value());
}
&QJackTrip::processError, Qt::QueuedConnection);
m_ui->disconnectButton->setEnabled(true);
m_udpHub->start();
- m_ui->statusBar->showMessage("Hub Server Started");
+ m_ui->statusBar->showMessage(QStringLiteral("Hub Server Started"));
} else {
JackTrip::jacktripModeT jackTripMode;
if (m_ui->typeComboBox->currentIndex() == P2P_CLIENT) {
m_jackTrip->setUnderRunMode(JackTrip::ZEROS);
}
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
if (m_ui->backendComboBox->currentIndex() == 1) {
m_jackTrip->setAudiointerfaceMode(JackTrip::RTAUDIO);
m_jackTrip->setSampleRate(
m_jackTrip->setAudioBufferSizeInSamples(
m_ui->bufferSizeComboBox->currentText().toInt());
// we assume that first entry is "(default)"
- if(m_ui->inputDeviceComboBox->currentIndex() == 0) {
+ if (m_ui->inputDeviceComboBox->currentIndex() == 0) {
m_jackTrip->setInputDevice("");
} else {
m_jackTrip->setInputDevice(
- m_ui->inputDeviceComboBox->currentText().toStdString());
+ m_ui->inputDeviceComboBox->currentText().toStdString());
}
- if(m_ui->outputDeviceComboBox->currentIndex() == 0) {
+ if (m_ui->outputDeviceComboBox->currentIndex() == 0) {
m_jackTrip->setOutputDevice("");
} else {
m_jackTrip->setOutputDevice(
- m_ui->outputDeviceComboBox->currentText().toStdString());
+ m_ui->outputDeviceComboBox->currentText().toStdString());
}
}
#endif
}
if (m_ui->autoQueueCheckBox->isChecked()) {
m_jackTrip->setBufferQueueLength(-(m_ui->autoQueueSpinBox->value()));
- m_autoQueueIndicator.setText("Auto queue: enabled");
+ m_autoQueueIndicator.setText(QStringLiteral("Auto queue: enabled"));
}
} else {
m_jackTrip->setBufferStrategy(-1);
// Set peer address in client mode
if (jackTripMode == JackTrip::CLIENT
|| jackTripMode == JackTrip::CLIENTTOPINGSERVER) {
- m_jackTrip->setPeerAddress(m_ui->addressComboBox->currentText().trimmed());
+ m_jackTrip->setPeerAddress(
+ m_ui->addressComboBox->currentText().trimmed());
if (jackTripMode == JackTrip::CLIENTTOPINGSERVER
&& !m_ui->remoteNameEdit->text().isEmpty()) {
m_jackTrip->setRemoteClientName(m_ui->remoteNameEdit->text());
&QJackTrip::udpWaitingTooLong, Qt::QueuedConnection);
QObject::connect(m_jackTrip.data(), &JackTrip::signalQueueLengthChanged, this,
&QJackTrip::queueLengthChanged, Qt::QueuedConnection);
- m_ui->statusBar->showMessage("Waiting for Peer...");
+ m_ui->statusBar->showMessage(QStringLiteral("Waiting for Peer..."));
m_ui->disconnectButton->setEnabled(true);
#ifdef WAIRTOHUB // WAIR
m_jackTrip->startProcess(
} catch (const std::exception& e) {
// Let the user know what our exception was.
QMessageBox msgBox;
- msgBox.setText(QString("Error: ").append(e.what()));
- msgBox.setWindowTitle("Doh!");
+ msgBox.setText(QStringLiteral("Error: ").append(e.what()));
+ msgBox.setWindowTitle(QStringLiteral("Doh!"));
msgBox.exec();
m_jackTripRunning = false;
// Add the address to our server history.
QString serverAddress = m_ui->addressComboBox->currentText().trimmed();
int serverIndex = m_ui->addressComboBox->findText(serverAddress);
- if (serverIndex != -1) { m_ui->addressComboBox->removeItem(serverIndex); }
+ if (serverIndex != -1) {
+ m_ui->addressComboBox->removeItem(serverIndex);
+ }
m_ui->addressComboBox->insertItem(0, serverAddress);
m_ui->addressComboBox->setCurrentIndex(0);
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
m_noNap.disableNap();
#endif
}
void QJackTrip::exit()
{
// Only run this once.
- if (m_isExiting) { return; }
+ if (m_isExiting) {
+ return;
+ }
m_isExiting = true;
m_ui->exitButton->setEnabled(false);
saveSettings();
{
// Function to migrate settings for users who previously had QJackTrip installed.
QSettings settings;
- if (settings.value("Migrated", false).toBool()) { return; }
-#ifdef __MAC_OSX__
- QSettings oldSettings("psi-borg.org", "QJackTrip");
+ if (settings.value(QStringLiteral("Migrated"), false).toBool()) {
+ return;
+ }
+#ifdef __APPLE__
+ QSettings oldSettings(QStringLiteral("psi-borg.org"), QStringLiteral("QJackTrip"));
#else
- QSettings oldSettings("psi-borg", "QJackTrip");
+ QSettings oldSettings(QStringLiteral("psi-borg"), QStringLiteral("QJackTrip"));
#endif
QStringList keys = oldSettings.allKeys();
for (int i = 0; i < keys.size(); i++) {
settings.setValue(keys.at(i), oldSettings.value(keys.at(i), QVariant()));
}
- settings.setValue("Migrated", true);
+ settings.setValue(QStringLiteral("Migrated"), true);
}
void QJackTrip::loadSettings()
{
QSettings settings;
- m_ui->typeComboBox->setCurrentIndex(settings.value("RunMode", 2).toInt());
+ m_ui->typeComboBox->setCurrentIndex(
+ settings.value(QStringLiteral("RunMode"), 2).toInt());
// Migrate to separate send and receive channel numbers.
- int oldChannelSetting = settings.value("Channels", -1).toInt();
+ int oldChannelSetting = settings.value(QStringLiteral("Channels"), -1).toInt();
if (oldChannelSetting != -1) {
m_ui->channelSendSpinBox->setValue(oldChannelSetting);
m_ui->channelRecvSpinBox->setValue(oldChannelSetting);
- settings.remove("Channels");
+ settings.remove(QStringLiteral("Channels"));
} else {
m_ui->channelSendSpinBox->setValue(
- settings.value("ChannelsSend", gDefaultNumInChannels).toInt());
+ settings.value(QStringLiteral("ChannelsSend"), gDefaultNumInChannels)
+ .toInt());
m_ui->channelRecvSpinBox->setValue(
- settings.value("ChannelsRecv", gDefaultNumOutChannels).toInt());
+ settings.value(QStringLiteral("ChannelsRecv"), gDefaultNumOutChannels)
+ .toInt());
}
- m_ui->autoPatchComboBox->setCurrentIndex(settings.value("AutoPatchMode", 0).toInt());
- m_ui->upmixCheckBox->setChecked(settings.value("StereoUpmix", false).toBool());
- m_ui->zeroCheckBox->setChecked(settings.value("ZeroUnderrun", false).toBool());
- m_ui->timeoutCheckBox->setChecked(settings.value("Timeout", false).toBool());
- m_ui->clientNameEdit->setText(settings.value("ClientName", "").toString());
- m_ui->remoteNameEdit->setText(settings.value("RemoteName", "").toString());
- m_ui->localPortSpinBox->setValue(settings.value("LocalPort", gDefaultPort).toInt());
- m_ui->remotePortSpinBox->setValue(settings.value("RemotePort", gDefaultPort).toInt());
- m_ui->basePortSpinBox->setValue(settings.value("BasePort", 61002).toInt());
+ m_ui->autoPatchComboBox->setCurrentIndex(
+ settings.value(QStringLiteral("AutoPatchMode"), 0).toInt());
+ m_ui->patchServerCheckBox->setChecked(
+ settings.value(QStringLiteral("PatchIncludesServer"), false).toBool());
+ m_ui->upmixCheckBox->setChecked(
+ settings.value(QStringLiteral("StereoUpmix"), false).toBool());
+ m_ui->zeroCheckBox->setChecked(
+ settings.value(QStringLiteral("ZeroUnderrun"), false).toBool());
+ m_ui->timeoutCheckBox->setChecked(
+ settings.value(QStringLiteral("Timeout"), false).toBool());
+ m_ui->clientNameEdit->setText(
+ settings.value(QStringLiteral("ClientName"), "").toString());
+ m_ui->remoteNameEdit->setText(
+ settings.value(QStringLiteral("RemoteName"), "").toString());
+ m_ui->localPortSpinBox->setValue(
+ settings.value(QStringLiteral("LocalPort"), gDefaultPort).toInt());
+ m_ui->remotePortSpinBox->setValue(
+ settings.value(QStringLiteral("RemotePort"), gDefaultPort).toInt());
+ m_ui->basePortSpinBox->setValue(
+ settings.value(QStringLiteral("BasePort"), 61002).toInt());
m_ui->queueLengthSpinBox->setValue(
- settings.value("QueueLength", gDefaultQueueLength).toInt());
+ settings.value(QStringLiteral("QueueLength"), gDefaultQueueLength).toInt());
m_ui->redundancySpinBox->setValue(
- settings.value("Redundancy", gDefaultRedundancy).toInt());
- m_ui->resolutionComboBox->setCurrentIndex(settings.value("Resolution", 1).toInt());
- m_ui->connectAudioCheckBox->setChecked(settings.value("ConnectAudio", true).toBool());
- m_ui->realTimeCheckBox->setChecked(settings.value("RTNetworking", true).toBool());
+ settings.value(QStringLiteral("Redundancy"), gDefaultRedundancy).toInt());
+ m_ui->resolutionComboBox->setCurrentIndex(
+ settings.value(QStringLiteral("Resolution"), 1).toInt());
+ m_ui->connectAudioCheckBox->setChecked(
+ settings.value(QStringLiteral("ConnectAudio"), true).toBool());
+ m_ui->realTimeCheckBox->setChecked(
+ settings.value(QStringLiteral("RTNetworking"), true).toBool());
// This may have been set by the command line, so don't overwrite if that's the case.
- m_ui->verboseCheckBox->setChecked(gVerboseFlag || settings.value("Debug", 0).toBool());
- m_lastPath = settings.value("LastPath", QDir::homePath()).toString();
+ m_ui->verboseCheckBox->setChecked(
+ gVerboseFlag || settings.value(QStringLiteral("Debug"), 0).toBool());
+ m_lastPath = settings.value(QStringLiteral("LastPath"), QDir::homePath()).toString();
- settings.beginGroup("RecentServers");
+ settings.beginGroup(QStringLiteral("RecentServers"));
for (int i = 1; i <= 5; i++) {
- QString address = settings.value(QString("Server%1").arg(i), "").toString();
- if (!address.isEmpty()) { m_ui->addressComboBox->addItem(address); }
+ QString address =
+ settings.value(QStringLiteral("Server%1").arg(i), "").toString();
+ if (!address.isEmpty()) {
+ m_ui->addressComboBox->addItem(address);
+ }
}
settings.endGroup();
// Need to get this here so it isn't overwritten by the previous section.
- m_ui->addressComboBox->setCurrentText(settings.value("LastAddress", "").toString());
+ m_ui->addressComboBox->setCurrentText(
+ settings.value(QStringLiteral("LastAddress"), "").toString());
-#ifdef __RT_AUDIO__
- settings.beginGroup("Audio");
- m_ui->backendComboBox->setCurrentIndex(settings.value("Backend", 0).toInt());
+#ifdef RT_AUDIO
+ settings.beginGroup(QStringLiteral("Audio"));
+ m_ui->backendComboBox->setCurrentIndex(
+ settings.value(QStringLiteral("Backend"), 0).toInt());
m_ui->sampleRateComboBox->setCurrentText(
- settings.value("SampleRate", "48000").toString());
+ settings.value(QStringLiteral("SampleRate"), "48000").toString());
m_ui->bufferSizeComboBox->setCurrentText(
- settings.value("BufferSize", "128").toString());
+ settings.value(QStringLiteral("BufferSize"), "128").toString());
// update device list and set the device
populateDeviceMenu(m_ui->inputDeviceComboBox, true);
- auto inDevice = settings.value("InputDevice").toString();
- if(!inDevice.isEmpty()) {
+ auto inDevice = settings.value(QStringLiteral("InputDevice")).toString();
+ if (!inDevice.isEmpty()) {
m_ui->inputDeviceComboBox->setCurrentText(inDevice);
}
populateDeviceMenu(m_ui->outputDeviceComboBox, false);
- auto outDevice = settings.value("OutputDevice").toString();
- if(!outDevice.isEmpty()) {
+ auto outDevice = settings.value(QStringLiteral("OutputDevice")).toString();
+ if (!outDevice.isEmpty()) {
m_ui->outputDeviceComboBox->setCurrentText(outDevice);
}
settings.endGroup();
#endif
- settings.beginGroup("Auth");
- m_ui->requireAuthCheckBox->setChecked(settings.value("Require", false).toBool());
- m_ui->certEdit->setText(settings.value("CertFile", "").toString());
- m_ui->keyEdit->setText(settings.value("KeyFile", "").toString());
- m_ui->credsEdit->setText(settings.value("CredsFile", "").toString());
- m_ui->authCheckBox->setChecked(settings.value("Use", false).toBool());
- m_ui->usernameEdit->setText(settings.value("Username", "").toString());
+ settings.beginGroup(QStringLiteral("Auth"));
+ m_ui->requireAuthCheckBox->setChecked(
+ settings.value(QStringLiteral("Require"), false).toBool());
+ m_ui->certEdit->setText(settings.value(QStringLiteral("CertFile"), "").toString());
+ m_ui->keyEdit->setText(settings.value(QStringLiteral("KeyFile"), "").toString());
+ m_ui->credsEdit->setText(settings.value(QStringLiteral("CredsFile"), "").toString());
+ m_ui->authCheckBox->setChecked(settings.value(QStringLiteral("Use"), false).toBool());
+ m_ui->usernameEdit->setText(
+ settings.value(QStringLiteral("Username"), "").toString());
settings.endGroup();
- settings.beginGroup("IOStats");
- m_ui->ioStatsCheckBox->setChecked(settings.value("Display", false).toBool());
- m_ui->ioStatsSpinBox->setValue(settings.value("ReportingInterval", 1).toInt());
+ settings.beginGroup(QStringLiteral("IOStats"));
+ m_ui->ioStatsCheckBox->setChecked(
+ settings.value(QStringLiteral("Display"), false).toBool());
+ m_ui->ioStatsSpinBox->setValue(
+ settings.value(QStringLiteral("ReportingInterval"), 1).toInt());
settings.endGroup();
- settings.beginGroup("JitterBuffer");
- bool jitterAnnounce = settings.value("JitterAnnounce", false).toBool();
- if (!jitterAnnounce && !settings.value("Enabled", true).toBool()) {
+ settings.beginGroup(QStringLiteral("JitterBuffer"));
+ bool jitterAnnounce =
+ settings.value(QStringLiteral("JitterAnnounce"), false).toBool();
+ if (!jitterAnnounce && !settings.value(QStringLiteral("Enabled"), true).toBool()) {
QMessageBox msgBox;
msgBox.setText(
"From this build onwards, the new jitter buffer is being enabled by default. "
"You can turn it off in the Jitter Buffer settings tab.");
- msgBox.setWindowTitle("Jitter Buffer");
+ msgBox.setWindowTitle(QStringLiteral("Jitter Buffer"));
msgBox.exec();
- settings.setValue("Enabled", true);
+ settings.setValue(QStringLiteral("Enabled"), true);
}
- settings.setValue("JitterAnnounce", true);
- m_ui->jitterCheckBox->setChecked(settings.value("Enabled", true).toBool());
- m_ui->broadcastCheckBox->setChecked(settings.value("Broadcast", false).toBool());
+ settings.setValue(QStringLiteral("JitterAnnounce"), true);
+ m_ui->jitterCheckBox->setChecked(
+ settings.value(QStringLiteral("Enabled"), true).toBool());
+ m_ui->broadcastCheckBox->setChecked(
+ settings.value(QStringLiteral("Broadcast"), false).toBool());
m_ui->broadcastQueueSpinBox->setValue(
- settings.value("BroadcastLength", gDefaultQueueLength * 2).toInt());
- m_ui->bufferStrategyComboBox->setCurrentIndex(settings.value("Strategy", 1).toInt()
- - 1);
- m_ui->autoQueueCheckBox->setChecked(settings.value("AutoQueue", true).toBool());
- m_ui->autoQueueSpinBox->setValue(settings.value("TuningParameter", 500).toInt());
+ settings.value(QStringLiteral("BroadcastLength"), gDefaultQueueLength * 2)
+ .toInt());
+ m_ui->bufferStrategyComboBox->setCurrentIndex(
+ settings.value(QStringLiteral("Strategy"), 1).toInt() - 1);
+ m_ui->autoQueueCheckBox->setChecked(
+ settings.value(QStringLiteral("AutoQueue"), true).toBool());
+ m_ui->autoQueueSpinBox->setValue(
+ settings.value(QStringLiteral("TuningParameter"), 500).toInt());
settings.endGroup();
- settings.beginGroup("InPlugins");
- m_ui->inFreeverbCheckBox->setChecked(settings.value("Freeverb", false).toBool());
- m_ui->inFreeverbWetnessSlider->setValue(settings.value("FreeverbWetness", 0).toInt());
- m_ui->inZitarevCheckBox->setChecked(settings.value("Zitarev", false).toBool());
- m_ui->inZitarevWetnessSlider->setValue(settings.value("ZitarevWetness", 0).toInt());
- m_ui->inCompressorCheckBox->setChecked(settings.value("Compressor", false).toBool());
- m_ui->inLimiterCheckBox->setChecked(settings.value("Limiter", false).toBool());
+ settings.beginGroup(QStringLiteral("InPlugins"));
+ m_ui->inFreeverbCheckBox->setChecked(
+ settings.value(QStringLiteral("Freeverb"), false).toBool());
+ m_ui->inFreeverbWetnessSlider->setValue(
+ settings.value(QStringLiteral("FreeverbWetness"), 0).toInt());
+ m_ui->inZitarevCheckBox->setChecked(
+ settings.value(QStringLiteral("Zitarev"), false).toBool());
+ m_ui->inZitarevWetnessSlider->setValue(
+ settings.value(QStringLiteral("ZitarevWetness"), 0).toInt());
+ m_ui->inCompressorCheckBox->setChecked(
+ settings.value(QStringLiteral("Compressor"), false).toBool());
+ m_ui->inLimiterCheckBox->setChecked(
+ settings.value(QStringLiteral("Limiter"), false).toBool());
settings.endGroup();
- settings.beginGroup("OutPlugins");
- m_ui->outFreeverbCheckBox->setChecked(settings.value("Freeverb", false).toBool());
+ settings.beginGroup(QStringLiteral("OutPlugins"));
+ m_ui->outFreeverbCheckBox->setChecked(
+ settings.value(QStringLiteral("Freeverb"), false).toBool());
m_ui->outFreeverbWetnessSlider->setValue(
- settings.value("FreeverbWetness", 0).toInt());
- m_ui->outZitarevCheckBox->setChecked(settings.value("Zitarev", false).toBool());
- m_ui->outZitarevWetnessSlider->setValue(settings.value("ZitarevWetness", 0).toInt());
- m_ui->outCompressorCheckBox->setChecked(settings.value("Compressor", false).toBool());
- m_ui->outLimiterCheckBox->setChecked(settings.value("Limiter", false).toBool());
- m_ui->outClientsSpinBox->setValue(settings.value("Clients", 1).toInt());
+ settings.value(QStringLiteral("FreeverbWetness"), 0).toInt());
+ m_ui->outZitarevCheckBox->setChecked(
+ settings.value(QStringLiteral("Zitarev"), false).toBool());
+ m_ui->outZitarevWetnessSlider->setValue(
+ settings.value(QStringLiteral("ZitarevWetness"), 0).toInt());
+ m_ui->outCompressorCheckBox->setChecked(
+ settings.value(QStringLiteral("Compressor"), false).toBool());
+ m_ui->outLimiterCheckBox->setChecked(
+ settings.value(QStringLiteral("Limiter"), false).toBool());
+ m_ui->outClientsSpinBox->setValue(
+ settings.value(QStringLiteral("Clients"), 1).toInt());
settings.endGroup();
- settings.beginGroup("Window");
- QByteArray geometry = settings.value("Geometry").toByteArray();
+ settings.beginGroup(QStringLiteral("Window"));
+ QByteArray geometry = settings.value(QStringLiteral("Geometry")).toByteArray();
if (geometry.size() > 0) {
restoreGeometry(geometry);
} else {
void QJackTrip::saveSettings()
{
QSettings settings;
- settings.setValue("RunMode", m_ui->typeComboBox->currentIndex());
- settings.setValue("LastAddress", m_ui->addressComboBox->currentText());
- settings.setValue("ChannelsSend", m_ui->channelSendSpinBox->value());
- settings.setValue("ChannelsRecv", m_ui->channelRecvSpinBox->value());
- settings.setValue("AutoPatchMode", m_ui->autoPatchComboBox->currentIndex());
- settings.setValue("StereoUpmix", m_ui->upmixCheckBox->isChecked());
- settings.setValue("ZeroUnderrun", m_ui->zeroCheckBox->isChecked());
- settings.setValue("Timeout", m_ui->timeoutCheckBox->isChecked());
- settings.setValue("ClientName", m_ui->clientNameEdit->text());
- settings.setValue("RemoteName", m_ui->remoteNameEdit->text());
- settings.setValue("LocalPort", m_ui->localPortSpinBox->value());
- settings.setValue("RemotePort", m_ui->remotePortSpinBox->value());
- settings.setValue("BasePort", m_ui->basePortSpinBox->value());
- settings.setValue("QueueLength", m_ui->queueLengthSpinBox->value());
- settings.setValue("Redundancy", m_ui->redundancySpinBox->value());
- settings.setValue("Resolution", m_ui->resolutionComboBox->currentIndex());
- settings.setValue("ConnectAudio", m_ui->connectAudioCheckBox->isChecked());
- settings.setValue("RTNetworking", m_ui->realTimeCheckBox->isChecked());
- settings.setValue("Debug", m_ui->verboseCheckBox->isChecked());
- settings.setValue("LastPath", m_lastPath);
-
- settings.beginGroup("RecentServers");
+ settings.setValue(QStringLiteral("RunMode"), m_ui->typeComboBox->currentIndex());
+ settings.setValue(QStringLiteral("LastAddress"),
+ m_ui->addressComboBox->currentText());
+ settings.setValue(QStringLiteral("ChannelsSend"), m_ui->channelSendSpinBox->value());
+ settings.setValue(QStringLiteral("ChannelsRecv"), m_ui->channelRecvSpinBox->value());
+ settings.setValue(QStringLiteral("AutoPatchMode"),
+ m_ui->autoPatchComboBox->currentIndex());
+ settings.setValue(QStringLiteral("PatchIncludesServer"),
+ m_ui->patchServerCheckBox->isChecked());
+ settings.setValue(QStringLiteral("StereoUpmix"), m_ui->upmixCheckBox->isChecked());
+ settings.setValue(QStringLiteral("ZeroUnderrun"), m_ui->zeroCheckBox->isChecked());
+ settings.setValue(QStringLiteral("Timeout"), m_ui->timeoutCheckBox->isChecked());
+ settings.setValue(QStringLiteral("ClientName"), m_ui->clientNameEdit->text());
+ settings.setValue(QStringLiteral("RemoteName"), m_ui->remoteNameEdit->text());
+ settings.setValue(QStringLiteral("LocalPort"), m_ui->localPortSpinBox->value());
+ settings.setValue(QStringLiteral("RemotePort"), m_ui->remotePortSpinBox->value());
+ settings.setValue(QStringLiteral("BasePort"), m_ui->basePortSpinBox->value());
+ settings.setValue(QStringLiteral("QueueLength"), m_ui->queueLengthSpinBox->value());
+ settings.setValue(QStringLiteral("Redundancy"), m_ui->redundancySpinBox->value());
+ settings.setValue(QStringLiteral("Resolution"),
+ m_ui->resolutionComboBox->currentIndex());
+ settings.setValue(QStringLiteral("ConnectAudio"),
+ m_ui->connectAudioCheckBox->isChecked());
+ settings.setValue(QStringLiteral("RTNetworking"),
+ m_ui->realTimeCheckBox->isChecked());
+ settings.setValue(QStringLiteral("Debug"), m_ui->verboseCheckBox->isChecked());
+ settings.setValue(QStringLiteral("LastPath"), m_lastPath);
+
+ settings.beginGroup(QStringLiteral("RecentServers"));
for (int i = 0; i < m_ui->addressComboBox->count(); i++) {
- settings.setValue(QString("Server%1").arg(i + 1),
+ settings.setValue(QStringLiteral("Server%1").arg(i + 1),
m_ui->addressComboBox->itemText(i));
}
settings.endGroup();
-#ifdef __RT_AUDIO__
- settings.beginGroup("Audio");
- settings.setValue("Backend", m_ui->backendComboBox->currentIndex());
- settings.setValue("SampleRate", m_ui->sampleRateComboBox->currentText());
- settings.setValue("BufferSize", m_ui->bufferSizeComboBox->currentText());
- settings.setValue("InputDevice", m_ui->inputDeviceComboBox->currentText());
- settings.setValue("OutputDevice", m_ui->outputDeviceComboBox->currentText());
+#ifdef RT_AUDIO
+ settings.beginGroup(QStringLiteral("Audio"));
+ settings.setValue(QStringLiteral("Backend"), m_ui->backendComboBox->currentIndex());
+ settings.setValue(QStringLiteral("SampleRate"),
+ m_ui->sampleRateComboBox->currentText());
+ settings.setValue(QStringLiteral("BufferSize"),
+ m_ui->bufferSizeComboBox->currentText());
+ settings.setValue(QStringLiteral("InputDevice"),
+ m_ui->inputDeviceComboBox->currentText());
+ settings.setValue(QStringLiteral("OutputDevice"),
+ m_ui->outputDeviceComboBox->currentText());
settings.endGroup();
#endif
- settings.beginGroup("Auth");
- settings.setValue("Require", m_ui->requireAuthCheckBox->isChecked());
- settings.setValue("CertFile", m_ui->certEdit->text());
- settings.setValue("KeyFile", m_ui->keyEdit->text());
- settings.setValue("CredsFile", m_ui->credsEdit->text());
- settings.setValue("Use", m_ui->authCheckBox->isChecked());
- settings.setValue("Username", m_ui->usernameEdit->text());
+ settings.beginGroup(QStringLiteral("Auth"));
+ settings.setValue(QStringLiteral("Require"), m_ui->requireAuthCheckBox->isChecked());
+ settings.setValue(QStringLiteral("CertFile"), m_ui->certEdit->text());
+ settings.setValue(QStringLiteral("KeyFile"), m_ui->keyEdit->text());
+ settings.setValue(QStringLiteral("CredsFile"), m_ui->credsEdit->text());
+ settings.setValue(QStringLiteral("Use"), m_ui->authCheckBox->isChecked());
+ settings.setValue(QStringLiteral("Username"), m_ui->usernameEdit->text());
settings.endGroup();
- settings.beginGroup("IOStats");
- settings.setValue("Display", m_ui->ioStatsCheckBox->isChecked());
- settings.setValue("ReportingInterval", m_ui->ioStatsSpinBox->value());
+ settings.beginGroup(QStringLiteral("IOStats"));
+ settings.setValue(QStringLiteral("Display"), m_ui->ioStatsCheckBox->isChecked());
+ settings.setValue(QStringLiteral("ReportingInterval"), m_ui->ioStatsSpinBox->value());
settings.endGroup();
- settings.beginGroup("JitterBuffer");
- settings.setValue("Enabled", m_ui->jitterCheckBox->isChecked());
- settings.setValue("Broadcast", m_ui->broadcastCheckBox->isChecked());
- settings.setValue("BroadcastLength", m_ui->broadcastQueueSpinBox->value());
- settings.setValue("Strategy", m_ui->bufferStrategyComboBox->currentIndex() + 1);
- settings.setValue("AutoQueue", m_ui->autoQueueCheckBox->isChecked());
- settings.setValue("TuningParameter", m_ui->autoQueueSpinBox->value());
+ settings.beginGroup(QStringLiteral("JitterBuffer"));
+ settings.setValue(QStringLiteral("Enabled"), m_ui->jitterCheckBox->isChecked());
+ settings.setValue(QStringLiteral("Broadcast"), m_ui->broadcastCheckBox->isChecked());
+ settings.setValue(QStringLiteral("BroadcastLength"),
+ m_ui->broadcastQueueSpinBox->value());
+ settings.setValue(QStringLiteral("Strategy"),
+ m_ui->bufferStrategyComboBox->currentIndex() + 1);
+ settings.setValue(QStringLiteral("AutoQueue"), m_ui->autoQueueCheckBox->isChecked());
+ settings.setValue(QStringLiteral("TuningParameter"), m_ui->autoQueueSpinBox->value());
settings.endGroup();
- settings.beginGroup("InPlugins");
- settings.setValue("Freeverb", m_ui->inFreeverbCheckBox->isChecked());
- settings.setValue("FreeverbWetness", m_ui->inFreeverbWetnessSlider->value());
- settings.setValue("Zitarev", m_ui->inZitarevCheckBox->isChecked());
- settings.setValue("ZitarevWetness", m_ui->inZitarevWetnessSlider->value());
- settings.setValue("Compressor", m_ui->inCompressorCheckBox->isChecked());
- settings.setValue("Limiter", m_ui->inLimiterCheckBox->isChecked());
+ settings.beginGroup(QStringLiteral("InPlugins"));
+ settings.setValue(QStringLiteral("Freeverb"), m_ui->inFreeverbCheckBox->isChecked());
+ settings.setValue(QStringLiteral("FreeverbWetness"),
+ m_ui->inFreeverbWetnessSlider->value());
+ settings.setValue(QStringLiteral("Zitarev"), m_ui->inZitarevCheckBox->isChecked());
+ settings.setValue(QStringLiteral("ZitarevWetness"),
+ m_ui->inZitarevWetnessSlider->value());
+ settings.setValue(QStringLiteral("Compressor"),
+ m_ui->inCompressorCheckBox->isChecked());
+ settings.setValue(QStringLiteral("Limiter"), m_ui->inLimiterCheckBox->isChecked());
settings.endGroup();
- settings.beginGroup("OutPlugins");
- settings.setValue("Freeverb", m_ui->outFreeverbCheckBox->isChecked());
- settings.setValue("FreeverbWetness", m_ui->outFreeverbWetnessSlider->value());
- settings.setValue("Zitarev", m_ui->outZitarevCheckBox->isChecked());
- settings.setValue("ZitarevWetness", m_ui->outZitarevWetnessSlider->value());
- settings.setValue("Compressor", m_ui->outCompressorCheckBox->isChecked());
- settings.setValue("Limiter", m_ui->outLimiterCheckBox->isChecked());
- settings.setValue("Clients", m_ui->outClientsSpinBox->value());
+ settings.beginGroup(QStringLiteral("OutPlugins"));
+ settings.setValue(QStringLiteral("Freeverb"), m_ui->outFreeverbCheckBox->isChecked());
+ settings.setValue(QStringLiteral("FreeverbWetness"),
+ m_ui->outFreeverbWetnessSlider->value());
+ settings.setValue(QStringLiteral("Zitarev"), m_ui->outZitarevCheckBox->isChecked());
+ settings.setValue(QStringLiteral("ZitarevWetness"),
+ m_ui->outZitarevWetnessSlider->value());
+ settings.setValue(QStringLiteral("Compressor"),
+ m_ui->outCompressorCheckBox->isChecked());
+ settings.setValue(QStringLiteral("Limiter"), m_ui->outLimiterCheckBox->isChecked());
+ settings.setValue(QStringLiteral("Clients"), m_ui->outClientsSpinBox->value());
settings.endGroup();
- settings.beginGroup("Window");
- settings.setValue("Geometry", saveGeometry());
+ settings.beginGroup(QStringLiteral("Window"));
+ settings.setValue(QStringLiteral("Geometry"), saveGeometry());
settings.endGroup();
}
void QJackTrip::appendPlugins(JackTrip* jackTrip, int numSendChannels,
int numRecvChannels)
{
- if (!jackTrip) { return; }
+ if (!jackTrip) {
+ return;
+ }
// These effects are currently deleted by the AudioInterface of jacktrip.
// May need to change this code if we move to smart pointers.
QString QJackTrip::commandLineFromCurrentOptions()
{
- QString commandLine = "jacktrip";
+ QString commandLine = QStringLiteral("jacktrip");
if (m_ui->typeComboBox->currentIndex() == P2P_CLIENT) {
commandLine.append(" -c ").append(m_ui->addressComboBox->currentText());
commandLine.append(" -S");
}
- if (m_ui->zeroCheckBox->isChecked()) { commandLine.append(" -z"); }
+ if (m_ui->zeroCheckBox->isChecked()) {
+ commandLine.append(" -z");
+ }
if (m_ui->typeComboBox->currentIndex() == HUB_SERVER) {
int hubConnectionMode = m_ui->autoPatchComboBox->currentIndex();
- if (hubConnectionMode > 2) {
+ if (hubConnectionMode > CLIENTFOFI) {
// Adjust for the RESERVEDMATRIX gap.
hubConnectionMode++;
}
if (hubConnectionMode > 0) {
- commandLine.append(QString(" -p %1").arg(hubConnectionMode));
+ commandLine.append(QStringLiteral(" -p %1").arg(hubConnectionMode));
+ }
+ if (m_ui->patchServerCheckBox->isChecked()
+ && (m_ui->typeComboBox->currentIndex() == CLIENTFOFI
+ || m_ui->typeComboBox->currentIndex() == FULLMIX)) {
+ commandLine.append(" -i");
}
if (m_ui->upmixCheckBox->isChecked()) {
commandLine.append(" -u");
|| m_ui->channelRecvSpinBox->value() != gDefaultNumOutChannels) {
if (m_ui->channelSendSpinBox->value() == m_ui->channelRecvSpinBox->value()) {
commandLine.append(
- QString(" -n %1").arg(m_ui->channelRecvSpinBox->value()));
+ QStringLiteral(" -n %1").arg(m_ui->channelRecvSpinBox->value()));
} else {
- commandLine.append(QString(" --receivechannels %1 --sendchannels %2")
- .arg(m_ui->channelRecvSpinBox->value())
- .arg(m_ui->channelSendSpinBox->value()));
+ commandLine.append(
+ QStringLiteral(" --receivechannels %1 --sendchannels %2")
+ .arg(m_ui->channelRecvSpinBox->value())
+ .arg(m_ui->channelSendSpinBox->value()));
}
}
- if (m_ui->timeoutCheckBox->isChecked()) { commandLine.append(" -t"); }
+ if (m_ui->timeoutCheckBox->isChecked()) {
+ commandLine.append(" -t");
+ }
}
int bufStrategy = -1;
bufStrategy = m_ui->bufferStrategyComboBox->currentIndex() + 1;
}
if (bufStrategy != 1) {
- commandLine.append(QString(" --bufstrategy %1").arg(bufStrategy));
+ commandLine.append(QStringLiteral(" --bufstrategy %1").arg(bufStrategy));
}
if (m_ui->jitterCheckBox->isChecked() && m_ui->autoQueueCheckBox->isChecked()) {
if (m_ui->autoQueueSpinBox->value() == 500) {
- commandLine.append(QString(" -q auto"));
+ commandLine.append(" -q auto");
} else {
commandLine.append(
- QString(" -q auto%1").arg(m_ui->autoQueueSpinBox->value()));
+ QStringLiteral(" -q auto%1").arg(m_ui->autoQueueSpinBox->value()));
}
} else if (m_ui->queueLengthSpinBox->value() != gDefaultQueueLength) {
- commandLine.append(QString(" -q %1").arg(m_ui->queueLengthSpinBox->value()));
+ commandLine.append(
+ QStringLiteral(" -q %1").arg(m_ui->queueLengthSpinBox->value()));
}
if (m_ui->jitterCheckBox->isChecked() && m_ui->broadcastCheckBox->isChecked()) {
commandLine.append(
- QString(" --broadcast %1").arg(m_ui->broadcastQueueSpinBox->value()));
+ QStringLiteral(" --broadcast %1").arg(m_ui->broadcastQueueSpinBox->value()));
}
// Port settings
if (m_ui->localPortSpinBox->value() != gDefaultPort) {
- commandLine.append(QString(" -B %1").arg(m_ui->localPortSpinBox->value()));
+ commandLine.append(QStringLiteral(" -B %1").arg(m_ui->localPortSpinBox->value()));
}
if (m_ui->typeComboBox->currentIndex() == HUB_CLIENT
|| m_ui->typeComboBox->currentIndex() == P2P_CLIENT) {
if (m_ui->remotePortSpinBox->value() != gDefaultPort) {
- commandLine.append(QString(" -P %1").arg(m_ui->remotePortSpinBox->value()));
+ commandLine.append(
+ QStringLiteral(" -P %1").arg(m_ui->remotePortSpinBox->value()));
}
}
if (m_ui->typeComboBox->currentIndex() == HUB_SERVER) {
int offset = m_ui->localPortSpinBox->value() - gDefaultPort;
if (m_ui->basePortSpinBox->value() != 61002 + offset) {
- commandLine.append(QString(" -U %1").arg(m_ui->basePortSpinBox->value()));
+ commandLine.append(
+ QStringLiteral(" -U %1").arg(m_ui->basePortSpinBox->value()));
}
} else {
if (!m_ui->clientNameEdit->text().isEmpty()) {
- commandLine.append(QString(" -J \"%1\"").arg(m_ui->clientNameEdit->text()));
+ commandLine.append(
+ QStringLiteral(" -J \"%1\"").arg(m_ui->clientNameEdit->text()));
}
if (m_ui->typeComboBox->currentIndex() == HUB_CLIENT
&& !m_ui->remoteNameEdit->text().isEmpty()) {
- commandLine.append(QString(" -K \"%1\"").arg(m_ui->remoteNameEdit->text()));
+ commandLine.append(
+ QStringLiteral(" -K \"%1\"").arg(m_ui->remoteNameEdit->text()));
}
if (m_ui->redundancySpinBox->value() > 1) {
- commandLine.append(QString(" -r %1").arg(m_ui->redundancySpinBox->value()));
+ commandLine.append(
+ QStringLiteral(" -r %1").arg(m_ui->redundancySpinBox->value()));
}
- if (m_ui->resolutionComboBox->currentText() != "16") {
+ if (m_ui->resolutionComboBox->currentText() != QLatin1String("16")) {
commandLine.append(" -b ").append(m_ui->resolutionComboBox->currentText());
}
- if (!m_ui->connectAudioCheckBox->isChecked()) { commandLine.append(" -D"); }
+ if (!m_ui->connectAudioCheckBox->isChecked()) {
+ commandLine.append(" -D");
+ }
if (m_ui->inLimiterCheckBox->isChecked()
|| m_ui->outLimiterCheckBox->isChecked()) {
commandLine.append(" -O ");
- if (m_ui->inLimiterCheckBox->isChecked()) { commandLine.append("i"); }
+ if (m_ui->inLimiterCheckBox->isChecked()) {
+ commandLine.append("i");
+ }
if (m_ui->outLimiterCheckBox->isChecked()) {
commandLine.append("o");
if (m_ui->outClientsSpinBox->value() != 2) {
commandLine.append(
- QString(" -a %1").arg(m_ui->outClientsSpinBox->value()));
+ QStringLiteral(" -a %1").arg(m_ui->outClientsSpinBox->value()));
}
}
}
commandLine.append(" -f \"");
if (inEffects) {
commandLine.append("i:");
- if (m_ui->inCompressorCheckBox->isChecked()) { commandLine.append("c"); }
+ if (m_ui->inCompressorCheckBox->isChecked()) {
+ commandLine.append("c");
+ }
if (m_ui->inFreeverbCheckBox->isChecked()) {
- commandLine.append(QString("f(%1)").arg(
+ commandLine.append(QStringLiteral("f(%1)").arg(
m_ui->inFreeverbWetnessSlider->value() / 100.0));
}
if (m_ui->inZitarevCheckBox->isChecked()) {
- commandLine.append(QString("f(%1)").arg(
+ commandLine.append(QStringLiteral("f(%1)").arg(
m_ui->inZitarevWetnessSlider->value() / 100.0));
}
- if (outEffects) { commandLine.append(", "); }
+ if (outEffects) {
+ commandLine.append(", ");
+ }
}
if (outEffects) {
commandLine.append("o:");
- if (m_ui->outCompressorCheckBox->isChecked()) { commandLine.append("c"); }
+ if (m_ui->outCompressorCheckBox->isChecked()) {
+ commandLine.append("c");
+ }
if (m_ui->outFreeverbCheckBox->isChecked()) {
- commandLine.append(QString("f(%1)").arg(
+ commandLine.append(QStringLiteral("f(%1)").arg(
m_ui->outFreeverbWetnessSlider->value() / 100.0));
}
if (m_ui->outZitarevCheckBox->isChecked()) {
- commandLine.append(QString("f(%1)").arg(
+ commandLine.append(QStringLiteral("f(%1)").arg(
m_ui->outZitarevWetnessSlider->value() / 100.0));
}
}
}
}
if (m_ui->ioStatsCheckBox->isChecked()) {
- commandLine.append(QString(" -I %1").arg(m_ui->ioStatsSpinBox->value()));
+ commandLine.append(QStringLiteral(" -I %1").arg(m_ui->ioStatsSpinBox->value()));
}
-
- if (m_ui->verboseCheckBox->isChecked()) { commandLine.append(" -V"); }
- if (m_ui->realTimeCheckBox->isChecked()) { commandLine.append(" --udprt"); }
+ if (m_ui->verboseCheckBox->isChecked()) {
+ commandLine.append(" -V");
+ }
+
+ if (m_ui->realTimeCheckBox->isChecked()) {
+ commandLine.append(" --udprt");
+ }
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
if (m_ui->typeComboBox->currentIndex() != HUB_SERVER
&& m_ui->backendComboBox->currentIndex() == 1) {
commandLine.append(" --rtaudio");
commandLine.append(
- QString(" --srate %1").arg(m_ui->sampleRateComboBox->currentText()));
+ QStringLiteral(" --srate %1").arg(m_ui->sampleRateComboBox->currentText()));
commandLine.append(
- QString(" --bufsize %1").arg(m_ui->bufferSizeComboBox->currentText()));
+ QStringLiteral(" --bufsize %1").arg(m_ui->bufferSizeComboBox->currentText()));
QString inDevice;
- if(m_ui->inputDeviceComboBox->currentIndex() > 0) {
+ if (m_ui->inputDeviceComboBox->currentIndex() > 0) {
inDevice = m_ui->inputDeviceComboBox->currentText();
}
QString outDevice;
- if(m_ui->outputDeviceComboBox->currentIndex() > 0) {
+ if (m_ui->outputDeviceComboBox->currentIndex() > 0) {
outDevice = m_ui->outputDeviceComboBox->currentText();
}
commandLine.append(
- QString(" --audiodevice \"%1\",\"%2\"").arg(inDevice, outDevice));
+ QStringLiteral(" --audiodevice \"%1\",\"%2\"").arg(inDevice, outDevice));
}
#endif
return commandLine;
}
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
void QJackTrip::populateDeviceMenu(QComboBox* menu, bool isInput)
{
RtAudio audio;
QString previousString = menu->currentText();
menu->clear();
// std::cout << "previousString: " << previousString.toStdString() << std::endl;
- menu->addItem("(default)");
+ menu->addItem(QStringLiteral("(default)"));
unsigned int devices = audio.getDeviceCount();
RtAudio::DeviceInfo info;
- for (unsigned int i=0; i<devices; i++) {
+ for (unsigned int i = 0; i < devices; i++) {
info = audio.getDeviceInfo(i);
if (info.probed == true) {
if (isInput && info.inputChannels > 0) {
{
QMessageBox msgBox;
QString messageText =
- QString("The equivalent command line for the current options is:\n\n%1")
+ QStringLiteral("The equivalent command line for the current options is:\n\n%1")
.arg(commandLineFromCurrentOptions());
msgBox.setText(messageText);
- msgBox.setWindowTitle("Command Line");
+ msgBox.setWindowTitle(QStringLiteral("Command Line"));
msgBox.setTextInteractionFlags(Qt::TextSelectableByMouse);
msgBox.exec();
}
QJackTrip::~QJackTrip()
{
- //Restore cout. (Stops a crash on exit.)
+ // Restore cout. (Stops a crash on exit.)
std::cout.rdbuf(m_realCout.rdbuf());
std::cerr.rdbuf(m_realCerr.rdbuf());
}
#include "../UdpHubListener.h"
#include "messageDialog.h"
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
#include "NoNap.h"
#endif
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
#include <QComboBox>
#endif
#else
class QJackTripVS;
#endif
-}
+} // namespace Ui
class QJackTrip : public QMainWindow
{
private:
enum runTypeT { P2P_CLIENT, P2P_SERVER, HUB_CLIENT, HUB_SERVER };
+ enum patchTypeT { SERVERTOCLIENT, CLIENTECHO, CLIENTFOFI, FULLMIX, NOAUTO };
int findTab(const QString& tabName);
void enableUi(bool enabled);
void loadSettings();
void saveSettings();
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
void populateDeviceMenu(QComboBox* menu, bool isInput);
#endif
int m_argc;
bool m_hideWarning;
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
NoNap m_noNap;
#endif
};
<string>Basic options</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
- <item row="2" column="0" colspan="3">
- <widget class="QGroupBox" name="channelGroupBox">
- <layout class="QGridLayout" name="gridLayout_9">
- <item row="3" column="0">
- <widget class="QLabel" name="channelRecvLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&Received from network:</string>
- </property>
- <property name="buddy">
- <cstring>channelRecvSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <widget class="QSpinBox" name="channelRecvSpinBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="toolTip">
- <string>Number of audio channels toaccept from the network.</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="value">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QSpinBox" name="channelSendSpinBox">
- <property name="toolTip">
- <string>Number of audio channels to send to the network.</string>
- </property>
- <property name="minimum">
- <number>1</number>
- </property>
- <property name="value">
- <number>2</number>
- </property>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="channelSendLabel">
- <property name="text">
- <string>&Sent to network:</string>
- </property>
- <property name="buddy">
- <cstring>channelSendSpinBox</cstring>
- </property>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QLabel" name="channelLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>&Number of channels</string>
- </property>
- <property name="buddy">
- <cstring>channelRecvSpinBox</cstring>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- <item row="3" column="1" colspan="2">
- <widget class="QComboBox" name="autoPatchComboBox">
- <property name="toolTip">
- <string>Select how you want audio to be routed by the hub server.</string>
- </property>
- <property name="currentIndex">
- <number>0</number>
- </property>
- <item>
- <property name="text">
- <string>Server to clients</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Client loopback</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Client fan out/in but no loopback</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Full Mix</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>No auto patching</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="11" column="0" colspan="3">
- <layout class="QHBoxLayout" name="aboutLayout">
- <item>
- <spacer name="aboutSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="aboutButton">
- <property name="text">
- <string>About</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="7" column="0" colspan="3">
+ <item row="7" column="0" colspan="2">
<widget class="QGroupBox" name="requireAuthGroupBox">
<property name="title">
<string/>
</layout>
</widget>
</item>
- <item row="6" column="0" colspan="3">
- <widget class="QCheckBox" name="timeoutCheckBox">
- <property name="toolTip">
- <string>Stop JackTrip if no network traffic has been received for 10 seconds.</string>
- </property>
- <property name="text">
- <string>&Disconnect after 10 seconds of no network activity</string>
- </property>
- </widget>
+ <item row="11" column="0" colspan="2">
+ <layout class="QHBoxLayout" name="aboutLayout">
+ <item>
+ <spacer name="aboutSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="aboutButton">
+ <property name="text">
+ <string>About</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item row="9" column="0">
<spacer name="basicVerticalSpacer">
</property>
</spacer>
</item>
- <item row="5" column="0" colspan="3">
+ <item row="2" column="0" colspan="2">
+ <widget class="QGroupBox" name="channelGroupBox">
+ <layout class="QGridLayout" name="gridLayout_9">
+ <item row="3" column="0">
+ <widget class="QLabel" name="channelRecvLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&Received from network:</string>
+ </property>
+ <property name="buddy">
+ <cstring>channelRecvSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QSpinBox" name="channelRecvSpinBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="toolTip">
+ <string>Number of audio channels toaccept from the network.</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>2</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QSpinBox" name="channelSendSpinBox">
+ <property name="toolTip">
+ <string>Number of audio channels to send to the network.</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="value">
+ <number>2</number>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="channelSendLabel">
+ <property name="text">
+ <string>&Sent to network:</string>
+ </property>
+ <property name="buddy">
+ <cstring>channelSendSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QLabel" name="channelLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>&Number of channels</string>
+ </property>
+ <property name="buddy">
+ <cstring>channelRecvSpinBox</cstring>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="zeroCheckBox">
<property name="toolTip">
<string>Silence the audio when there's a buffer underrun.</string>
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QLabel" name="autoPatchLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="6" column="0" colspan="2">
+ <widget class="QCheckBox" name="timeoutCheckBox">
+ <property name="toolTip">
+ <string>Stop JackTrip if no network traffic has been received for 10 seconds.</string>
</property>
<property name="text">
- <string>Hub auto&patch mode</string>
- </property>
- <property name="buddy">
- <cstring>autoPatchComboBox</cstring>
+ <string>&Disconnect after 10 seconds of no network activity</string>
</property>
</widget>
</item>
- <item row="4" column="0" colspan="3">
- <widget class="QCheckBox" name="upmixCheckBox">
- <property name="text">
- <string>&Upmix mono clients to stereo</string>
+ <item row="3" column="0" colspan="2">
+ <widget class="QGroupBox" name="autoPatchGroupBox">
+ <property name="title">
+ <string/>
</property>
+ <layout class="QGridLayout" name="gridLayout_10">
+ <item row="2" column="0" colspan="2">
+ <widget class="QCheckBox" name="upmixCheckBox">
+ <property name="toolTip">
+ <string>For clients that only send one channel of audio, relay their signal in stereo.</string>
+ </property>
+ <property name="text">
+ <string>&Upmix mono clients to stereo</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="autoPatchComboBox">
+ <property name="toolTip">
+ <string>Select how you want audio to be routed by the hub server.</string>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <item>
+ <property name="text">
+ <string>Server to clients</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Client loopback</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Client fan out/in but no loopback</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Full Mix</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>No auto patching</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="autoPatchLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Hub auto&patch mode</string>
+ </property>
+ <property name="buddy">
+ <cstring>autoPatchComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" colspan="2">
+ <widget class="QCheckBox" name="patchServerCheckBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Include the server in the audio patching. This allows an ensemble member to
+play from this machine. (Available in client fan out/in and full mix modes.)</string>
+ </property>
+ <property name="text">
+ <string>&Include server in patching</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
</layout>
</item>
<item row="12" column="0" colspan="3">
<widget class="QCheckBox" name="verboseCheckBox">
+ <property name="toolTip">
+ <string>Display debugging information that would normally appear on the console.</string>
+ </property>
<property name="text">
<string>Show &Debug Information</string>
</property>
<tabstop>channelRecvSpinBox</tabstop>
<tabstop>channelSendSpinBox</tabstop>
<tabstop>autoPatchComboBox</tabstop>
+ <tabstop>patchServerCheckBox</tabstop>
<tabstop>upmixCheckBox</tabstop>
<tabstop>zeroCheckBox</tabstop>
<tabstop>timeoutCheckBox</tabstop>
<tabstop>realTimeCheckBox</tabstop>
<tabstop>ioStatsCheckBox</tabstop>
<tabstop>ioStatsSpinBox</tabstop>
+ <tabstop>verboseCheckBox</tabstop>
<tabstop>authCheckBox</tabstop>
<tabstop>usernameEdit</tabstop>
<tabstop>passwordEdit</tabstop>
<tabstop>outCompressorCheckBox</tabstop>
<tabstop>outLimiterCheckBox</tabstop>
<tabstop>outClientsSpinBox</tabstop>
- <tabstop>verboseCheckBox</tabstop>
</tabstops>
<resources>
<include location="qjacktrip.qrc"/>
<x>0</x>
<y>0</y>
<width>409</width>
- <height>817</height>
+ <height>889</height>
</rect>
</property>
<property name="windowTitle">
<string>Basic options</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
- <item row="2" column="0" colspan="3">
+ <item row="3" column="0" colspan="2">
+ <widget class="QGroupBox" name="autoPatchGroupBox">
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_10">
+ <item row="0" column="0" rowspan="2" colspan="2">
+ <widget class="QLabel" name="autoPatchLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Hub auto&patch mode</string>
+ </property>
+ <property name="buddy">
+ <cstring>autoPatchComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2">
+ <widget class="QComboBox" name="autoPatchComboBox">
+ <property name="toolTip">
+ <string>Select how you want audio to be routed by the hub server.</string>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <item>
+ <property name="text">
+ <string>Server to clients</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Client loopback</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Client fan out/in but no loopback</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Full Mix</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>No auto patching</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="3">
+ <widget class="QCheckBox" name="upmixCheckBox">
+ <property name="toolTip">
+ <string>For clients that only send one channel of audio, relay their signal in stereo.</string>
+ </property>
+ <property name="text">
+ <string>&Upmix mono clients to stereo</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3">
+ <widget class="QCheckBox" name="patchServerCheckBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="toolTip">
+ <string>Include the server in the audio patching. This allows an ensemble member to
+play from this machine. (Available in client fan out/in and full mix modes.)</string>
+ </property>
+ <property name="text">
+ <string>&Include server in patching</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="channelGroupBox">
<layout class="QGridLayout" name="gridLayout_9">
<item row="3" column="0">
</layout>
</widget>
</item>
- <item row="8" column="0" colspan="3">
+ <item row="6" column="0" colspan="2">
+ <widget class="QCheckBox" name="timeoutCheckBox">
+ <property name="toolTip">
+ <string>Stop JackTrip if no network traffic has been received for 10 seconds.</string>
+ </property>
+ <property name="text">
+ <string>&Disconnect after 10 seconds of no network activity</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0" colspan="2">
<widget class="QGroupBox" name="authGroupBox">
<property name="enabled">
<bool>true</bool>
</layout>
</widget>
</item>
- <item row="3" column="1" colspan="2">
- <widget class="QComboBox" name="autoPatchComboBox">
- <property name="toolTip">
- <string>Select how you want audio to be routed by the hub server.</string>
+ <item row="9" column="0">
+ <spacer name="basicVerticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
</property>
- <property name="currentIndex">
- <number>0</number>
+ <property name="sizeType">
+ <enum>QSizePolicy::Expanding</enum>
</property>
- <item>
- <property name="text">
- <string>Server to clients</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Client loopback</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Client fan out/in but no loopback</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Full Mix</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>No auto patching</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="11" column="0" colspan="3">
- <layout class="QHBoxLayout" name="aboutLayout">
- <item>
- <spacer name="aboutSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="aboutButton">
- <property name="text">
- <string>About</string>
- </property>
- </widget>
- </item>
- </layout>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
</item>
- <item row="7" column="0" colspan="3">
+ <item row="7" column="0" colspan="2">
<widget class="QGroupBox" name="requireAuthGroupBox">
<property name="title">
<string/>
</layout>
</widget>
</item>
- <item row="6" column="0" colspan="3">
- <widget class="QCheckBox" name="timeoutCheckBox">
- <property name="toolTip">
- <string>Stop JackTrip if no network traffic has been received for 10 seconds.</string>
- </property>
- <property name="text">
- <string>&Disconnect after 10 seconds of no network activity</string>
- </property>
- </widget>
- </item>
- <item row="9" column="0">
- <spacer name="basicVerticalSpacer">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>QSizePolicy::Expanding</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
+ <item row="11" column="0" colspan="2">
+ <layout class="QHBoxLayout" name="aboutLayout">
+ <item>
+ <spacer name="aboutSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="aboutButton">
+ <property name="text">
+ <string>About</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="5" column="0" colspan="3">
+ <item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="zeroCheckBox">
<property name="toolTip">
<string>Silence the audio when there's a buffer underrun.</string>
</property>
</widget>
</item>
- <item row="3" column="0">
- <widget class="QLabel" name="autoPatchLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Maximum" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Hub auto&patch mode</string>
- </property>
- <property name="buddy">
- <cstring>autoPatchComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="4" column="0" colspan="3">
- <widget class="QCheckBox" name="upmixCheckBox">
- <property name="text">
- <string>&Upmix mono clients to stereo</string>
- </property>
- </widget>
- </item>
</layout>
</widget>
<widget class="QWidget" name="advancedTab">
</item>
<item row="12" column="0" colspan="3">
<widget class="QCheckBox" name="verboseCheckBox">
+ <property name="toolTip">
+ <string>Display debugging information that would normally appear on the console.</string>
+ </property>
<property name="text">
<string>Show &Debug Information</string>
</property>
<tabstop>channelRecvSpinBox</tabstop>
<tabstop>channelSendSpinBox</tabstop>
<tabstop>autoPatchComboBox</tabstop>
+ <tabstop>patchServerCheckBox</tabstop>
<tabstop>upmixCheckBox</tabstop>
<tabstop>zeroCheckBox</tabstop>
<tabstop>timeoutCheckBox</tabstop>
int textbuf::overflow(int c)
{
- //Output our buffer.
+ // Output our buffer.
putChars(pbase(), pptr());
-
+
if (c != traits_t::eof()) {
char out = c;
putChars(&out, &out + 1);
}
-
- //Set buffer to empty again
+
+ // Set buffer to empty again
setp(m_buf, m_buf + BUF_SIZE);
-
+
return c;
}
int textbuf::sync()
{
- //Flush our buffer.
+ // Flush our buffer.
putChars(pbase(), pptr());
setp(m_buf, m_buf + BUF_SIZE);
return 0;
}
m_outStream->flush();
}
-
+
+ // Send a signal here rather than writing directly to our
+ // QTextEdit to avoid any issues with threading.
emit outputString(QString(QByteArray(begin, end - begin)));
}
-
#ifndef TEXTBUF_H
#define TEXTBUF_H
-#include <streambuf>
-#include <iostream>
#include <QPlainTextEdit>
+#include <iostream>
+#include <streambuf>
-//Extension of a stream buffer to output to a QTextEdit
-class textbuf : public QObject, public std::basic_streambuf<char, std::char_traits<char>>
+// Extension of a stream buffer to output to a QTextEdit via a signal
+class textbuf
+ : public QObject
+ , public std::basic_streambuf<char, std::char_traits<char>>
{
Q_OBJECT
-
+
public:
- textbuf() { setp(m_buf, m_buf + BUF_SIZE); }
-
- void setOutStream(std::ostream *output);
+ textbuf(QObject* parent = nullptr) : QObject(parent)
+ {
+ setp(m_buf, m_buf + BUF_SIZE);
+ }
+
+ void setOutStream(std::ostream* output);
signals:
void outputString(const QString& output);
-
+
protected:
virtual int overflow(int c = traits_t::eof());
virtual int sync();
-
+
private:
typedef std::char_traits<char> traits_t;
-
+
static const size_t BUF_SIZE = 64;
char m_buf[BUF_SIZE];
-
- std::ostream *m_outStream = nullptr;
-
+
+ std::ostream* m_outStream = nullptr;
+
void putChars(const char* begin, const char* end);
};
#include <iostream>
-#if defined(__LINUX__)
+#if defined(__linux__)
#include <sched.h>
#include <sys/types.h>
#include <unistd.h>
-#endif //__LINUX__
+#endif //__linux__
-#if defined(__MAC_OSX__)
+#if defined(__APPLE__)
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <mach/thread_policy.h>
#include <sys/qos.h>
-#endif //__MAC_OSX__
+#endif //__APPLE__
-#if defined(__WIN_32__)
+#if defined(_WIN32)
// Windows libraries that rely on the ordering of includes…
// clang-format off
#include <windows.h>
#endif
#include "jacktrip_globals.h"
-#if defined(__MAC_OSX__)
+#if defined(__APPLE__)
// The following function is taken from the chromium source code
// https://github.com/chromium/chromium/blob/master/base/threading/platform_thread_mac.mm
thread_precedence_policy_data_t precedence;
precedence.importance = 52;
result = thread_policy_set(mach_thread_id, THREAD_PRECEDENCE_POLICY,
- reinterpret_cast<thread_policy_t>(&precedence),
- THREAD_PRECEDENCE_POLICY_COUNT);
+ reinterpret_cast<thread_policy_t>(&precedence),
+ THREAD_PRECEDENCE_POLICY_COUNT);
if (result != KERN_SUCCESS) {
std::cerr << "Failed to set thread priority. " << result << std::endl;
return;
return;
}
-#endif //__MAC_OSX__
+#endif //__APPLE__
-#if defined(__LINUX__)
+#if defined(__linux__)
//*******************************************************************************
void setRealtimeProcessPriority()
{
;
}
}
-#endif //__LINUX__
+#endif //__linux__
-#if defined(__WIN_32__)
+#if defined(_WIN32)
void setRealtimeProcessPriority()
{
if (SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS) == 0) {
std::cerr << "Failed to set thread priority." << std::endl;
}
}
-#endif //__WIN_32__
+#endif //_WIN32
#include "AudioInterface.h"
-constexpr const char* const gVersion = "1.5.0"; ///< JackTrip version
+constexpr const char* const gVersion = "1.5.1"; ///< JackTrip version
//*******************************************************************************
/// \name Default Values
//*******************************************************************************
/// \name Global Functions
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
void setRealtimeProcessPriority(int bufferSize, int sampleRate);
#else
void setRealtimeProcessPriority();
{
FAUSTFLOAT* zone = fZone[p];
for (size_t i = 0; i < table[val].size(); i++) {
- if (zone == table[val][i]->getZone()) return int(i);
+ if (zone == table[val][i]->getZone())
+ return int(i);
}
return -1;
}
int id3 = getZoneIndex(table, p, 2);
// Deactivates everywhere..
- if (id1 != -1) table[0][id1]->setActive(false);
- if (id2 != -1) table[1][id2]->setActive(false);
- if (id3 != -1) table[2][id3]->setActive(false);
+ if (id1 != -1)
+ table[0][id1]->setActive(false);
+ if (id2 != -1)
+ table[1][id2]->setActive(false);
+ if (id3 != -1)
+ table[2][id3]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
virtual ~APIUI()
{
- for (auto& it : fConversion) delete it;
+ for (auto& it : fConversion)
+ delete it;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i]) delete it;
- for (auto& it : fGyr[i]) delete it;
+ for (auto& it : fAcc[i])
+ delete it;
+ for (auto& it : fGyr[i])
+ delete it;
}
delete fRedReader;
delete fGreenReader;
{
std::map<const char*, const char*> res;
std::map<std::string, std::string> metadata = fMetaData[p];
- for (const auto& it : metadata) { res[it.first.c_str()] = it.second.c_str(); }
+ for (const auto& it : metadata) {
+ res[it.first.c_str()] = it.second.c_str();
+ }
return res;
}
*/
void propagateAcc(int acc, double value)
{
- for (size_t i = 0; i < fAcc[acc].size(); i++) { fAcc[acc][i]->update(value); }
+ for (size_t i = 0; i < fAcc[acc].size(); i++) {
+ fAcc[acc][i]->update(value);
+ }
}
/**
*/
void propagateGyr(int gyr, double value)
{
- for (size_t i = 0; i < fGyr[gyr].size(); i++) { fGyr[gyr][i]->update(value); }
+ for (size_t i = 0; i < fGyr[gyr].size(); i++) {
+ fGyr[gyr][i]->update(value);
+ }
}
/**
virtual void instanceClear()
{
- for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) { iRec5[l0] = 0; }
+ for (int l0 = 0; (l0 < 2); l0 = (l0 + 1)) {
+ iRec5[l0] = 0;
+ }
IOTA = 0;
- for (int l1 = 0; (l1 < 32); l1 = (l1 + 1)) { fVec0[l1] = 0.0f; }
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec4[l2] = 0.0f; }
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { iRec2[l3] = 0; }
- for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec1[l4] = 0.0f; }
- for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { fRec0[l5] = 0.0f; }
+ for (int l1 = 0; (l1 < 32); l1 = (l1 + 1)) {
+ fVec0[l1] = 0.0f;
+ }
+ for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
+ fRec4[l2] = 0.0f;
+ }
+ for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
+ iRec2[l3] = 0;
+ }
+ for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
+ fRec1[l4] = 0.0f;
+ }
+ for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
+ fRec0[l5] = 0.0f;
+ }
}
virtual void init(int sample_rate)
#ifndef NO_GUI
#include <QApplication>
+#include <QCommandLineParser>
#include "gui/qjacktrip.h"
-#include <QCommandLineParser>
#else
#include <QCoreApplication>
#endif
#include "UdpHubListener.h"
#include "jacktrip_globals.h"
-#ifdef __WIN_32__
-#include <windows.h>
+#ifdef _WIN32
#include <psapi.h>
#include <tlhelp32.h>
+#include <windows.h>
#endif
QCoreApplication* createApplication(int& argc, char* argv[])
return new QCoreApplication(argc, argv);
}
#else
-#ifdef __LINUX__
+#ifdef __linux__
// Check if X or Wayland environment variables are set.
if (std::getenv("WAYLAND_DISPLAY") == nullptr
&& std::getenv("DISPLAY") == nullptr) {
<< std::endl;
std::exit(1);
}
-#endif // __LINUX__
+#endif // __linux__
return new QApplication(argc, argv);
#endif // NO_GUI
} else {
std::cerr << msg.toStdString() << std::endl;
}
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
static int setupUnixSignalHandler(void (*handler)(int))
{
// Setup our SIGINT handler.
}
}
-bool isRunFromCmd() {
- //Get our parent process pid
+bool isRunFromCmd()
+{
+ // Get our parent process pid
HANDLE h = NULL;
- PROCESSENTRY32 pe = {0};
+ PROCESSENTRY32 pe;
+ ZeroMemory(&pe, sizeof(PROCESSENTRY32));
DWORD pid = GetCurrentProcessId();
DWORD ppid = 0;
pe.dwSize = sizeof(PROCESSENTRY32);
h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (Process32First(h, &pe)) {
do {
- //Loop through the list of processes until we find ours.
+ // Loop through the list of processes until we find ours.
if (pe.th32ProcessID == pid) {
ppid = pe.th32ParentProcessID;
break;
} while (Process32Next(h, &pe));
}
CloseHandle(h);
-
- //Get the name of our parent process;
+
+ // Get the name of our parent process;
char pname[MAX_PATH] = {0};
DWORD size = MAX_PATH;
h = NULL;
if (h) {
if (QueryFullProcessImageNameA(h, 0, pname, &size)) {
CloseHandle(h);
-
- //Check if our parent process is a command line.
+
+ // Check if our parent process is a command line.
if (size >= 14 && strncmp(pname + size - 14, "powershell.exe", 14) == 0) {
return true;
}
CloseHandle(h);
}
}
-
+
return false;
}
#endif
QScopedPointer<QJackTrip> window;
if (qobject_cast<QApplication*>(app.data())) {
// Start the GUI if there are no command line options.
-#ifdef __WIN_32__
- // Remove the console that appears if we're on windows and not running from a command line.
+#ifdef _WIN32
+ // Remove the console that appears if we're on windows and not running from a
+ // command line.
if (!isRunFromCmd()) {
FreeConsole();
}
-#endif // __WIN_32__
- app->setApplicationName("QJackTrip");
-
+#endif // _WIN32
+ app->setApplicationName(QStringLiteral("QJackTrip"));
+
QCommandLineParser parser;
- QCommandLineOption verboseOption(QStringList() << "V" << "verbose");
+ QCommandLineOption verboseOption(QStringList() << QStringLiteral("V")
+ << QStringLiteral("verbose"));
parser.addOption(verboseOption);
parser.parse(app->arguments());
if (parser.isSet(verboseOption)) {
gVerboseFlag = true;
}
-
+
window.reset(new QJackTrip);
window->setArgc(argc);
QObject::connect(window.data(), &QJackTrip::signalExit, app.data(),
Qt::QueuedConnection);
QObject::connect(udpHub.data(), &UdpHubListener::signalError, app.data(),
&QCoreApplication::quit, Qt::QueuedConnection);
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
setupUnixSignalHandler(UdpHubListener::sigIntHandler);
#else
isHubServer = true;
Qt::QueuedConnection);
QObject::connect(jackTrip.data(), &JackTrip::signalError, app.data(),
&QCoreApplication::quit, Qt::QueuedConnection);
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
setupUnixSignalHandler(JackTrip::sigIntHandler);
#else
std::cout << SetConsoleCtrlHandler(windowsCtrlHandler, true) << std::endl;
#endif // endwhere
}
- if (gVerboseFlag) std::cout << "step 6" << std::endl;
- if (gVerboseFlag) std::cout << "jmain before app->exec()" << std::endl;
+ if (gVerboseFlag)
+ std::cout << "step 6" << std::endl;
+ if (gVerboseFlag)
+ std::cout << "jmain before app->exec()" << std::endl;
} catch (const std::exception& e) {
std::cerr << "ERROR:" << std::endl;
std::cerr << e.what() << std::endl;
{
FAUSTFLOAT* zone = fZone[p];
for (size_t i = 0; i < table[val].size(); i++) {
- if (zone == table[val][i]->getZone()) return int(i);
+ if (zone == table[val][i]->getZone())
+ return int(i);
}
return -1;
}
int id3 = getZoneIndex(table, p, 2);
// Deactivates everywhere..
- if (id1 != -1) table[0][id1]->setActive(false);
- if (id2 != -1) table[1][id2]->setActive(false);
- if (id3 != -1) table[2][id3]->setActive(false);
+ if (id1 != -1)
+ table[0][id1]->setActive(false);
+ if (id2 != -1)
+ table[1][id2]->setActive(false);
+ if (id3 != -1)
+ table[2][id3]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
virtual ~APIUI()
{
- for (auto& it : fConversion) delete it;
+ for (auto& it : fConversion)
+ delete it;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i]) delete it;
- for (auto& it : fGyr[i]) delete it;
+ for (auto& it : fAcc[i])
+ delete it;
+ for (auto& it : fGyr[i])
+ delete it;
}
delete fRedReader;
delete fGreenReader;
{
std::map<const char*, const char*> res;
std::map<std::string, std::string> metadata = fMetaData[p];
- for (auto it : metadata) { res[it.first.c_str()] = it.second.c_str(); }
+ for (auto it : metadata) {
+ res[it.first.c_str()] = it.second.c_str();
+ }
return res;
}
*/
void propagateAcc(int acc, double value)
{
- for (size_t i = 0; i < fAcc[acc].size(); i++) { fAcc[acc][i]->update(value); }
+ for (size_t i = 0; i < fAcc[acc].size(); i++) {
+ fAcc[acc][i]->update(value);
+ }
}
/**
*/
void propagateGyr(int gyr, double value)
{
- for (size_t i = 0; i < fGyr[gyr].size(); i++) { fGyr[gyr][i]->update(value); }
+ for (size_t i = 0; i < fGyr[gyr].size(); i++) {
+ fGyr[gyr][i]->update(value);
+ }
}
/**
#include <algorithm>
#include <cmath>
-static float zitarevdsp_faustpower2_f(float value) { return (value * value); }
+static float zitarevdsp_faustpower2_f(float value)
+{
+ return (value * value);
+}
#ifndef FAUSTCLASS
#define FAUSTCLASS zitarevdsp
virtual void instanceClear()
{
IOTA = 0;
- for (int l0 = 0; (l0 < 16384); l0 = (l0 + 1)) { fVec0[l0] = 0.0f; }
- for (int l1 = 0; (l1 < 16384); l1 = (l1 + 1)) { fVec1[l1] = 0.0f; }
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec0[l2] = 0.0f; }
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { fRec1[l3] = 0.0f; }
- for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec15[l4] = 0.0f; }
- for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) { fRec14[l5] = 0.0f; }
- for (int l6 = 0; (l6 < 32768); l6 = (l6 + 1)) { fVec2[l6] = 0.0f; }
- for (int l7 = 0; (l7 < 2048); l7 = (l7 + 1)) { fVec3[l7] = 0.0f; }
- for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) { fRec12[l8] = 0.0f; }
- for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { fRec19[l9] = 0.0f; }
- for (int l10 = 0; (l10 < 2); l10 = (l10 + 1)) { fRec18[l10] = 0.0f; }
- for (int l11 = 0; (l11 < 32768); l11 = (l11 + 1)) { fVec4[l11] = 0.0f; }
- for (int l12 = 0; (l12 < 4096); l12 = (l12 + 1)) { fVec5[l12] = 0.0f; }
- for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) { fRec16[l13] = 0.0f; }
- for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { fRec23[l14] = 0.0f; }
- for (int l15 = 0; (l15 < 2); l15 = (l15 + 1)) { fRec22[l15] = 0.0f; }
- for (int l16 = 0; (l16 < 16384); l16 = (l16 + 1)) { fVec6[l16] = 0.0f; }
- for (int l17 = 0; (l17 < 4096); l17 = (l17 + 1)) { fVec7[l17] = 0.0f; }
- for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) { fRec20[l18] = 0.0f; }
- for (int l19 = 0; (l19 < 2); l19 = (l19 + 1)) { fRec27[l19] = 0.0f; }
- for (int l20 = 0; (l20 < 2); l20 = (l20 + 1)) { fRec26[l20] = 0.0f; }
- for (int l21 = 0; (l21 < 32768); l21 = (l21 + 1)) { fVec8[l21] = 0.0f; }
- for (int l22 = 0; (l22 < 4096); l22 = (l22 + 1)) { fVec9[l22] = 0.0f; }
- for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) { fRec24[l23] = 0.0f; }
- for (int l24 = 0; (l24 < 2); l24 = (l24 + 1)) { fRec31[l24] = 0.0f; }
- for (int l25 = 0; (l25 < 2); l25 = (l25 + 1)) { fRec30[l25] = 0.0f; }
- for (int l26 = 0; (l26 < 16384); l26 = (l26 + 1)) { fVec10[l26] = 0.0f; }
- for (int l27 = 0; (l27 < 2048); l27 = (l27 + 1)) { fVec11[l27] = 0.0f; }
- for (int l28 = 0; (l28 < 2); l28 = (l28 + 1)) { fRec28[l28] = 0.0f; }
- for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) { fRec35[l29] = 0.0f; }
- for (int l30 = 0; (l30 < 2); l30 = (l30 + 1)) { fRec34[l30] = 0.0f; }
- for (int l31 = 0; (l31 < 16384); l31 = (l31 + 1)) { fVec12[l31] = 0.0f; }
- for (int l32 = 0; (l32 < 4096); l32 = (l32 + 1)) { fVec13[l32] = 0.0f; }
- for (int l33 = 0; (l33 < 2); l33 = (l33 + 1)) { fRec32[l33] = 0.0f; }
- for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) { fRec39[l34] = 0.0f; }
- for (int l35 = 0; (l35 < 2); l35 = (l35 + 1)) { fRec38[l35] = 0.0f; }
- for (int l36 = 0; (l36 < 16384); l36 = (l36 + 1)) { fVec14[l36] = 0.0f; }
- for (int l37 = 0; (l37 < 4096); l37 = (l37 + 1)) { fVec15[l37] = 0.0f; }
- for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) { fRec36[l38] = 0.0f; }
- for (int l39 = 0; (l39 < 2); l39 = (l39 + 1)) { fRec43[l39] = 0.0f; }
- for (int l40 = 0; (l40 < 2); l40 = (l40 + 1)) { fRec42[l40] = 0.0f; }
- for (int l41 = 0; (l41 < 16384); l41 = (l41 + 1)) { fVec16[l41] = 0.0f; }
- for (int l42 = 0; (l42 < 2048); l42 = (l42 + 1)) { fVec17[l42] = 0.0f; }
- for (int l43 = 0; (l43 < 2); l43 = (l43 + 1)) { fRec40[l43] = 0.0f; }
- for (int l44 = 0; (l44 < 3); l44 = (l44 + 1)) { fRec4[l44] = 0.0f; }
- for (int l45 = 0; (l45 < 3); l45 = (l45 + 1)) { fRec5[l45] = 0.0f; }
- for (int l46 = 0; (l46 < 3); l46 = (l46 + 1)) { fRec6[l46] = 0.0f; }
- for (int l47 = 0; (l47 < 3); l47 = (l47 + 1)) { fRec7[l47] = 0.0f; }
- for (int l48 = 0; (l48 < 3); l48 = (l48 + 1)) { fRec8[l48] = 0.0f; }
- for (int l49 = 0; (l49 < 3); l49 = (l49 + 1)) { fRec9[l49] = 0.0f; }
- for (int l50 = 0; (l50 < 3); l50 = (l50 + 1)) { fRec10[l50] = 0.0f; }
- for (int l51 = 0; (l51 < 3); l51 = (l51 + 1)) { fRec11[l51] = 0.0f; }
- for (int l52 = 0; (l52 < 3); l52 = (l52 + 1)) { fRec3[l52] = 0.0f; }
- for (int l53 = 0; (l53 < 3); l53 = (l53 + 1)) { fRec2[l53] = 0.0f; }
- for (int l54 = 0; (l54 < 3); l54 = (l54 + 1)) { fRec45[l54] = 0.0f; }
- for (int l55 = 0; (l55 < 3); l55 = (l55 + 1)) { fRec44[l55] = 0.0f; }
+ for (int l0 = 0; (l0 < 16384); l0 = (l0 + 1)) {
+ fVec0[l0] = 0.0f;
+ }
+ for (int l1 = 0; (l1 < 16384); l1 = (l1 + 1)) {
+ fVec1[l1] = 0.0f;
+ }
+ for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
+ fRec0[l2] = 0.0f;
+ }
+ for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
+ fRec1[l3] = 0.0f;
+ }
+ for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
+ fRec15[l4] = 0.0f;
+ }
+ for (int l5 = 0; (l5 < 2); l5 = (l5 + 1)) {
+ fRec14[l5] = 0.0f;
+ }
+ for (int l6 = 0; (l6 < 32768); l6 = (l6 + 1)) {
+ fVec2[l6] = 0.0f;
+ }
+ for (int l7 = 0; (l7 < 2048); l7 = (l7 + 1)) {
+ fVec3[l7] = 0.0f;
+ }
+ for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) {
+ fRec12[l8] = 0.0f;
+ }
+ for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) {
+ fRec19[l9] = 0.0f;
+ }
+ for (int l10 = 0; (l10 < 2); l10 = (l10 + 1)) {
+ fRec18[l10] = 0.0f;
+ }
+ for (int l11 = 0; (l11 < 32768); l11 = (l11 + 1)) {
+ fVec4[l11] = 0.0f;
+ }
+ for (int l12 = 0; (l12 < 4096); l12 = (l12 + 1)) {
+ fVec5[l12] = 0.0f;
+ }
+ for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) {
+ fRec16[l13] = 0.0f;
+ }
+ for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) {
+ fRec23[l14] = 0.0f;
+ }
+ for (int l15 = 0; (l15 < 2); l15 = (l15 + 1)) {
+ fRec22[l15] = 0.0f;
+ }
+ for (int l16 = 0; (l16 < 16384); l16 = (l16 + 1)) {
+ fVec6[l16] = 0.0f;
+ }
+ for (int l17 = 0; (l17 < 4096); l17 = (l17 + 1)) {
+ fVec7[l17] = 0.0f;
+ }
+ for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) {
+ fRec20[l18] = 0.0f;
+ }
+ for (int l19 = 0; (l19 < 2); l19 = (l19 + 1)) {
+ fRec27[l19] = 0.0f;
+ }
+ for (int l20 = 0; (l20 < 2); l20 = (l20 + 1)) {
+ fRec26[l20] = 0.0f;
+ }
+ for (int l21 = 0; (l21 < 32768); l21 = (l21 + 1)) {
+ fVec8[l21] = 0.0f;
+ }
+ for (int l22 = 0; (l22 < 4096); l22 = (l22 + 1)) {
+ fVec9[l22] = 0.0f;
+ }
+ for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) {
+ fRec24[l23] = 0.0f;
+ }
+ for (int l24 = 0; (l24 < 2); l24 = (l24 + 1)) {
+ fRec31[l24] = 0.0f;
+ }
+ for (int l25 = 0; (l25 < 2); l25 = (l25 + 1)) {
+ fRec30[l25] = 0.0f;
+ }
+ for (int l26 = 0; (l26 < 16384); l26 = (l26 + 1)) {
+ fVec10[l26] = 0.0f;
+ }
+ for (int l27 = 0; (l27 < 2048); l27 = (l27 + 1)) {
+ fVec11[l27] = 0.0f;
+ }
+ for (int l28 = 0; (l28 < 2); l28 = (l28 + 1)) {
+ fRec28[l28] = 0.0f;
+ }
+ for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) {
+ fRec35[l29] = 0.0f;
+ }
+ for (int l30 = 0; (l30 < 2); l30 = (l30 + 1)) {
+ fRec34[l30] = 0.0f;
+ }
+ for (int l31 = 0; (l31 < 16384); l31 = (l31 + 1)) {
+ fVec12[l31] = 0.0f;
+ }
+ for (int l32 = 0; (l32 < 4096); l32 = (l32 + 1)) {
+ fVec13[l32] = 0.0f;
+ }
+ for (int l33 = 0; (l33 < 2); l33 = (l33 + 1)) {
+ fRec32[l33] = 0.0f;
+ }
+ for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) {
+ fRec39[l34] = 0.0f;
+ }
+ for (int l35 = 0; (l35 < 2); l35 = (l35 + 1)) {
+ fRec38[l35] = 0.0f;
+ }
+ for (int l36 = 0; (l36 < 16384); l36 = (l36 + 1)) {
+ fVec14[l36] = 0.0f;
+ }
+ for (int l37 = 0; (l37 < 4096); l37 = (l37 + 1)) {
+ fVec15[l37] = 0.0f;
+ }
+ for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) {
+ fRec36[l38] = 0.0f;
+ }
+ for (int l39 = 0; (l39 < 2); l39 = (l39 + 1)) {
+ fRec43[l39] = 0.0f;
+ }
+ for (int l40 = 0; (l40 < 2); l40 = (l40 + 1)) {
+ fRec42[l40] = 0.0f;
+ }
+ for (int l41 = 0; (l41 < 16384); l41 = (l41 + 1)) {
+ fVec16[l41] = 0.0f;
+ }
+ for (int l42 = 0; (l42 < 2048); l42 = (l42 + 1)) {
+ fVec17[l42] = 0.0f;
+ }
+ for (int l43 = 0; (l43 < 2); l43 = (l43 + 1)) {
+ fRec40[l43] = 0.0f;
+ }
+ for (int l44 = 0; (l44 < 3); l44 = (l44 + 1)) {
+ fRec4[l44] = 0.0f;
+ }
+ for (int l45 = 0; (l45 < 3); l45 = (l45 + 1)) {
+ fRec5[l45] = 0.0f;
+ }
+ for (int l46 = 0; (l46 < 3); l46 = (l46 + 1)) {
+ fRec6[l46] = 0.0f;
+ }
+ for (int l47 = 0; (l47 < 3); l47 = (l47 + 1)) {
+ fRec7[l47] = 0.0f;
+ }
+ for (int l48 = 0; (l48 < 3); l48 = (l48 + 1)) {
+ fRec8[l48] = 0.0f;
+ }
+ for (int l49 = 0; (l49 < 3); l49 = (l49 + 1)) {
+ fRec9[l49] = 0.0f;
+ }
+ for (int l50 = 0; (l50 < 3); l50 = (l50 + 1)) {
+ fRec10[l50] = 0.0f;
+ }
+ for (int l51 = 0; (l51 < 3); l51 = (l51 + 1)) {
+ fRec11[l51] = 0.0f;
+ }
+ for (int l52 = 0; (l52 < 3); l52 = (l52 + 1)) {
+ fRec3[l52] = 0.0f;
+ }
+ for (int l53 = 0; (l53 < 3); l53 = (l53 + 1)) {
+ fRec2[l53] = 0.0f;
+ }
+ for (int l54 = 0; (l54 < 3); l54 = (l54 + 1)) {
+ fRec45[l54] = 0.0f;
+ }
+ for (int l55 = 0; (l55 < 3); l55 = (l55 + 1)) {
+ fRec44[l55] = 0.0f;
+ }
}
virtual void init(int sample_rate)
float fTemp24 = (fSlow5 * fRec2[0]);
float fTemp25 = (1.0f - fRec1[0]);
output0[i] = FAUSTFLOAT(
- (fRec0[0]
+ (fRec0[0]
* ((0.5f
* (fRec1[0]
* ((fTemp24 + (fRec2[2] + (fTemp22 + fTemp23)))
fRec44[0] = (fTemp29 - (fTemp30 + (fSlow5 * fRec44[2])));
float fTemp31 = (fSlow5 * fRec44[0]);
output1[i] = FAUSTFLOAT(
- (fRec0[0]
+ (fRec0[0]
* ((0.5f
* (fRec1[0]
* ((fTemp31 + (fRec44[2] + (fTemp29 + fTemp30)))
{
FAUSTFLOAT* zone = fZone[p];
for (size_t i = 0; i < table[val].size(); i++) {
- if (zone == table[val][i]->getZone()) return int(i);
+ if (zone == table[val][i]->getZone())
+ return int(i);
}
return -1;
}
int id3 = getZoneIndex(table, p, 2);
// Deactivates everywhere..
- if (id1 != -1) table[0][id1]->setActive(false);
- if (id2 != -1) table[1][id2]->setActive(false);
- if (id3 != -1) table[2][id3]->setActive(false);
+ if (id1 != -1)
+ table[0][id1]->setActive(false);
+ if (id2 != -1)
+ table[1][id2]->setActive(false);
+ if (id3 != -1)
+ table[2][id3]->setActive(false);
if (val == -1) { // Means: no more mapping...
// So stay all deactivated...
virtual ~APIUI()
{
- for (auto& it : fConversion) delete it;
+ for (auto& it : fConversion)
+ delete it;
for (int i = 0; i < 3; i++) {
- for (auto& it : fAcc[i]) delete it;
- for (auto& it : fGyr[i]) delete it;
+ for (auto& it : fAcc[i])
+ delete it;
+ for (auto& it : fGyr[i])
+ delete it;
}
delete fRedReader;
delete fGreenReader;
{
std::map<const char*, const char*> res;
std::map<std::string, std::string> metadata = fMetaData[p];
- for (auto it : metadata) { res[it.first.c_str()] = it.second.c_str(); }
+ for (auto it : metadata) {
+ res[it.first.c_str()] = it.second.c_str();
+ }
return res;
}
*/
void propagateAcc(int acc, double value)
{
- for (size_t i = 0; i < fAcc[acc].size(); i++) { fAcc[acc][i]->update(value); }
+ for (size_t i = 0; i < fAcc[acc].size(); i++) {
+ fAcc[acc][i]->update(value);
+ }
}
/**
*/
void propagateGyr(int gyr, double value)
{
- for (size_t i = 0; i < fGyr[gyr].size(); i++) { fGyr[gyr][i]->update(value); }
+ for (size_t i = 0; i < fGyr[gyr].size(); i++) {
+ fGyr[gyr][i]->update(value);
+ }
}
/**
#include <algorithm>
#include <cmath>
-static float zitarevmonodsp_faustpower2_f(float value) { return (value * value); }
+static float zitarevmonodsp_faustpower2_f(float value)
+{
+ return (value * value);
+}
#ifndef FAUSTCLASS
#define FAUSTCLASS zitarevmonodsp
virtual void instanceClear()
{
IOTA = 0;
- for (int l0 = 0; (l0 < 16384); l0 = (l0 + 1)) { fVec0[l0] = 0.0f; }
- for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) { fRec0[l1] = 0.0f; }
- for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) { fRec1[l2] = 0.0f; }
- for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) { fRec15[l3] = 0.0f; }
- for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) { fRec14[l4] = 0.0f; }
- for (int l5 = 0; (l5 < 32768); l5 = (l5 + 1)) { fVec1[l5] = 0.0f; }
- for (int l6 = 0; (l6 < 2048); l6 = (l6 + 1)) { fVec2[l6] = 0.0f; }
- for (int l7 = 0; (l7 < 2); l7 = (l7 + 1)) { fRec12[l7] = 0.0f; }
- for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) { fRec19[l8] = 0.0f; }
- for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) { fRec18[l9] = 0.0f; }
- for (int l10 = 0; (l10 < 32768); l10 = (l10 + 1)) { fVec3[l10] = 0.0f; }
- for (int l11 = 0; (l11 < 4096); l11 = (l11 + 1)) { fVec4[l11] = 0.0f; }
- for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) { fRec16[l12] = 0.0f; }
- for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) { fRec23[l13] = 0.0f; }
- for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) { fRec22[l14] = 0.0f; }
- for (int l15 = 0; (l15 < 16384); l15 = (l15 + 1)) { fVec5[l15] = 0.0f; }
- for (int l16 = 0; (l16 < 4096); l16 = (l16 + 1)) { fVec6[l16] = 0.0f; }
- for (int l17 = 0; (l17 < 2); l17 = (l17 + 1)) { fRec20[l17] = 0.0f; }
- for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) { fRec27[l18] = 0.0f; }
- for (int l19 = 0; (l19 < 2); l19 = (l19 + 1)) { fRec26[l19] = 0.0f; }
- for (int l20 = 0; (l20 < 32768); l20 = (l20 + 1)) { fVec7[l20] = 0.0f; }
- for (int l21 = 0; (l21 < 4096); l21 = (l21 + 1)) { fVec8[l21] = 0.0f; }
- for (int l22 = 0; (l22 < 2); l22 = (l22 + 1)) { fRec24[l22] = 0.0f; }
- for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) { fRec31[l23] = 0.0f; }
- for (int l24 = 0; (l24 < 2); l24 = (l24 + 1)) { fRec30[l24] = 0.0f; }
- for (int l25 = 0; (l25 < 16384); l25 = (l25 + 1)) { fVec9[l25] = 0.0f; }
- for (int l26 = 0; (l26 < 2048); l26 = (l26 + 1)) { fVec10[l26] = 0.0f; }
- for (int l27 = 0; (l27 < 2); l27 = (l27 + 1)) { fRec28[l27] = 0.0f; }
- for (int l28 = 0; (l28 < 2); l28 = (l28 + 1)) { fRec35[l28] = 0.0f; }
- for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) { fRec34[l29] = 0.0f; }
- for (int l30 = 0; (l30 < 16384); l30 = (l30 + 1)) { fVec11[l30] = 0.0f; }
- for (int l31 = 0; (l31 < 4096); l31 = (l31 + 1)) { fVec12[l31] = 0.0f; }
- for (int l32 = 0; (l32 < 2); l32 = (l32 + 1)) { fRec32[l32] = 0.0f; }
- for (int l33 = 0; (l33 < 2); l33 = (l33 + 1)) { fRec39[l33] = 0.0f; }
- for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) { fRec38[l34] = 0.0f; }
- for (int l35 = 0; (l35 < 16384); l35 = (l35 + 1)) { fVec13[l35] = 0.0f; }
- for (int l36 = 0; (l36 < 4096); l36 = (l36 + 1)) { fVec14[l36] = 0.0f; }
- for (int l37 = 0; (l37 < 2); l37 = (l37 + 1)) { fRec36[l37] = 0.0f; }
- for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) { fRec43[l38] = 0.0f; }
- for (int l39 = 0; (l39 < 2); l39 = (l39 + 1)) { fRec42[l39] = 0.0f; }
- for (int l40 = 0; (l40 < 16384); l40 = (l40 + 1)) { fVec15[l40] = 0.0f; }
- for (int l41 = 0; (l41 < 2048); l41 = (l41 + 1)) { fVec16[l41] = 0.0f; }
- for (int l42 = 0; (l42 < 2); l42 = (l42 + 1)) { fRec40[l42] = 0.0f; }
- for (int l43 = 0; (l43 < 3); l43 = (l43 + 1)) { fRec4[l43] = 0.0f; }
- for (int l44 = 0; (l44 < 3); l44 = (l44 + 1)) { fRec5[l44] = 0.0f; }
- for (int l45 = 0; (l45 < 3); l45 = (l45 + 1)) { fRec6[l45] = 0.0f; }
- for (int l46 = 0; (l46 < 3); l46 = (l46 + 1)) { fRec7[l46] = 0.0f; }
- for (int l47 = 0; (l47 < 3); l47 = (l47 + 1)) { fRec8[l47] = 0.0f; }
- for (int l48 = 0; (l48 < 3); l48 = (l48 + 1)) { fRec9[l48] = 0.0f; }
- for (int l49 = 0; (l49 < 3); l49 = (l49 + 1)) { fRec10[l49] = 0.0f; }
- for (int l50 = 0; (l50 < 3); l50 = (l50 + 1)) { fRec11[l50] = 0.0f; }
- for (int l51 = 0; (l51 < 3); l51 = (l51 + 1)) { fRec3[l51] = 0.0f; }
- for (int l52 = 0; (l52 < 3); l52 = (l52 + 1)) { fRec2[l52] = 0.0f; }
- for (int l53 = 0; (l53 < 3); l53 = (l53 + 1)) { fRec45[l53] = 0.0f; }
- for (int l54 = 0; (l54 < 3); l54 = (l54 + 1)) { fRec44[l54] = 0.0f; }
+ for (int l0 = 0; (l0 < 16384); l0 = (l0 + 1)) {
+ fVec0[l0] = 0.0f;
+ }
+ for (int l1 = 0; (l1 < 2); l1 = (l1 + 1)) {
+ fRec0[l1] = 0.0f;
+ }
+ for (int l2 = 0; (l2 < 2); l2 = (l2 + 1)) {
+ fRec1[l2] = 0.0f;
+ }
+ for (int l3 = 0; (l3 < 2); l3 = (l3 + 1)) {
+ fRec15[l3] = 0.0f;
+ }
+ for (int l4 = 0; (l4 < 2); l4 = (l4 + 1)) {
+ fRec14[l4] = 0.0f;
+ }
+ for (int l5 = 0; (l5 < 32768); l5 = (l5 + 1)) {
+ fVec1[l5] = 0.0f;
+ }
+ for (int l6 = 0; (l6 < 2048); l6 = (l6 + 1)) {
+ fVec2[l6] = 0.0f;
+ }
+ for (int l7 = 0; (l7 < 2); l7 = (l7 + 1)) {
+ fRec12[l7] = 0.0f;
+ }
+ for (int l8 = 0; (l8 < 2); l8 = (l8 + 1)) {
+ fRec19[l8] = 0.0f;
+ }
+ for (int l9 = 0; (l9 < 2); l9 = (l9 + 1)) {
+ fRec18[l9] = 0.0f;
+ }
+ for (int l10 = 0; (l10 < 32768); l10 = (l10 + 1)) {
+ fVec3[l10] = 0.0f;
+ }
+ for (int l11 = 0; (l11 < 4096); l11 = (l11 + 1)) {
+ fVec4[l11] = 0.0f;
+ }
+ for (int l12 = 0; (l12 < 2); l12 = (l12 + 1)) {
+ fRec16[l12] = 0.0f;
+ }
+ for (int l13 = 0; (l13 < 2); l13 = (l13 + 1)) {
+ fRec23[l13] = 0.0f;
+ }
+ for (int l14 = 0; (l14 < 2); l14 = (l14 + 1)) {
+ fRec22[l14] = 0.0f;
+ }
+ for (int l15 = 0; (l15 < 16384); l15 = (l15 + 1)) {
+ fVec5[l15] = 0.0f;
+ }
+ for (int l16 = 0; (l16 < 4096); l16 = (l16 + 1)) {
+ fVec6[l16] = 0.0f;
+ }
+ for (int l17 = 0; (l17 < 2); l17 = (l17 + 1)) {
+ fRec20[l17] = 0.0f;
+ }
+ for (int l18 = 0; (l18 < 2); l18 = (l18 + 1)) {
+ fRec27[l18] = 0.0f;
+ }
+ for (int l19 = 0; (l19 < 2); l19 = (l19 + 1)) {
+ fRec26[l19] = 0.0f;
+ }
+ for (int l20 = 0; (l20 < 32768); l20 = (l20 + 1)) {
+ fVec7[l20] = 0.0f;
+ }
+ for (int l21 = 0; (l21 < 4096); l21 = (l21 + 1)) {
+ fVec8[l21] = 0.0f;
+ }
+ for (int l22 = 0; (l22 < 2); l22 = (l22 + 1)) {
+ fRec24[l22] = 0.0f;
+ }
+ for (int l23 = 0; (l23 < 2); l23 = (l23 + 1)) {
+ fRec31[l23] = 0.0f;
+ }
+ for (int l24 = 0; (l24 < 2); l24 = (l24 + 1)) {
+ fRec30[l24] = 0.0f;
+ }
+ for (int l25 = 0; (l25 < 16384); l25 = (l25 + 1)) {
+ fVec9[l25] = 0.0f;
+ }
+ for (int l26 = 0; (l26 < 2048); l26 = (l26 + 1)) {
+ fVec10[l26] = 0.0f;
+ }
+ for (int l27 = 0; (l27 < 2); l27 = (l27 + 1)) {
+ fRec28[l27] = 0.0f;
+ }
+ for (int l28 = 0; (l28 < 2); l28 = (l28 + 1)) {
+ fRec35[l28] = 0.0f;
+ }
+ for (int l29 = 0; (l29 < 2); l29 = (l29 + 1)) {
+ fRec34[l29] = 0.0f;
+ }
+ for (int l30 = 0; (l30 < 16384); l30 = (l30 + 1)) {
+ fVec11[l30] = 0.0f;
+ }
+ for (int l31 = 0; (l31 < 4096); l31 = (l31 + 1)) {
+ fVec12[l31] = 0.0f;
+ }
+ for (int l32 = 0; (l32 < 2); l32 = (l32 + 1)) {
+ fRec32[l32] = 0.0f;
+ }
+ for (int l33 = 0; (l33 < 2); l33 = (l33 + 1)) {
+ fRec39[l33] = 0.0f;
+ }
+ for (int l34 = 0; (l34 < 2); l34 = (l34 + 1)) {
+ fRec38[l34] = 0.0f;
+ }
+ for (int l35 = 0; (l35 < 16384); l35 = (l35 + 1)) {
+ fVec13[l35] = 0.0f;
+ }
+ for (int l36 = 0; (l36 < 4096); l36 = (l36 + 1)) {
+ fVec14[l36] = 0.0f;
+ }
+ for (int l37 = 0; (l37 < 2); l37 = (l37 + 1)) {
+ fRec36[l37] = 0.0f;
+ }
+ for (int l38 = 0; (l38 < 2); l38 = (l38 + 1)) {
+ fRec43[l38] = 0.0f;
+ }
+ for (int l39 = 0; (l39 < 2); l39 = (l39 + 1)) {
+ fRec42[l39] = 0.0f;
+ }
+ for (int l40 = 0; (l40 < 16384); l40 = (l40 + 1)) {
+ fVec15[l40] = 0.0f;
+ }
+ for (int l41 = 0; (l41 < 2048); l41 = (l41 + 1)) {
+ fVec16[l41] = 0.0f;
+ }
+ for (int l42 = 0; (l42 < 2); l42 = (l42 + 1)) {
+ fRec40[l42] = 0.0f;
+ }
+ for (int l43 = 0; (l43 < 3); l43 = (l43 + 1)) {
+ fRec4[l43] = 0.0f;
+ }
+ for (int l44 = 0; (l44 < 3); l44 = (l44 + 1)) {
+ fRec5[l44] = 0.0f;
+ }
+ for (int l45 = 0; (l45 < 3); l45 = (l45 + 1)) {
+ fRec6[l45] = 0.0f;
+ }
+ for (int l46 = 0; (l46 < 3); l46 = (l46 + 1)) {
+ fRec7[l46] = 0.0f;
+ }
+ for (int l47 = 0; (l47 < 3); l47 = (l47 + 1)) {
+ fRec8[l47] = 0.0f;
+ }
+ for (int l48 = 0; (l48 < 3); l48 = (l48 + 1)) {
+ fRec9[l48] = 0.0f;
+ }
+ for (int l49 = 0; (l49 < 3); l49 = (l49 + 1)) {
+ fRec10[l49] = 0.0f;
+ }
+ for (int l50 = 0; (l50 < 3); l50 = (l50 + 1)) {
+ fRec11[l50] = 0.0f;
+ }
+ for (int l51 = 0; (l51 < 3); l51 = (l51 + 1)) {
+ fRec3[l51] = 0.0f;
+ }
+ for (int l52 = 0; (l52 < 3); l52 = (l52 + 1)) {
+ fRec2[l52] = 0.0f;
+ }
+ for (int l53 = 0; (l53 < 3); l53 = (l53 + 1)) {
+ fRec45[l53] = 0.0f;
+ }
+ for (int l54 = 0; (l54 < 3); l54 = (l54 + 1)) {
+ fRec44[l54] = 0.0f;
+ }
}
virtual void init(int sample_rate)
--- /dev/null
+if host_machine.system() == 'windows'
+ windows = import('windows')
+
+ src += windows.compile_resources('qjacktrip.rc',
+ depend_files: 'jacktrip.ico',
+ include_directories: '.')
+
+ defines += '-D_WIN32_WINNT=0x0600'
+ defines += '-DWIN32_LEAN_AND_MEAN'
+ defines += '-DNOMINMAX'
+
+ deps += compiler.find_library('ws2_32', required: true)
+
+ if compiler.get_id() == 'msvc'
+ opt_var = cmake.subproject_options()
+ if get_option('buildtype') == 'release'
+ opt_var.add_cmake_defines({'CMAKE_BUILD_TYPE': 'Release'})
+ else
+ opt_var.add_cmake_defines({'CMAKE_BUILD_TYPE': 'Debug'})
+ endif
+ wingetopt = cmake.subproject('wingetopt', options: opt_var)
+ deps += wingetopt.dependency('wingetopt')
+ endif
+
+endif