New upstream version 1.5.1+ds0
authorIOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org>
Wed, 19 Jan 2022 07:49:24 +0000 (08:49 +0100)
committerIOhannes m zmölnig (Debian/GNU) <umlaeute@debian.org>
Wed, 19 Jan 2022 07:49:24 +0000 (08:49 +0100)
70 files changed:
.clang-format
.clang-format-ignore [new file with mode: 0644]
.clang-tidy
CMakeLists.txt
docs/changelog.yml
docs/images/jacktrip_hubclient_basic.png [new file with mode: 0644]
docs/images/jacktrip_hubclient_plugins.png [new file with mode: 0644]
docs/images/jacktrip_hubserver_basic.png [new file with mode: 0644]
docs/images/jacktrip_hubserver_jitter.png [new file with mode: 0644]
docs/index.md
faust-src/minimal.cpp
jacktrip.pro
linux/flatpak/org.jacktrip.JackTrip.Devel.yml
linux/flatpak/org.jacktrip.JackTrip.Devel.yml.j2
linux/flatpak/org.jacktrip.JackTrip.yml
linux/org.jacktrip.JackTrip.metainfo.xml.in.in
meson.build
mkdocs.yml
src/AudioInterface.cpp
src/AudioInterface.h
src/AudioTester.cpp
src/AudioTester.h
src/Auth.cpp
src/Auth.h
src/DataProtocol.h
src/Effects.h
src/JMess.cpp
src/JMess.h
src/JackAudioInterface.cpp
src/JackAudioInterface.h
src/JackTrip.cpp
src/JackTrip.h
src/JackTripWorker.cpp
src/JackTripWorker.h
src/JitterBuffer.cpp
src/PacketHeader.cpp
src/PacketHeader.h
src/Patcher.cpp
src/Patcher.h
src/PoolBuffer.cpp
src/ProcessPlugin.h
src/RingBuffer.cpp
src/RtAudioInterface.cpp
src/RtAudioInterface.h
src/Settings.cpp
src/Settings.h
src/SslServer.cpp
src/UdpDataProtocol.cpp
src/UdpDataProtocol.h
src/UdpHubListener.cpp
src/UdpHubListener.h
src/compressordsp.h
src/freeverbdsp.h
src/freeverbmonodsp.h
src/gui/about.cpp
src/gui/messageDialog.cpp
src/gui/messageDialog.h
src/gui/qjacktrip.cpp
src/gui/qjacktrip.h
src/gui/qjacktrip.ui
src/gui/qjacktrip_novs.ui
src/gui/textbuf.cpp
src/gui/textbuf.h
src/jacktrip_globals.cpp
src/jacktrip_globals.h
src/limiterdsp.h
src/main.cpp
src/zitarevdsp.h
src/zitarevmonodsp.h
win/meson.build [new file with mode: 0644]

index 31204cb0574a4dc9b55c31a65aee5297c8b43384..9b3480121c87b756f6108c921bf06805dc352811 100644 (file)
@@ -16,10 +16,10 @@ AllowAllParametersOfDeclarationOnNextLine: true
 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
