From: IOhannes m zmölnig (Debian/GNU) Date: Wed, 19 Jan 2022 07:49:24 +0000 (+0100) Subject: New upstream version 1.5.1+ds0 X-Git-Tag: archive/raspbian/2.5.1+ds-1+rpi1~1^2~9^2~23 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=01af095b7c8ca26e54399d0f6bb8eb0056f87f16;p=jacktrip.git New upstream version 1.5.1+ds0 --- diff --git a/.clang-format b/.clang-format index 31204cb..9b34801 100644 --- a/.clang-format +++ b/.clang-format @@ -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 index 0000000..8360478 --- /dev/null +++ b/.clang-format-ignore @@ -0,0 +1 @@ +externals/* diff --git a/.clang-tidy b/.clang-tidy index 5c342d6..864b26f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1 +1 @@ -Checks: '-*,modernize-deprecated-headers,modernize-loop-convert' +Checks: '-*,modernize-deprecated-headers,modernize-loop-convert,google-build-using-namespace' diff --git a/CMakeLists.txt b/CMakeLists.txt index fbba160..47f4c32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/docs/changelog.yml b/docs/changelog.yml index 636ad51..9935aeb 100644 --- a/docs/changelog.yml +++ b/docs/changelog.yml @@ -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 @@ -76,15 +88,18 @@ - (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 @@ -95,12 +110,14 @@ - (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 @@ -109,9 +126,11 @@ - (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 @@ -120,11 +139,13 @@ - (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 @@ -135,6 +156,7 @@ - (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 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 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 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 index 0000000..556cc75 Binary files /dev/null and b/docs/images/jacktrip_hubserver_jitter.png differ diff --git a/docs/index.md b/docs/index.md index 8c39f3a..ececbf5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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} + diff --git a/faust-src/minimal.cpp b/faust-src/minimal.cpp index 3310519..eb36d3c 100644 --- a/faust-src/minimal.cpp +++ b/faust-src/minimal.cpp @@ -6,7 +6,10 @@ // abs is now predefined // template T abs (T a) { return (a> n); } +inline int lsr(int x, int n) +{ + return int(((unsigned int)x) >> n); +} /****************************************************************************** ******************************************************************************* diff --git a/jacktrip.pro b/jacktrip.pro index d8ef285..c811c80 100644 --- a/jacktrip.pro +++ b/jacktrip.pro @@ -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 = . diff --git a/linux/flatpak/org.jacktrip.JackTrip.Devel.yml b/linux/flatpak/org.jacktrip.JackTrip.Devel.yml index 62bc178..8fe947c 100644 --- a/linux/flatpak/org.jacktrip.JackTrip.Devel.yml +++ b/linux/flatpak/org.jacktrip.JackTrip.Devel.yml @@ -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: diff --git a/linux/flatpak/org.jacktrip.JackTrip.Devel.yml.j2 b/linux/flatpak/org.jacktrip.JackTrip.Devel.yml.j2 index 89961f3..93c7f28 100644 --- a/linux/flatpak/org.jacktrip.JackTrip.Devel.yml.j2 +++ b/linux/flatpak/org.jacktrip.JackTrip.Devel.yml.j2 @@ -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: diff --git a/linux/flatpak/org.jacktrip.JackTrip.yml b/linux/flatpak/org.jacktrip.JackTrip.yml index 9d35873..eda8152 100644 --- a/linux/flatpak/org.jacktrip.JackTrip.yml +++ b/linux/flatpak/org.jacktrip.JackTrip.yml @@ -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: diff --git a/linux/org.jacktrip.JackTrip.metainfo.xml.in.in b/linux/org.jacktrip.JackTrip.metainfo.xml.in.in index a082269..105afa2 100644 --- a/linux/org.jacktrip.JackTrip.metainfo.xml.in.in +++ b/linux/org.jacktrip.JackTrip.metainfo.xml.in.in @@ -7,6 +7,11 @@ JackTrip Connect and play with other musicians + + Audio + Network + +

JackTrip is a cross-platform multi-machine audio system @@ -22,20 +27,50 @@ @appid@.desktop - https://jacktrip.github.io/jacktrip/ + https://github.com/jacktrip/jacktrip + https://jacktrip.github.io/jacktrip + https://github.com/jacktrip/jacktrip/issues JackTrip + The JackTrip Community jacktrip + + keyboard + pointing + 907 + + + + + Hubclient Mode + https://jacktrip.github.io/jacktrip/images/jacktrip_hubclient_basic.png + + + Hubclient Mode // Plugins tab + https://jacktrip.github.io/jacktrip/images/jacktrip_hubclient_plugins.png + + + Hubserver Mode + https://jacktrip.github.io/jacktrip/images/jacktrip_hubserver_basic.png + + + Hubserver Mode // Jitter Buffer Tab + https://jacktrip.github.io/jacktrip/images/jacktrip_hubserver_jitter.png + + + {%- for release in releases %} +

    {%- for change in release.Description %} -

    {{ change }}

    +
  • {{ change }}
  • {%- endfor %} +
{%- endfor %} diff --git a/meson.build b/meson.build index 258661b..3de6dad 100644 --- a/meson.build +++ b/meson.build @@ -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') diff --git a/mkdocs.yml b/mkdocs.yml index a4a907d..705e991 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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 diff --git a/src/AudioInterface.cpp b/src/AudioInterface.cpp index c498557..ba65477 100644 --- a/src/AudioInterface.cpp +++ b/src/AudioInterface.cpp @@ -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& 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& 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& 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)); diff --git a/src/AudioInterface.h b/src/AudioInterface.h index 7885e4c..db28f42 100644 --- a/src/AudioInterface.h +++ b/src/AudioInterface.h @@ -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; } diff --git a/src/AudioTester.cpp b/src/AudioTester.cpp index 85bf867..1f5a0c0 100644 --- a/src/AudioTester.cpp +++ b/src/AudioTester.cpp @@ -195,7 +195,9 @@ void AudioTester::writeImpulse(QVarLengthArray& 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& 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--; diff --git a/src/AudioTester.h b/src/AudioTester.h index 6e2d55d..cfd508d 100644 --- a/src/AudioTester.h +++ b/src/AudioTester.h @@ -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; } }; diff --git a/src/Auth.cpp b/src/Auth.cpp index 10dc553..3cbd351 100644 --- a/src/Auth.cpp +++ b/src/Auth.cpp @@ -43,8 +43,10 @@ #include #include -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); diff --git a/src/Auth.h b/src/Auth.h index 875d78b..712f524 100644 --- a/src/Auth.h +++ b/src/Auth.h @@ -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 m_passwordTable; diff --git a/src/DataProtocol.h b/src/DataProtocol.h index 81bbada..b01643f 100644 --- a/src/DataProtocol.h +++ b/src/DataProtocol.h @@ -38,12 +38,12 @@ #ifndef __DATAPROTOCOL_H__ #define __DATAPROTOCOL_H__ -#ifdef __WIN_32__ +#ifdef _WIN32 #include #include #endif -#ifndef __WIN_32__ +#ifndef _WIN32 #include //inet(3) functions #include #include //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 diff --git a/src/Effects.h b/src/Effects.h index ad2acd1..89516ea 100644 --- a/src/Effects.h +++ b/src/Effects.h @@ -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"; } diff --git a/src/JMess.cpp b/src/JMess.cpp index 9b296ce..85c6029 100644 --- a/src/JMess.cpp +++ b/src/JMess.cpp @@ -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 OutputInput(2); - - // this->setConnectedPorts(); - - // root = jmess_xml.createElement("jmess"); - // for (QVector >::iterator it = mConnectedPorts.begin(); - // it != mConnectedPorts.end(); ++it) { - // OutputInput = *it; - // //cout << "Output ===> " < " <> 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 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[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