diff --git a/.clang-format-ignore b/.clang-format-ignore
new file mode 100644 (file)
index 0000000..8360478
--- /dev/null
@@ -0,0 +1 @@
+externals/*
index 5c342d665fca4bc55a78c3d34ac7c6c9bfb48063..864b26fd899a146436649ee0169829f74d0b8afc 100644 (file)
@@ -1 +1 @@
-Checks: '-*,modernize-deprecated-headers,modernize-loop-convert'
+Checks: '-*,modernize-deprecated-headers,modernize-loop-convert,google-build-using-namespace'
index fbba160c2b05332be4b1cb11fee7b4d5a109ffe4..47f4c321feb62027ed81b3ed8d05daa5d235815f 100644 (file)
@@ -13,7 +13,7 @@ if (nogui)
 endif ()
 
 if (rtaudio)
-  add_compile_definitions(__RT_AUDIO__)
+  add_compile_definitions(RT_AUDIO)
 endif ()
 
 if (weakjack)
@@ -21,13 +21,10 @@ 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")
index 636ad51d690c75392376ad6b40d45b49e62906e5..9935aeb7d28a49764f3695030c2c71311aac8825 100644 (file)
@@ -1,3 +1,14 @@
+- 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:
@@ -48,6 +59,7 @@
   - (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
diff --git a/docs/images/jacktrip_hubclient_basic.png b/docs/images/jacktrip_hubclient_basic.png
new file mode 100644 (file)
index 0000000..a932eb4
Binary files /dev/null and b/docs/images/jacktrip_hubclient_basic.png differ
diff --git a/docs/images/jacktrip_hubclient_plugins.png b/docs/images/jacktrip_hubclient_plugins.png
new file mode 100644 (file)
index 0000000..5b39db7
Binary files /dev/null and b/docs/images/jacktrip_hubclient_plugins.png differ
diff --git a/docs/images/jacktrip_hubserver_basic.png b/docs/images/jacktrip_hubserver_basic.png
new file mode 100644 (file)
index 0000000..e77d95e
Binary files /dev/null and b/docs/images/jacktrip_hubserver_basic.png differ
diff --git a/docs/images/jacktrip_hubserver_jitter.png b/docs/images/jacktrip_hubserver_jitter.png
new file mode 100644 (file)
index 0000000..556cc75
Binary files /dev/null and b/docs/images/jacktrip_hubserver_jitter.png differ
index 8c39f3a7bff8a83bd5777e33662bf5d8e7bbb6cb..ececbf5ba0873fa171a7fc47488d96a9a9635f0a 100644 (file)
@@ -4,3 +4,24 @@ JackTrip is a Linux, macOS, or Windows multi-machine audio system used for netwo
 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"
+
+    ![JackTrip Hubclient](images/jacktrip_hubclient_basic.png){width=450}
+
+=== "Hubclient // Plugins"
+
+    ![JackTrip Hubclient](images/jacktrip_hubclient_plugins.png){width=450}
+
+=== "HubServer // Basic"
+
+    ![JackTrip Hubserver](images/jacktrip_hubserver_basic.png){width=450}
+
+=== "HubServer // Jitter Buffer"
+
+    ![JackTrip Hubserver](images/jacktrip_hubserver_jitter.png){width=450}
+
index 3310519d01953973cad561e8a74ea7c39b448757..eb36d3cf0d2067bf2c389e5662100ce37cfb7b2f 100644 (file)
@@ -6,7 +6,10 @@
 // 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);
+}
 
 /******************************************************************************
 *******************************************************************************
index d8ef28504860514b69b578b2d9d73638974f3ef9..c811c8056d4f1ef94f08adad41d4cdce609de74d 100644 (file)
@@ -36,11 +36,11 @@ DEFINES += WAIRTOHUB
 # 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
@@ -99,7 +99,6 @@ macx {
   #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
@@ -130,7 +129,6 @@ linux-g++ | linux-g++-64 {
   }
   
   QMAKE_CXXFLAGS += -g -O2
-  DEFINES += __LINUX__
 }
 
 linux-g++ {
@@ -174,9 +172,9 @@ win32 {
     }
   }
   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 = .
index 62bc1786dbd130a24b5df82234e0e02a8c07e6f9..8fe947ca2f38af41ca252e209dc4a7f6b35d93f4 100644 (file)
@@ -7,20 +7,22 @@ finish-args:
   # 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:
@@ -29,6 +31,7 @@ modules:
       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:
index 89961f34e375dc61c322a8787d42cd2564f21509..93c7f2815ff97c14c50a5feaeb56e47a151d1268 100644 (file)
@@ -7,20 +7,22 @@ finish-args:
   # 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:
@@ -29,6 +31,7 @@ modules:
       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:
index 9d358738dbfd7e3cf04929faae37e4f9215e8f91..eda815278ca5f659458448911b4afe0e0bd22dc8 100644 (file)
@@ -7,20 +7,22 @@ finish-args:
   # 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:
@@ -29,6 +31,7 @@ modules:
       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:
index a0822699425dd6e37efe08f4e091380b97a86663..105afa26454c3048190c19ad925c79b0343635d1 100644 (file)
@@ -7,6 +7,11 @@
   <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 %}
index 258661beac9b438c74772db725f1c2e300a5c25e..3de6dad223ab57c475f4fd969802fcd881911685 100644 (file)
@@ -16,18 +16,7 @@ compiler = meson.get_compiler('cpp')
 
 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',
@@ -62,17 +51,21 @@ moc_h = ['src/DataProtocol.h',
 
 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'
@@ -111,26 +104,11 @@ defines += '-DQT_OPENSOURCE'
 
 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
@@ -142,9 +120,7 @@ if host_machine.system() == 'darwin'
        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')
index a4a907dd2ee4f2c5342c46aa8e24cdd493e2b957..705e991c9be3ecfa44cfab7e309df36d10357fd5 100644 (file)
@@ -29,8 +29,10 @@ theme:
   features:
     - navigation.tabs
 markdown_extensions:
+  - attr_list
   - pymdownx.snippets
-  - pymdownx.tabbed
+  - pymdownx.tabbed:
+      alternate_style: true
   - pymdownx.superfences
   - pymdownx.details
   - admonition
index c49855772dc44d37e9030929f3e8aceaf17512c2..ba6547785ce6f59179425d8ff3860b32a891fa13 100644 (file)
@@ -75,15 +75,25 @@ AudioInterface::AudioInterface(JackTrip* jacktrip, int NumInChans, int NumOutCha
     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);
@@ -99,21 +109,37 @@ AudioInterface::~AudioInterface()
     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];
+    }
 }
 
 //*******************************************************************************
@@ -317,7 +343,9 @@ void AudioInterface::callback(QVarLengthArray<sample_t*>& in_buffer,
         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
 
@@ -330,7 +358,9 @@ void AudioInterface::callback(QVarLengthArray<sample_t*>& in_buffer,
         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);
@@ -344,7 +374,9 @@ void AudioInterface::callback(QVarLengthArray<sample_t*>& in_buffer,
         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
@@ -607,7 +639,9 @@ void AudioInterface::fromBitToSampleConversion(
 //*******************************************************************************
 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));
@@ -624,7 +658,9 @@ void AudioInterface::appendProcessPluginToNetwork(ProcessPlugin* plugin)
 
 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));
index 7885e4c19c4c4d35f50ae9f4fdd622fc333b7fb4..db28f42ba82abc5e8e1b743af477729e5f27a042 100644 (file)
@@ -180,7 +180,7 @@ class AudioInterface
         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; }
index 85bf867a486c2bab8265fdae6405b39e872a6e37..1f5a0c0ce4b6e305449295dc94ec0db9e0a5da74 100644 (file)
@@ -195,7 +195,9 @@ void AudioTester::writeImpulse(QVarLengthArray<sample_t*>& mInBufCopy,
         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
@@ -213,7 +215,9 @@ void AudioTester::writeImpulse(QVarLengthArray<sample_t*>& mInBufCopy,
         } 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--;
index 6e2d55da94e62082ae5082128c9e54c6f563575b..cfd508d3ce51f69f860938343d5f5a3f69b846d5 100644 (file)
@@ -163,7 +163,9 @@ class AudioTester
         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;
     }
@@ -171,7 +173,9 @@ class AudioTester
     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;
@@ -180,7 +184,9 @@ class AudioTester
     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;
@@ -209,12 +215,18 @@ class AudioTester
                 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;
     }
 };
index 10dc553159a1127e94424801bdacf250f0764a4e..3cbd35197374ca448fcac9a408a9588d94162573 100644 (file)
 #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);
@@ -55,13 +57,16 @@ Auth::Auth(QString fileName)
                      &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]) {
@@ -86,7 +91,7 @@ void Auth::reloadAuthFile()
     loadAuthFile(m_authFileName);
 }
 
-void Auth::loadAuthFile(QString filename)
+void Auth::loadAuthFile(const QString& filename)
 {
     QFile file(filename);
     if (file.open(QIODevice::ReadOnly)) {
@@ -98,7 +103,7 @@ void Auth::loadAuthFile(QString filename)
         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
@@ -109,8 +114,8 @@ void Auth::loadAuthFile(QString filename)
 
             // 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()) {
@@ -132,13 +137,13 @@ void Auth::loadAuthFile(QString filename)
     }
 }
 
-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;
     }
 
@@ -148,14 +153,16 @@ bool Auth::checkTime(QString username)
         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;
@@ -180,7 +187,9 @@ char Auth::char64(int value)
 {
     // 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);
@@ -206,7 +215,8 @@ QByteArray Auth::charGroup(unsigned char byte2, unsigned char byte1, unsigned ch
     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)
@@ -232,7 +242,9 @@ QByteArray Auth::generateSha512Hash(QString passwordString, QString saltString)
 
     // 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
@@ -250,23 +262,31 @@ QByteArray Auth::generateSha512Hash(QString passwordString, QString saltString)
     // 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
@@ -279,8 +299,12 @@ QByteArray Auth::generateSha512Hash(QString passwordString, QString saltString)
             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);
index 875d78b1ccbd39cf90abda931e62a89ba254453c..712f5249edce3dddc62a796680d4a4b7f0d28ba1 100644 (file)
@@ -54,22 +54,23 @@ class Auth : public QObject
         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;
index 81bbada2e7a9095fa83f8d047b25bd421c8eaf4d..b01643fef60d64668a7b0840d930c10950e25a72 100644 (file)
 #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
@@ -162,7 +162,7 @@ class DataProtocol : public QThread
     // 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;
@@ -187,7 +187,7 @@ class DataProtocol : public QThread
 
     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
index ad2acd126c6d85f69eabf3315b2a30db92e15742..89516eae7077331243e4727e91d5dd12bf41d6f2 100644 (file)
@@ -166,21 +166,27 @@ class Effects
             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:
@@ -214,21 +220,27 @@ class Effects
             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:
@@ -501,7 +513,9 @@ class Effects
             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;
@@ -658,8 +672,12 @@ class Effects
                 // 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";
                 }
index 9b296ce0954cae10269d529f33cde0b6e2eeeece..85c6029c6df232361c10a26a871be1e7d54db0bf 100644 (file)
@@ -55,11 +55,12 @@ JMess::JMess()
     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);
     }
@@ -73,196 +74,8 @@ JMess::JMess()
 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";
 }
 
 //*******************************************************************************
@@ -318,8 +131,8 @@ void JMess::connectTUB(int /*nChans*/)
         {
             // 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 "
@@ -342,7 +155,7 @@ void JMess::connectTUB(int /*nChans*/)
                      << 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
@@ -353,117 +166,3 @@ void JMess::connectTUB(int /*nChans*/)
             }
         }
 }
-
-//-------------------------------------------------------------------------------
-/*! \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";
-    // }
-    //      }
-    //    }
-    //  }
-}
index f801a94a284814fcd64ce2f78f1960cb774e4d6c..afb78c30901eba0115ccfa1ae980a21cc3433ad0 100644 (file)
 #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
@@ -53,8 +44,6 @@
 
 #include <QMutexLocker>
 
-using namespace std;
-
 const int Indent = 2;
 
 //-------------------------------------------------------------------------------
@@ -72,27 +61,12 @@ class JMess
     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
index 9f02a237a17d96d6f48201457aba7a4b18db6763..56254351dba168797ccda78d59a0bec973accca5 100644 (file)
@@ -66,7 +66,7 @@ JackAudioInterface::JackAudioInterface(
 #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,
@@ -102,7 +102,9 @@ void JackAudioInterface::setupClient()
     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);
     }
 
@@ -142,7 +144,9 @@ void JackAudioInterface::setupClient()
     }
 
     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());
index 369a25baf7bd6652529aab8afe10a0aa8f95fde8..44884f1a50c529781a96f82f0272847d0c786f42 100644 (file)
@@ -79,7 +79,7 @@ class JackAudioInterface : public AudioInterface
         int NumNetRevChans,
 #endif  // endwhere
         AudioInterface::audioBitResolutionT AudioBitResolution = AudioInterface::BIT16,
-        QString ClientName                                     = "JackTrip");
+        const QString& ClientName = QStringLiteral("JackTrip"));
     /// \brief The class destructor
     virtual ~JackAudioInterface();
 
@@ -99,7 +99,7 @@ class JackAudioInterface : public AudioInterface
 
     //--------------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."
index e3733d51e4858633b4900daf87f2c138ebb8c7bf..661a87ba88dcc30fec70aa6a1cfef2ced89ff303 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "JackTrip.h"
 
-#ifndef __NO_JACK__
+#ifndef NO_JACK
 #include "JackAudioInterface.h"
 #endif
 #include "Auth.h"
@@ -46,7 +46,7 @@
 #include "RingBufferWavetable.h"
 #include "UdpDataProtocol.h"
 #include "jacktrip_globals.h"
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
 #include "RtAudioInterface.h"
 #endif
 
@@ -66,7 +66,7 @@ using std::endl;
 // 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);
@@ -87,8 +87,9 @@ JackTrip::JackTrip(jacktripModeT JacktripMode, dataProtocolT DataProtocolType,
                    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)
@@ -174,7 +175,7 @@ void JackTrip::setupAudio(
 
     // 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;
@@ -190,7 +191,8 @@ void JackTrip::setupAudio(
         // 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;
             }
@@ -200,7 +202,9 @@ void JackTrip::setupAudio(
 
 #endif  // endwhere
         mAudioInterface->setClientName(mJackClientName);
-        if (0 < mBroadcastQueueLength) { mAudioInterface->enableBroadcastOutput(); }
+        if (0 < mBroadcastQueueLength) {
+            mAudioInterface->enableBroadcastOutput();
+        }
 
         if (gVerboseFlag)
             std::cout << "  JackTrip:setupAudio before mAudioInterface->setup"
@@ -219,9 +223,9 @@ void JackTrip::setupAudio(
                 << "  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);
@@ -239,7 +243,7 @@ void JackTrip::setupAudio(
 #endif
 #endif
     } else if (mAudiointerfaceMode == JackTrip::RTAUDIO) {
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
         mAudioInterface = new RtAudioInterface(this, mNumAudioChansIn, mNumAudioChansOut,
                                                mAudioBitResolution);
         mAudioInterface->setSampleRate(mSampleRate);
@@ -257,9 +261,8 @@ void JackTrip::setupAudio(
     }
 
     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());
@@ -401,7 +404,10 @@ void JackTrip::setupRingBuffers()
 }
 
 //*******************************************************************************
-void JackTrip::setPeerAddress(QString PeerHostOrIP) { mPeerAddress = PeerHostOrIP; }
+void JackTrip::setPeerAddress(const QString& PeerHostOrIP)
+{
+    mPeerAddress = PeerHostOrIP;
+}
 
 //*******************************************************************************
 void JackTrip::appendProcessPluginToNetwork(ProcessPlugin* plugin)
@@ -428,7 +434,7 @@ void JackTrip::startProcess(
 #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);
@@ -436,13 +442,14 @@ void JackTrip::startProcess(
 #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;
@@ -470,8 +477,9 @@ void JackTrip::startProcess(
     // -------------------------
     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),
@@ -491,33 +499,38 @@ void JackTrip::startProcess(
     // ---------------------------------------
     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"
@@ -537,7 +550,7 @@ void JackTrip::startProcess(
 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;
@@ -562,7 +575,8 @@ void JackTrip::completeConnection()
      * 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;
@@ -575,7 +589,9 @@ void JackTrip::completeConnection()
     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
@@ -585,7 +601,7 @@ void JackTrip::completeConnection()
             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);
     }
 }
@@ -594,12 +610,18 @@ void JackTrip::completeConnection()
 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;
@@ -629,11 +651,14 @@ void JackTrip::receivedConnectionTCP()
 {
     {
         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.
@@ -641,7 +666,8 @@ void JackTrip::receivedConnectionTCP()
         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
@@ -673,7 +699,8 @@ void JackTrip::receivedConnectionTCP()
     /*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
 }
 
@@ -694,11 +721,11 @@ void JackTrip::receivedDataTCP()
             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
@@ -722,12 +749,16 @@ void JackTrip::receivedDataTCP()
         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
     // --------------------------------
@@ -749,11 +780,12 @@ void JackTrip::receivedDataTCP()
     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);
@@ -761,17 +793,18 @@ void JackTrip::receivedDataTCP()
     } 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
     // ------------------------------
@@ -839,7 +872,9 @@ void JackTrip::receivedDataUDP()
     // Stop our timer.
     {
         QMutexLocker lock(&mTimerMutex);
-        if (!mAwaitingUdp) { return; }
+        if (!mAwaitingUdp) {
+            return;
+        }
         mAwaitingUdp = false;
         mTimeoutTimer.stop();
     }
@@ -898,7 +933,9 @@ void JackTrip::receivedDataUDP()
 void JackTrip::udpTimerTick()
 {
     QMutexLocker lock(&mTimerMutex);
-    if (!mAwaitingUdp) { return; }
+    if (!mAwaitingUdp) {
+        return;
+    }
 
     if (mStopped || sSigInt || sJackStopped) {
         // Stop everything.
@@ -908,21 +945,24 @@ void JackTrip::udpTimerTick()
         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.
@@ -938,16 +978,18 @@ void JackTrip::tcpTimerTick()
         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;
 
@@ -968,7 +1010,7 @@ void JackTrip::stop(QString errorMessage)
 
     // 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 {
@@ -1018,7 +1060,9 @@ int JackTrip::serverStart(bool timeout, int udpTimeout)  // udpTimeout unused
         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();
@@ -1100,7 +1144,7 @@ int JackTrip::clientPingToServerStart()
         QHostInfo info = QHostInfo::fromName(mPeerAddress);
         if (!info.addresses().isEmpty()) {
             // use the first IP address
-            serverHostAddress = info.addresses().first();
+            serverHostAddress = info.addresses().constFirst();
         }
     }
 
@@ -1197,10 +1241,10 @@ active address local_addr.sin_port = htons(bind_port); //set bind port
 
   // 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));
index f7fa1f6b65dd04e20c43963a35cf2a4ec92d9fbb..d2bde18070d4fe4b5d386691edef8c5701223608 100644 (file)
@@ -50,9 +50,9 @@
 #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"
@@ -118,7 +118,9 @@ class JackTrip : public QObject
         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
     };
     //---------------------------------------------------------
 
@@ -142,7 +144,8 @@ class JackTrip : public QObject
         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();
@@ -162,7 +165,7 @@ class JackTrip : public QObject
     }*/
 
     /// \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
@@ -180,7 +183,7 @@ class JackTrip : public QObject
     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
@@ -257,11 +260,14 @@ class JackTrip : public QObject
     }
     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;
     }
@@ -423,14 +429,14 @@ class JackTrip : public QObject
     {
         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
@@ -538,7 +544,9 @@ class JackTrip : public QObject
         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();
         }
     }
index 560eba2120873c372592921b4f4ddc46f5cdd49d..7130a0f0edfaac566216f03af52dc5cef9c5abf4 100644 (file)
@@ -57,7 +57,8 @@ using std::endl;
 
 //*******************************************************************************
 JackTripWorker::JackTripWorker(UdpHubListener* udphublistener, int BufferQueueLength,
-                               JackTrip::underrunModeT UnderRunMode, QString clientName)
+                               JackTrip::underrunModeT UnderRunMode,
+                               const QString& clientName)
     : mAppendThreadID(false)
     , mSleepTime(100)
     , mUdpHubListener(udphublistener)
@@ -72,14 +73,15 @@ JackTripWorker::JackTripWorker(UdpHubListener* udphublistener, int BufferQueueLe
 }
 
 //*******************************************************************************
-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;
@@ -96,11 +98,12 @@ void JackTripWorker::setJackTrip(int id, QString client_address, uint16_t server
     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
@@ -171,14 +174,18 @@ void JackTripWorker::start()
         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);
@@ -210,7 +217,7 @@ void JackTripWorker::stopThread()
     if (mRunning) {
         mRunning = false;
         mJackTrip->slotStopProcesses();
-#ifndef __NO_JACK__
+#ifndef NO_JACK
         if (mPatched) {
             mUdpHubListener->unregisterClientWithPatcher(mAssignedClientName);
             mPatched = false;
@@ -297,14 +304,15 @@ void JackTripWorker::receivedDataUDP()
             &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
@@ -324,7 +332,8 @@ void JackTripWorker::udpTimerTick()
         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;
@@ -343,7 +352,7 @@ void JackTripWorker::jacktripStopped()
         return;
     }
     mRunning = false;
-#ifndef __NO_JACK__
+#ifndef NO_JACK
     if (mPatched) {
         mUdpHubListener->unregisterClientWithPatcher(mAssignedClientName);
         mPatched = false;
@@ -354,7 +363,7 @@ void JackTripWorker::jacktripStopped()
 
 void JackTripWorker::alertPatcher()
 {
-#ifndef __NO_JACK__
+#ifndef NO_JACK
     QMutexLocker lock(&mMutex);
     if (mRunning) {
         mAssignedClientName = mJackTrip->getAssignedClientName();
index e05dbdc25e9f5b22b886b88a77e238733b390e86..18a81279e258fe20622db5ea256ca22e533e868f 100644 (file)
@@ -73,7 +73,7 @@ class JackTripWorker : public QObject
     JackTripWorker(UdpHubListener* udphublistener,
                    int BufferQueueLength                = gDefaultQueueLength,
                    JackTrip::underrunModeT UnderRunMode = JackTrip::WAVETABLE,
-                   QString clientName                   = "");
+                   const QString& clientName            = QLatin1String(""));
     /// \brief The class destructor
     ~JackTripWorker() = default;
 
@@ -96,7 +96,7 @@ class JackTripWorker : public QObject
     /// \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();
index 27385f728540c4192b39822f9a9cc5ee24e741fb..003a0f93534af4423ba6347c3385e081ab10684a 100644 (file)
@@ -119,12 +119,20 @@ JitterBuffer::JitterBuffer(int buf_samples, int qlen, int sample_rate, int strat
 //*******************************************************************************
 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;
@@ -201,7 +209,9 @@ void JitterBuffer::readSlotNonBlocking(int8_t* ptrToReadSlot)
     } 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)) {
@@ -275,7 +285,9 @@ void JitterBuffer::readBroadcastSlot(int8_t* ptrToReadSlot)
             // 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;
index a9e0c5af6f2e4432311e78951133a979c5926838..6653e01d1d41a35589f0d02ac45d55c083414d7f 100644 (file)
@@ -37,7 +37,7 @@
 
 #include "PacketHeader.h"
 
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
 #include <sys/time.h>
 #endif
 
@@ -54,10 +54,10 @@ using std::endl;
 // 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 */
@@ -141,10 +141,11 @@ bool DefaultHeader::checkPeerSettings(int8_t* full_packet)
             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;
@@ -163,10 +164,11 @@ bool DefaultHeader::checkPeerSettings(int8_t* full_packet)
         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
@@ -179,8 +181,9 @@ bool DefaultHeader::checkPeerSettings(int8_t* full_packet)
         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));
     }
@@ -190,7 +193,8 @@ bool DefaultHeader::checkPeerSettings(int8_t* full_packet)
         // 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;
@@ -296,8 +300,8 @@ void JamLinkHeader::fillHeaderCommonFromAudio()
         // 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
@@ -307,7 +311,8 @@ void JamLinkHeader::fillHeaderCommonFromAudio()
         // 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
@@ -316,9 +321,9 @@ void JamLinkHeader::fillHeaderCommonFromAudio()
         // 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;
@@ -339,7 +344,7 @@ void JamLinkHeader::fillHeaderCommonFromAudio()
         // 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;
     }
 }
index b835dc0b32ec214c55797b39b3732cb8f6e90ac8..30e9480321e83492279f2eaeb944920580dde3cf 100644 (file)
@@ -109,7 +109,7 @@ struct JamLinkHeaderStuct : public HeaderStruct {
  */
 class PacketHeader : public QObject
 {
-    Q_OBJECT;
+    Q_OBJECT
 
    public:
     /// \brief The class Constructor
@@ -178,6 +178,8 @@ class PacketHeader : public QObject
  */
 class DefaultHeader : public PacketHeader
 {
+    Q_OBJECT
+
    public:
     DefaultHeader(JackTrip* jacktrip);
     virtual ~DefaultHeader() {}
@@ -221,6 +223,8 @@ class DefaultHeader : public PacketHeader
  */
 class JamLinkHeader : public PacketHeader
 {
+    Q_OBJECT
+
    public:
     JamLinkHeader(JackTrip* jacktrip);
     virtual ~JamLinkHeader() {}
@@ -277,6 +281,8 @@ class JamLinkHeader : public PacketHeader
  */
 class EmptyHeader : public PacketHeader
 {
+    Q_OBJECT
+
    public:
     EmptyHeader(JackTrip* jacktrip);
     virtual ~EmptyHeader() {}
index d8083a63261dfdedf36399cd94f1d0ebb1967311..f4aa065f59244fbb8ddeb2eb60051d4d30d4e561 100644 (file)
  */
 
 #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)
@@ -52,13 +60,6 @@ void Patcher::registerClient(const QString& clientName)
 {
     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);
@@ -78,68 +79,91 @@ void Patcher::registerClient(const QString& clientName)
     // 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));
+                        }
                     }
                 }
             }
@@ -170,5 +194,7 @@ void Patcher::shutdownCallback(void* arg)
 
 Patcher::~Patcher()
 {
-    if (m_jackClient) { jack_client_close(m_jackClient); }
+    if (m_jackClient) {
+        jack_client_close(m_jackClient);
+    }
 }
index 276eb59a3075a8e8bc5b084156e0ce989c13e269..0f2f5b0b3fc8bc089e1ec3507c88525d92ea9b6b 100644 (file)
@@ -52,7 +52,7 @@ class Patcher : public QObject
     Q_OBJECT
 
    public:
-    Patcher() = default;
+    Patcher(QObject* parent = nullptr) : QObject(parent) {}
     virtual ~Patcher();
 
     void setPatchMode(JackTrip::hubConnectionModeT patchMode);
@@ -67,8 +67,11 @@ class Patcher : public QObject
    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;
index f07d77a6bfde1e9a600813272770505cda0d6b22..343c284a2e7b76b305173a90ec919a98c9b75f95 100644 (file)
@@ -91,7 +91,8 @@ PoolBuffer::PoolBuffer(int /*sample_rate*/, int channels, int bit_res, int FPP,
         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];
@@ -116,7 +117,8 @@ PoolBuffer::PoolBuffer(int /*sample_rate*/, int channels, int bit_res, int FPP,
     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;
@@ -170,7 +172,8 @@ bool PoolBuffer::pushPacket(const int8_t* buf)
             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;
@@ -192,7 +195,9 @@ void PoolBuffer::pullPacket(int8_t* buf)
     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;
@@ -347,7 +352,8 @@ void BurgAlgorithm::train(vector<long double>& coeffs, const vector<float>& x)
     // 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
@@ -367,9 +373,12 @@ void BurgAlgorithm::train(vector<long double>& coeffs, const vector<float>& x)
     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;
@@ -410,7 +419,9 @@ void BurgAlgorithm::predict(vector<long double>& coeffs, vector<float>& tail)
     //    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];
+        }
     }
 }
 
index 4f4862e9782890d0c350b97ea69d5649fac03a17..18e99b32a6ab306fe131bd62cec937607ae8d0ea 100644 (file)
@@ -48,7 +48,7 @@
  * 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
@@ -72,7 +72,9 @@ class ProcessPlugin : public QObject
     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; }
index e4b23c611b0c4381d172bbe672a86e4c80d3c910..9e5ffc794fe8fee0d19687cdd3204ef82aa36caa 100644 (file)
@@ -129,7 +129,9 @@ void RingBuffer::readSlotBlocking(int8_t* ptrToReadSlot)
     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
index de98d5a5e834508ed8967d08068a3779c8d9f427..1797d3264e868c17fec99fc3da1e8adc06593558 100644 (file)
@@ -54,7 +54,10 @@ RtAudioInterface::RtAudioInterface(JackTrip* jacktrip, int NumInChans, int NumOu
 }
 
 //*******************************************************************************
-RtAudioInterface::~RtAudioInterface() { delete mRtAudio; }
+RtAudioInterface::~RtAudioInterface()
+{
+    delete mRtAudio;
+}
 
 //*******************************************************************************
 void RtAudioInterface::setup()
@@ -140,7 +143,7 @@ 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
@@ -261,9 +264,15 @@ void RtAudioInterface::printDeviceInfo(unsigned int deviceId)
         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;
+    }
 }
 
 //*******************************************************************************
index e3fc7d6d81a6c04e65ac95a7c7f9008f2e2c28ff..5915ad4272851e58ed80942d6d9fe04f65512ae2 100644 (file)
@@ -72,7 +72,7 @@ class RtAudioInterface : public AudioInterface
 
     //--------------SETTERS---------------------------------------------
     /// \brief This has no effect in RtAudio
-    virtual void setClientName(QString /*ClientName*/) {}
+    virtual void setClientName(const QString& /*ClientName*/) {}
     //------------------------------------------------------------------
 
     //--------------GETTERS---------------------------------------------
index 4854d7b3606c2cccbb4de8f8a12dbf47482e8f9f..4084c067f4f42ce5c8a51f534a382d54c47218cf 100644 (file)
 
 #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
 
@@ -146,7 +146,7 @@ void Settings::parseInput(int argc, char** argv)
         {"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,
@@ -163,7 +163,8 @@ void Settings::parseInput(int argc, char** argv)
         {"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,
@@ -198,11 +199,11 @@ void Settings::parseInput(int argc, char** argv)
     //----------------------------------------------------------------------------
     /// \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)) {
@@ -321,7 +322,9 @@ void Settings::parseInput(int argc, char** argv)
             //-------------------------------------------------------
             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"
@@ -373,7 +376,7 @@ void Settings::parseInput(int argc, char** argv)
         case OPT_APPENDTHREADID:
             mAppendThreadID = true;
             break;
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
         case 'R':  // RtAudio
             //-------------------------------------------------------
             mUseJack = false;
@@ -427,7 +430,8 @@ void Settings::parseInput(int argc, char** argv)
         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':
@@ -451,6 +455,9 @@ void Settings::parseInput(int argc, char** argv)
                 std::exit(1);
             }
             break;
+        case 'i':
+            mPatchServerAudio = true;
+            break;
         case 'u':
             mStereoUpmix = true;
             break;
@@ -466,11 +473,11 @@ void Settings::parseInput(int argc, char** argv)
         case 'G':  // IO Stat log file
             //-------------------------------------------------------
             {
-                std::ofstream *outStream = new std::ofstream(optarg);
+                std::ofstreamoutStream = 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);
@@ -510,7 +517,9 @@ void Settings::parseInput(int argc, char** argv)
         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);
@@ -525,7 +534,9 @@ void Settings::parseInput(int argc, char** argv)
         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);
@@ -616,7 +627,9 @@ void Settings::parseInput(int argc, char** argv)
         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();
@@ -731,14 +744,6 @@ void Settings::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;
@@ -771,6 +776,20 @@ void Settings::printUsage()
             "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"
@@ -784,7 +803,7 @@ void Settings::printUsage()
             "(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"
@@ -842,7 +861,7 @@ void Settings::printUsage()
     // clang-format on
 }
 
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
 void Settings::setDevicesByString(std::string nameArg)
 {
     size_t commaPos;
@@ -875,6 +894,17 @@ UdpHubListener* Settings::getConfiguredHubServer()
 #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.
@@ -893,7 +923,9 @@ UdpHubListener* Settings::getConfiguredHubServer()
     udpHub->setBroadcast(mBroadcastQueue);
     udpHub->setUseRtUdpPriority(mUseRtUdpPriority);
 
-    if (true == mAppendThreadID) { udpHub->mAppendThreadID = true; }
+    if (true == mAppendThreadID) {
+        udpHub->mAppendThreadID = true;
+    }
 
     if (mIOStatTimeout > 0) {
         udpHub->setIOStatTimeout(mIOStatTimeout);
@@ -936,7 +968,9 @@ JackTrip* Settings::getConfiguredJackTrip()
     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);
@@ -971,17 +1005,25 @@ JackTrip* Settings::getConfiguredJackTrip()
     }
 
     // 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);
@@ -1052,11 +1094,15 @@ JackTrip* Settings::getConfiguredJackTrip()
 
     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) {
@@ -1076,21 +1122,15 @@ JackTrip* Settings::getConfiguredJackTrip()
                 "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);
index 88324ffacf37656dd33ef7fbeb2c81b0f49df130..ba10b8a695bbae51d2dcf1e4a608deab77c906ae 100644 (file)
@@ -44,9 +44,9 @@
 
 #include "DataProtocol.h"
 
-#ifndef __NO_JACK__
+#ifndef NO_JACK
 #include "JackAudioInterface.h"
-#endif  //__NO_JACK__
+#endif  // NO_JACK
 
 #include "AudioTester.h"
 #include "Effects.h"
@@ -60,7 +60,9 @@ class Settings : public QObject
     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);
@@ -70,7 +72,7 @@ class Settings : public QObject
 
     /// \brief Prints usage help
     void printUsage();
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
     void setDevicesByString(std::string nameArg);
 #endif
 
@@ -116,13 +118,14 @@ class Settings : public QObject
     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;
index b37126826ec4d190dbf0b0759f83c7d74a442372..5b2908d7eca27d2e117166e60bcbe07c0d7963a2 100644 (file)
@@ -56,6 +56,9 @@ void SslServer::setCertificate(const QSslCertificate& certificate)
     m_certificate = certificate;
 }
 
-void SslServer::setPrivateKey(const QSslKey& key) { m_privateKey = key; }
+void SslServer::setPrivateKey(const QSslKey& key)
+{
+    m_privateKey = key;
+}
 
 SslServer::~SslServer() = default;
index 7dab7c1a05e1c0d9ecee7475a8eef340284816c7..5752448079a175a3bb2d00cd10c21f0c69de991a 100644 (file)
 
 #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
 
@@ -95,8 +95,8 @@ UdpDataProtocol::UdpDataProtocol(JackTrip* jacktrip, const runModeT runmode,
     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;
@@ -110,7 +110,7 @@ UdpDataProtocol::~UdpDataProtocol()
     delete[] mAudioPacket;
     delete[] mFullPacket;
     if (mRunMode == RECEIVER) {
-#ifdef __WIN_32__
+#ifdef _WIN32
         closesocket(mSocket);
 #else
         ::close(mSocket);
@@ -123,7 +123,7 @@ UdpDataProtocol::~UdpDataProtocol()
 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)) {
@@ -131,11 +131,11 @@ void UdpDataProtocol::setPeerAddress(const char* 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
 
@@ -143,7 +143,8 @@ void UdpDataProtocol::setPeerAddress(const char* peerHostOrIP)
     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;
@@ -172,14 +173,14 @@ void UdpDataProtocol::setPeerAddress(const char* peerHostOrIP)
     }
 }
 
-#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) {
@@ -198,7 +199,7 @@ void UdpDataProtocol::setSocket(int& socket)
 }
 
 //*******************************************************************************
-#if defined(__WIN_32__)
+#if defined(_WIN32)
 SOCKET UdpDataProtocol::bindSocket()
 #else
 int UdpDataProtocol::bindSocket()
@@ -206,7 +207,7 @@ int UdpDataProtocol::bindSocket()
 {
     QMutexLocker locker(&sUdpMutex);
 
-#if defined __WIN_32__
+#if defined _WIN32
     WORD wVersionRequested;
     WSADATA wsaData;
     int err;
@@ -233,7 +234,7 @@ int UdpDataProtocol::bindSocket()
     SOCKET sock_fd;
 #endif
 
-#if defined(__LINUX__) || defined(__MAC_OSX__)
+#if defined(__linux__) || defined(__APPLE__)
     int sock_fd;
 #endif
 
@@ -261,15 +262,15 @@ int UdpDataProtocol::bindSocket()
 
     // 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
@@ -302,11 +303,11 @@ int UdpDataProtocol::bindSocket()
         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)
         {
@@ -356,7 +357,7 @@ int UdpDataProtocol::receivePacket(char* buf, const size_t n)
         }
         if (exit && !mStopSignalSent) {
             mStopSignalSent = true;
-            emit signalCeaseTransmission("Peer Stopped");
+            emit signalCeaseTransmission(QStringLiteral("Peer Stopped"));
             std::cout << "Peer Stopped" << std::endl;
         }
         return 0;
@@ -367,7 +368,7 @@ int UdpDataProtocol::receivePacket(char* buf, const size_t n)
 //*******************************************************************************
 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;
@@ -397,7 +398,9 @@ functions. DWORD n_bytes; WSABUF buffer; int error; buffer.len = n; buffer.buf =
 void UdpDataProtocol::getPeerAddressFromFirstPacket(QHostAddress& peerHostAddress,
                                                     uint16_t& port)
 {
-    while (!datagramAvailable()) { msleep(100); }
+    while (!datagramAvailable()) {
+        msleep(100);
+    }
     char buf[1];
 
     struct sockaddr_storage addr;
@@ -415,7 +418,8 @@ void UdpDataProtocol::getPeerAddressFromFirstPacket(QHostAddress& peerHostAddres
 //*******************************************************************************
 void UdpDataProtocol::run()
 {
-    if (gVerboseFlag) switch (mRunMode) {
+    if (gVerboseFlag)
+        switch (mRunMode) {
         case RECEIVER: {
             std::cout << "step 3" << std::endl;
             break;
@@ -435,7 +439,7 @@ void UdpDataProtocol::run()
         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
@@ -462,7 +466,8 @@ void UdpDataProtocol::run()
 
     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
@@ -471,7 +476,8 @@ void UdpDataProtocol::run()
 
     } 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
@@ -492,7 +498,7 @@ void UdpDataProtocol::run()
     // std::endl;
     // Anton Runov: making setRealtimeProcessPriority optional
     if (mUseRtPriority) {
-#if defined(__MAC_OSX__)
+#if defined(__APPLE__)
         setRealtimeProcessPriority(mJackTrip->getBufferSizeInSamples(),
                                    mJackTrip->getSampleRate());
 #else
@@ -566,8 +572,8 @@ void UdpDataProtocol::run()
     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
@@ -633,8 +639,8 @@ void UdpDataProtocol::run()
         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;
@@ -660,7 +666,7 @@ void UdpDataProtocol::run()
             // 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,
@@ -682,7 +688,7 @@ void UdpDataProtocol::run()
         */
             //----------------------------------------------------------------------------------
 
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
             int n = kevent(kq, &change, 1, &event, 1, &timeout);
 #else
             int n = epoll_wait(epollfd, &event, 1, 10);
@@ -697,12 +703,12 @@ void UdpDataProtocol::run()
                 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 : {
@@ -983,7 +989,7 @@ bool UdpDataProtocol::datagramAvailable()
     //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;
index 3ba36fbda482b744289d20b9916a7daeb54c8deb..d437998bee1f9dcdac7e9a7875dee47b07fc208a 100644 (file)
@@ -90,7 +90,7 @@ class UdpDataProtocol : public DataProtocol
      */
     void setPeerAddress(const char* peerHostOrIP);
 
-#if defined(__WIN_32__)
+#if defined(_WIN32)
     void setSocket(SOCKET& socket);
 #else
     void setSocket(int& socket);
@@ -163,7 +163,7 @@ class UdpDataProtocol : public DataProtocol
    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();
@@ -204,7 +204,7 @@ class UdpDataProtocol : public DataProtocol
     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;
index 2f2258317ac657d0f10f94510370200c1ed8798f..56ab0cc78722cb558edff64cb58a2013097cda5a 100644 (file)
@@ -49,7 +49,7 @@
 #include <iostream>
 #include <stdexcept>
 
-#ifndef __NO_JACK__
+#ifndef NO_JACK
 #include "JMess.h"
 #endif
 
@@ -62,8 +62,9 @@ using std::endl;
 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
@@ -73,16 +74,19 @@ UdpHubListener::UdpHubListener(int server_port, int server_udp_port)
     , 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"
@@ -119,7 +123,9 @@ UdpHubListener::~UdpHubListener()
 {
     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;
 }
 
@@ -137,7 +143,7 @@ void UdpHubListener::start()
     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;
@@ -159,10 +165,10 @@ void UdpHubListener::start()
 
         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
@@ -174,11 +180,11 @@ void UdpHubListener::start()
                     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.");
             }
         }
 
@@ -189,12 +195,13 @@ void UdpHubListener::start()
                 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.");
             }
         }
 
@@ -202,7 +209,7 @@ void UdpHubListener::start()
             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.");
             }
         }
 
@@ -229,8 +236,9 @@ void UdpHubListener::receivedNewConnection()
 {
     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;
 }
 
@@ -297,7 +305,9 @@ void UdpHubListener::receivedClientInfo(QSslSocket* clientConnection)
         }
     }
     // 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.)
@@ -358,7 +368,8 @@ void UdpHubListener::stopCheck()
 // 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;
@@ -383,7 +394,8 @@ int UdpHubListener::readClientUdpPort(QSslSocket* clientConnection, QString& cli
 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.
 
@@ -395,7 +407,9 @@ int UdpHubListener::checkAuthAndReadPort(QSslSocket* clientConnection,
     // 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];
@@ -488,8 +502,8 @@ void UdpHubListener::bindUdpSocket(QUdpSocket& udpsocket, int port)
 }
 
 //*******************************************************************************
-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
@@ -505,7 +519,9 @@ int UdpHubListener::getJackTripWorker(QString address, [[maybe_unused]] uint16_t
 
     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(
@@ -518,7 +534,7 @@ int UdpHubListener::getJackTripWorker(QString address, [[maybe_unused]] uint16_t
 }
 
 //*******************************************************************************
-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++ )
@@ -532,15 +548,16 @@ int UdpHubListener::getPoolID(QString address, uint16_t port)
     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);
@@ -548,21 +565,23 @@ void UdpHubListener::registerClientWithPatcher(QString& 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
@@ -586,7 +605,7 @@ void UdpHubListener::releaseDuplicateThreads(JackTripWorker* worker,
     worker->setClientPort(actual_peer_port);
 }
 
-#ifndef __NO_JACK__
+#ifndef NO_JACK
 #ifdef WAIR  // wair
 //*******************************************************************************
 void UdpHubListener::connectMesh(bool spawn)
@@ -605,7 +624,9 @@ 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
@@ -634,7 +655,7 @@ void UdpHubListener::connectPatch(bool spawn, const QString& clientName)
         }
     }
 }
-#endif  // __NO_JACK__
+#endif  // NO_JACK
 
 void UdpHubListener::stopAllThreads()
 {
index a12fcb2c1e2a0717a115907f3b5cb244b7480816..d0a078d4bf6731e3c52a31d0c60f0bb671f29632 100644 (file)
@@ -50,7 +50,7 @@
 #include "JackTrip.h"
 #include "jacktrip_globals.h"
 #include "jacktrip_types.h"
-#ifndef __NO_JACK__
+#ifndef NO_JACK
 #include "Patcher.h"
 #endif
 #include "Auth.h"
@@ -69,7 +69,8 @@ class UdpHubListener : public QObject
     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
@@ -78,7 +79,7 @@ class UdpHubListener : public QObject
     /// \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
@@ -142,12 +143,12 @@ class UdpHubListener : public QObject
      * \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();
 
@@ -181,7 +182,7 @@ class UdpHubListener : public QObject
 
     QStringList mHubPatchDescriptions;
     bool m_connectDefaultAudioPorts;
-#ifndef __NO_JACK__
+#ifndef NO_JACK
     Patcher mPatcher;
 #endif
     bool mStereoUpmix;
@@ -205,34 +206,36 @@ class UdpHubListener : public QObject
     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
     }
index 556b8a56c4525071ab854d53e5bd61f63edfa78f..a9f03bd1df6fa764a6b208ab62f75f6a47f79d10 100644 (file)
@@ -1195,7 +1195,8 @@ class APIUI
     {
         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;
     }
@@ -1208,9 +1209,12 @@ class APIUI
         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...
@@ -1273,10 +1277,13 @@ class APIUI
 
     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;
@@ -1391,7 +1398,9 @@ class APIUI
     {
         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;
     }
 
@@ -1456,7 +1465,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1541,7 +1552,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1725,12 +1738,24 @@ class compressordsp : public dsp
 
     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)
index e6c684fb639af70fd1a8588b790a0fdaad3b2983..23dabfaca1f864955fca0c8ac348431f1ddebe5e 100644 (file)
@@ -1195,7 +1195,8 @@ class APIUI
     {
         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;
     }
@@ -1208,9 +1209,12 @@ class APIUI
         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...
@@ -1273,10 +1277,13 @@ class APIUI
 
     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;
@@ -1391,7 +1398,9 @@ class APIUI
     {
         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;
     }
 
@@ -1456,7 +1465,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1541,7 +1552,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1806,71 +1819,199 @@ class freeverbdsp : public dsp
 
     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)
index 5d04d8f538ab2f9cd91c496dd0aa92698d4eb8f9..c7ac161d82ce01d493c64b28b61dcbda67103250 100644 (file)
@@ -1191,7 +1191,8 @@ class APIUI
     {
         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;
     }
@@ -1204,9 +1205,12 @@ class APIUI
         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...
@@ -1269,10 +1273,13 @@ class APIUI
 
     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;
@@ -1387,7 +1394,9 @@ class APIUI
     {
         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;
     }
 
@@ -1452,7 +1461,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1537,7 +1548,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1795,71 +1808,199 @@ class freeverbmonodsp : public dsp
 
     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)
@@ -2031,7 +2172,7 @@ class freeverbmonodsp : public dsp
             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];
index a61d4c2f60c1e69a90ed825a43c417005727f6c2..08e81cfa046904169a5f0c174ec7f0502c94bcdc 100644 (file)
 #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
 
index f4f046bd035e2ec0be2999d467172375e47a455b..895e1fef28de276b305b1c939e70505e0b5f0eda 100644 (file)
 
 #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)
@@ -42,14 +44,16 @@ MessageDialog::MessageDialog(QWidget* parent, QString windowFunction, quint32 st
     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);
     }
@@ -60,7 +64,7 @@ void MessageDialog::showEvent(QShowEvent* event)
     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);
@@ -76,15 +80,15 @@ void MessageDialog::closeEvent(QCloseEvent* event)
 
 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::ostreamrelay, int index)
 {
-    if (index >=0 && index < m_outBufs.size()) {
+    if (index >= 0 && index < m_outBufs.size()) {
         m_outBufs.at(index)->setOutStream(relay);
     }
     return false;
@@ -98,20 +102,23 @@ void MessageDialog::clearOutput()
 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());
 }
@@ -120,13 +127,14 @@ void MessageDialog::savePosition()
 {
     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();
     }
index 579d91cfc6850aa9bbd81bb4592d87f0130bb38d..f5d65b5e800df1b5d199f039c6c7e0b3f15a107c 100644 (file)
@@ -30,6 +30,7 @@
 #include <QScopedPointer>
 #include <QSharedPointer>
 #include <QVector>
+
 #include "textbuf.h"
 
 namespace Ui
@@ -42,18 +43,20 @@ class MessageDialog : public QDialog
     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::ostreamrelay, int index = 0);
+
    public slots:
     void clearOutput();
-    
+
    private slots:
     void receiveOutput(const QString& output);
     void provideContextMenu();
index 383b738bfac9da62c7d2919312f4e01ca9dc7fbe..ef2c438cdfbafbbdcfd36a9314fbb96b7881cc58 100644 (file)
@@ -43,7 +43,7 @@
 #include "weak_libjack.h"
 #endif
 
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
 #include "RtAudio.h"
 #endif
 
@@ -60,8 +60,8 @@ QJackTrip::QJackTrip(QWidget* parent)
     , 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)
@@ -72,10 +72,10 @@ QJackTrip::QJackTrip(QWidget* parent)
 {
     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());
@@ -108,6 +108,15 @@ QJackTrip::QJackTrip(QWidget* parent)
         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());
@@ -161,9 +170,9 @@ QJackTrip::QJackTrip(QWidget* parent)
         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, [=]() {
@@ -182,9 +191,9 @@ QJackTrip::QJackTrip(QWidget* parent)
         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"));
         }
     });
 
@@ -210,24 +219,22 @@ QJackTrip::QJackTrip(QWidget* parent)
         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) {
@@ -259,7 +266,7 @@ QJackTrip::QJackTrip(QWidget* parent)
         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);
     }
@@ -274,21 +281,21 @@ QJackTrip::QJackTrip(QWidget* parent)
     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);
@@ -300,20 +307,24 @@ QJackTrip::QJackTrip(QWidget* parent)
         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
@@ -324,7 +335,7 @@ QJackTrip::QJackTrip(QWidget* parent)
             "this.)");
         msgBox.setWindowTitle("JACK Not Available");
         msgBox.exec();
-#endif  // __RT_AUDIO__
+#endif  // RT_AUDIO
     }
 #endif  // USE_WEAK_JACK
 
@@ -381,12 +392,15 @@ void QJackTrip::showEvent(QShowEvent* event)
         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()
 {
@@ -395,7 +409,7 @@ void QJackTrip::processFinished()
         return;
     }
     m_jackTripRunning = false;
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
     m_noNap.enableNap();
 #endif
     m_ui->disconnectButton->setEnabled(false);
@@ -409,20 +423,20 @@ void QJackTrip::processFinished()
     } 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();
@@ -430,17 +444,18 @@ void QJackTrip::processError(const QString& errorMessage)
 
 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)
@@ -457,51 +472,48 @@ 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
     }
@@ -521,8 +533,10 @@ void QJackTrip::addressChanged(const QString& address)
 {
     // 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) {
@@ -532,7 +546,9 @@ void QJackTrip::addressChanged(const QString& address)
 
 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()
@@ -545,7 +561,9 @@ void QJackTrip::authFilesChanged()
 
 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()
@@ -562,17 +580,17 @@ void QJackTrip::browseForFile()
     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);
@@ -584,7 +602,7 @@ void QJackTrip::receivedIP(QNetworkReply* reply)
 {
     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.
@@ -595,21 +613,23 @@ void QJackTrip::receivedIP(QNetworkReply* reply)
             }
             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;
     }
@@ -625,8 +645,8 @@ void QJackTrip::resetOptions()
     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);
@@ -646,7 +666,7 @@ void QJackTrip::start()
     m_ui->connectButton->setEnabled(false);
     enableUi(false);
     m_jackTripRunning = true;
-    
+
     if (gVerboseFlag) {
         m_debugDialog->show();
     }
@@ -657,10 +677,17 @@ void QJackTrip::start()
             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());
@@ -681,7 +708,7 @@ void QJackTrip::start()
                 }
                 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());
                 }
@@ -710,7 +737,7 @@ void QJackTrip::start()
                              &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) {
@@ -747,7 +774,7 @@ void QJackTrip::start()
                 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(
@@ -755,17 +782,17 @@ void QJackTrip::start()
                 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
@@ -782,7 +809,7 @@ void QJackTrip::start()
                 }
                 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);
@@ -792,7 +819,8 @@ void QJackTrip::start()
             // 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());
@@ -837,7 +865,7 @@ void QJackTrip::start()
                              &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(
@@ -849,8 +877,8 @@ void QJackTrip::start()
     } 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;
@@ -865,11 +893,13 @@ void QJackTrip::start()
     // 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
 }
@@ -887,7 +917,9 @@ void QJackTrip::stop()
 void QJackTrip::exit()
 {
     // Only run this once.
-    if (m_isExiting) { return; }
+    if (m_isExiting) {
+        return;
+    }
     m_isExiting = true;
     m_ui->exitButton->setEnabled(false);
     saveSettings();
@@ -949,145 +981,192 @@ void QJackTrip::migrateSettings()
 {
     // 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 {
@@ -1102,95 +1181,116 @@ void QJackTrip::loadSettings()
 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.
@@ -1237,7 +1337,7 @@ void QJackTrip::appendPlugins(JackTrip* jackTrip, int numSendChannels,
 
 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());
@@ -1249,16 +1349,23 @@ QString QJackTrip::commandLineFromCurrentOptions()
         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");
@@ -1268,14 +1375,17 @@ QString QJackTrip::commandLineFromCurrentOptions()
             || 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;
@@ -1283,33 +1393,35 @@ QString QJackTrip::commandLineFromCurrentOptions()
         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()));
         }
     }
 
@@ -1342,33 +1454,41 @@ QString QJackTrip::commandLineFromCurrentOptions()
     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()));
                 }
             }
         }
@@ -1383,26 +1503,32 @@ QString QJackTrip::commandLineFromCurrentOptions()
             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));
                 }
             }
@@ -1410,48 +1536,52 @@ QString QJackTrip::commandLineFromCurrentOptions()
         }
     }
     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) {
@@ -1470,17 +1600,17 @@ void QJackTrip::showCommandLineMessageBox()
 {
     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());
 }
index 124696320119d7ce31979d429bd494cd37bf18e2..77286b46b395bb8b032e8df3718782786be533a0 100644 (file)
 #include "../UdpHubListener.h"
 #include "messageDialog.h"
 
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
 #include "NoNap.h"
 #endif
 
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
 #include <QComboBox>
 #endif
 
@@ -56,7 +56,7 @@ class QJackTrip;
 #else
 class QJackTripVS;
 #endif
-}
+}  // namespace Ui
 
 class QJackTrip : public QMainWindow
 {
@@ -94,6 +94,7 @@ 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);
@@ -102,7 +103,7 @@ class QJackTrip : public QMainWindow
     void loadSettings();
     void saveSettings();
 
-#ifdef __RT_AUDIO__
+#ifdef RT_AUDIO
     void populateDeviceMenu(QComboBox* menu, bool isInput);
 #endif
 
@@ -135,7 +136,7 @@ class QJackTrip : public QMainWindow
     int m_argc;
     bool m_hideWarning;
 
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
     NoNap m_noNap;
 #endif
 };
index 77d7f315b989795bdae6ebd9859c3e7725ec8b92..d206d60c8d540dd9596daf41f89a02d5dc206cd8 100644 (file)
@@ -165,146 +165,7 @@ To connect to a hub server you need to run as a hub client.</string>
         <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>&amp;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>&amp;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>&amp;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/>
@@ -432,15 +293,29 @@ To connect to a hub server you need to run as a hub client.</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>&amp;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">
@@ -458,7 +333,87 @@ To connect to a hub server you need to run as a hub client.</string>
           </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>&amp;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>&amp;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>&amp;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>
@@ -468,27 +423,98 @@ To connect to a hub server you need to run as a hub client.</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&amp;patch mode</string>
-          </property>
-          <property name="buddy">
-           <cstring>autoPatchComboBox</cstring>
+           <string>&amp;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>&amp;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>&amp;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&amp;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>&amp;Include server in patching</string>
+             </property>
+            </widget>
+           </item>
+          </layout>
          </widget>
         </item>
        </layout>
@@ -958,6 +984,9 @@ To connect to a hub server you need to run as a hub client.</string>
         </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 &amp;Debug Information</string>
           </property>
@@ -1761,6 +1790,7 @@ and wetness is the essence of beauty.</string>
   <tabstop>channelRecvSpinBox</tabstop>
   <tabstop>channelSendSpinBox</tabstop>
   <tabstop>autoPatchComboBox</tabstop>
+  <tabstop>patchServerCheckBox</tabstop>
   <tabstop>upmixCheckBox</tabstop>
   <tabstop>zeroCheckBox</tabstop>
   <tabstop>timeoutCheckBox</tabstop>
@@ -1784,6 +1814,7 @@ and wetness is the essence of beauty.</string>
   <tabstop>realTimeCheckBox</tabstop>
   <tabstop>ioStatsCheckBox</tabstop>
   <tabstop>ioStatsSpinBox</tabstop>
+  <tabstop>verboseCheckBox</tabstop>
   <tabstop>authCheckBox</tabstop>
   <tabstop>usernameEdit</tabstop>
   <tabstop>passwordEdit</tabstop>
@@ -1814,7 +1845,6 @@ and wetness is the essence of beauty.</string>
   <tabstop>outCompressorCheckBox</tabstop>
   <tabstop>outLimiterCheckBox</tabstop>
   <tabstop>outClientsSpinBox</tabstop>
-  <tabstop>verboseCheckBox</tabstop>
  </tabstops>
  <resources>
   <include location="qjacktrip.qrc"/>
index 7e6b95a5b8f3646143cc39a656e8921bfdf1eb1c..69bd2c3e3c0e6a5de89e2cd959ac3744284b64dd 100644 (file)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>409</width>
-    <height>817</height>
+    <height>889</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -165,7 +165,91 @@ To connect to a hub server you need to run as a hub client.</string>
         <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&amp;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>&amp;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>&amp;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">
@@ -245,7 +329,17 @@ To connect to a hub server you need to run as a hub client.</string>
           </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>&amp;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>
@@ -319,66 +413,23 @@ To connect to a hub server you need to run as a hub client.</string>
           </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/>
@@ -506,33 +557,31 @@ To connect to a hub server you need to run as a hub client.</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>&amp;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>
@@ -542,29 +591,6 @@ To connect to a hub server you need to run as a hub client.</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&amp;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>&amp;Upmix mono clients to stereo</string>
-          </property>
-         </widget>
-        </item>
        </layout>
       </widget>
       <widget class="QWidget" name="advancedTab">
@@ -958,6 +984,9 @@ To connect to a hub server you need to run as a hub client.</string>
         </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 &amp;Debug Information</string>
           </property>
@@ -1761,6 +1790,7 @@ and wetness is the essence of beauty.</string>
   <tabstop>channelRecvSpinBox</tabstop>
   <tabstop>channelSendSpinBox</tabstop>
   <tabstop>autoPatchComboBox</tabstop>
+  <tabstop>patchServerCheckBox</tabstop>
   <tabstop>upmixCheckBox</tabstop>
   <tabstop>zeroCheckBox</tabstop>
   <tabstop>timeoutCheckBox</tabstop>
index 0fcf1f4534bc21338144c6043e21311f3bb13a59..7e916a331f9cffdc8b37c4b23e53e85645cddc85 100644 (file)
@@ -32,23 +32,23 @@ void textbuf::setOutStream(std::ostream* output)
 
 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;
@@ -62,7 +62,8 @@ void textbuf::putChars(const char* begin, const char* end)
         }
         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)));
 }
-
index b0326f6007f04ccd2fde35b8b1d02f8320d1fceb..ea7f37e945b6bec19d293a380ae77f2cbb0360bb 100644 (file)
 #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::ostreamm_outStream = nullptr;
+
     void putChars(const char* begin, const char* end);
 };
 
index 977c712639165594d27ab105fb250f3dedb85524..ce2c04d404745193a202bc16b62a1f00fe21092f 100644 (file)
 
 #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>
@@ -59,7 +59,7 @@
 #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
@@ -97,8 +97,8 @@ void setRealtimeProcessPriority(int bufferSize, int sampleRate)
     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;
@@ -149,9 +149,9 @@ void setRealtimeProcessPriority(int bufferSize, int sampleRate)
     return;
 }
 
-#endif  //__MAC_OSX__
+#endif  //__APPLE__
 
-#if defined(__LINUX__)
+#if defined(__linux__)
 //*******************************************************************************
 void setRealtimeProcessPriority()
 {
@@ -168,9 +168,9 @@ void setRealtimeProcessPriority()
         ;
     }
 }
-#endif  //__LINUX__
+#endif  //__linux__
 
-#if defined(__WIN_32__)
+#if defined(_WIN32)
 void setRealtimeProcessPriority()
 {
     if (SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS) == 0) {
@@ -180,4 +180,4 @@ void setRealtimeProcessPriority()
         std::cerr << "Failed to set thread priority." << std::endl;
     }
 }
-#endif  //__WIN_32__
+#endif  //_WIN32
index 7a6a32cf2a38fa284ff24d65d3db4783152b6587..369a9684d580c7ad0f59fe709fe160e358f7ff12 100644 (file)
@@ -40,7 +40,7 @@
 
 #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
@@ -125,7 +125,7 @@ constexpr int gMaxRemoteNameLength           = 64;
 //*******************************************************************************
 /// \name Global Functions
 
-#ifdef __MAC_OSX__
+#ifdef __APPLE__
 void setRealtimeProcessPriority(int bufferSize, int sampleRate);
 #else
 void setRealtimeProcessPriority();
index 927b5e4dc08e8d11fe6cb6b5e1ec039d4e906196..fc6f39ee12927740e3fcc9d99d2eb92d0d6c31f9 100644 (file)
@@ -1192,7 +1192,8 @@ class APIUI
     {
         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;
     }
@@ -1205,9 +1206,12 @@ class APIUI
         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...
@@ -1270,10 +1274,13 @@ class APIUI
 
     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;
@@ -1388,7 +1395,9 @@ class APIUI
     {
         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;
     }
 
@@ -1453,7 +1462,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1538,7 +1549,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1705,13 +1718,25 @@ class limiterdsp : public dsp
 
     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)
index 044af97185c6d3d9b00154e64e853cc386052cd2..38587205aa2949ded476a1b392f21174de5ec362 100644 (file)
@@ -37,9 +37,9 @@
 
 #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[])
@@ -97,7 +97,7 @@ 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) {
@@ -108,7 +108,7 @@ QCoreApplication* createApplication(int& argc, char* argv[])
                       << std::endl;
             std::exit(1);
         }
-#endif  // __LINUX__
+#endif  // __linux__
         return new QApplication(argc, argv);
 #endif  // NO_GUI
     } else {
@@ -123,7 +123,7 @@ void qtMessageHandler([[maybe_unused]] QtMsgType type,
     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.
@@ -162,17 +162,19 @@ BOOL WINAPI windowsCtrlHandler(DWORD fdwCtrlType)
     }
 }
 
-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;
@@ -180,8 +182,8 @@ bool isRunFromCmd() {
         } 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;
@@ -189,8 +191,8 @@ bool isRunFromCmd() {
     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;
             }
@@ -201,7 +203,7 @@ bool isRunFromCmd() {
             CloseHandle(h);
         }
     }
-    
+
     return false;
 }
 #endif
@@ -215,22 +217,24 @@ int main(int argc, char* argv[])
     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(),
@@ -256,7 +260,7 @@ int main(int argc, char* argv[])
                                  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;
@@ -273,7 +277,7 @@ int main(int argc, char* argv[])
                                  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;
@@ -286,8 +290,10 @@ int main(int argc, char* argv[])
 #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;
index 47a648e3cb8259af401898c7b994fbad12ad5525..8b26291f90c84cc492b9b59f037ac93f8f1b524f 100644 (file)
@@ -1191,7 +1191,8 @@ class APIUI
     {
         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;
     }
@@ -1204,9 +1205,12 @@ class APIUI
         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...
@@ -1269,10 +1273,13 @@ class APIUI
 
     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;
@@ -1387,7 +1394,9 @@ class APIUI
     {
         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;
     }
 
@@ -1452,7 +1461,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1537,7 +1548,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1590,7 +1603,10 @@ class APIUI
 #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
@@ -1910,62 +1926,174 @@ class zitarevdsp : public dsp
     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)
@@ -2383,7 +2511,7 @@ class zitarevdsp : public dsp
             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)))
@@ -2401,7 +2529,7 @@ class zitarevdsp : public dsp
             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)))
index 6ee0590405682d676072c172ad82664056992820..0053a95526e0faac6ac659c23ed671e577beb74a 100644 (file)
@@ -1191,7 +1191,8 @@ class APIUI
     {
         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;
     }
@@ -1204,9 +1205,12 @@ class APIUI
         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...
@@ -1269,10 +1273,13 @@ class APIUI
 
     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;
@@ -1387,7 +1394,9 @@ class APIUI
     {
         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;
     }
 
@@ -1452,7 +1461,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1537,7 +1548,9 @@ class APIUI
      */
     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);
+        }
     }
 
     /**
@@ -1590,7 +1603,10 @@ class APIUI
 #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
@@ -1901,61 +1917,171 @@ class zitarevmonodsp : public dsp
     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)
diff --git a/win/meson.build b/win/meson.build
new file mode 100644 (file)
index 0000000..4bdf807
--- /dev/null
@@ -0,0 +1,25 @@
+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