jack-mixer / jack_mixer

A multi-channel audio mixer desktop application for the JACK Audio Connection Kit.
https://rdio.space/jackmixer/
GNU General Public License v2.0
93 stars 20 forks source link

Any way to get this working with jack-audio on a windows system #112

Open markweenwork opened 3 years ago

markweenwork commented 3 years ago

I normally use linux and use jack for audio routing along with jack_mixer for general volume control - I also use jack in windows and was wondering if its possible to build jack_mixer for windows 10?

SpotlightKid commented 3 years ago

I honestly don't know. I don't have a Windows 10 system and I haven't tried crosss-compiling jack_mixer yet.

There are a few things that would need to be adapted in the code, e.g. signal handling and preferences saving paths.

So, volunteers needed to work on this.

markweenwork commented 3 years ago

thanks for the info and thanks for this tool - very useful in my opinion!! would love to be able to have the same audio setup in windows that i currently use in linux

markweenwork commented 3 years ago

I managed to get this working in windows 10 - i compiled using msys2 on windows 10

  1. had to compile portaudio with asio driver enabled
  2. compile the correct version of jack2
  3. i could then pull in the prebuilt packages in msys2 of glib2, python-gobject, python-cairo, python-xdg
  4. in the c source i had to remove some signal references as suggested by spotlightKid and had to do the same in the py files
  5. could now install the same version of jack as the version i compiled against and run it
  6. launch jack_mixer

spent most the weekend figuring this out - will look more into this next weekend when i have some more time and see if i can find any parts that dont work - and also look at the preferences saving paths

thanks for the pointers in the right direction spotlightkid!!!

SpotlightKid commented 3 years ago

Great news!

Please share your work, when you find the time!

For the preferences path I was thinking about replacing pyxdg with appdirs.

markweenwork commented 3 years ago

yes i intend to share everything!! will update next weekend!

markweenwork commented 3 years ago

hey sorry for delay with this - had my hard disk fail last weekend and then also my backup hardisk failed while trying to recovery my main disk lol!! ok so what I have below is instrutions on 64 bit windows to compile and run jack and jack_mixer15 from source using msys2 - I am looking to gather all dependencies together to make it easier for normal users to get this going as it is quite long winded atm

firstly the downloads needed using the versions i used are as follows

https://github.com/jackaudio/jack2-releases/releases/download/v1.9.17/jack2-win64-v1.9.17.exe https://github.com/jackaudio/jack2/archive/refs/tags/v1.9.17.tar.gz https://repo.msys2.org/distrib/x86_64/msys2-x86_64-20210228.exe https://github.com/msys2/MINGW-packages/archive/refs/heads/master.zip https://aka.ms/vs/16/release/vc_redist.x64.exe https://www.steinberg.net/asiosdk https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v7.9.5/npp.7.9.5.Installer.exe (for editing PKGBUILD and maintaing unix style end of lines)

onto how to do it instructions preceded with # msys2 prompts preceded with ? replace \<UserName> for all paths with your login username

Install msys2 to default path of C:\msys64

Run msys2

pacman -Suy ?Proceed with installation? [Y/n] - enter Y ?To complete this update all MSYS2 processes including this terminal will be closed. Confirm to proceed [Y/n] - enter Y and restart msys2

may have to update again

pacman -Suy ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-toolchain ?Enter a selection (default=all): - pick 3 mingw-w64-x86_64-gcc ?Proceed with installation? [Y/n] - enter Y pacman -S patch autoconf make gettext-devel automake libtool pkg-config unzip ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-libsystre ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-db ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-libsndfile ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-libsamplerate ?Proceed with installation? [Y/n] - enter Y

extract MINGW-packages-master.zip to C:\msys64\home\<UserName>

extract asio sdk to C:\msys64\opt\

rename asiosdk_2.3.3_2019-06-14 to asiosdkstatic clone that folder and rename clone to asiosdkshared

cd /home/<UserName>/MINGW-packages-master/mingw-w64-portaudio/

copy portaudio PKGBUILD (listed below) to C:\msys64\home\<UserName>\MINGW-packages-master\mingw-w64-portaudio

you can use notepad++ to chagne end of line style to unix : go to Edit menu -> EOL Conversion -> Unix (LF) and then save

MINGW_INSTALLS=mingw64 makepkg-mingw -sLf ?Proceed with installation? [Y/n] - enter Y

enter : pacman -U mingw-w64-x86_64-portaudio - press tab to auto complete

?Proceed with installation? [Y/n] - enter Y

cd ..
mkdir mingw-w64-jack2
cd mingw-w64-jack2

copy jack2-1.9.17.tar.gz to C:\msys64\home\<UserName>\MINGW-packages-master\mingw-w64-jack2\

copy jack PKGBUILD (listed below) to C:\msys64\home\<UserName>\MINGW-packages-master\mingw-w64-jack2

you can use notepad++ to chagne end of line style to unix : go to Edit menu -> EOL Conversion -> Unix (LF) and then save

will have to edit the source name in PKGBUILD for different versions of jack

copy required includes to correct include directory

cp /home/<UserName>/MINGW-packages-master/mingw-w64-portaudio/src/portaudio/include/pa_asio.h /mingw64/include/
cp /home/<UserName>/MINGW-packages-master/mingw-w64-portaudio/src/portaudio/include/portaudio.h /mingw64/include/

MINGW_INSTALLS=mingw64 makepkg-mingw -sLf ?Proceed with installation? [Y/n] - enter Y ?Proceed with installation? [Y/n] - enter Y

enter : pacman -U mingw-w64-x86_64-jack2 - press tab to auto complete

?Proceed with installation? [Y/n] - enter Y

build jack_mixer

extract jack_mixer15.tar.xz (using 7-zip, make sure to go into both xz and tar) folder to /home/

pacman -S mingw-w64-x86_64-meson ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-glib2 ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-cmake ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-python ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-python-gobject ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-python-cairo ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-python-xdg ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-gtk3 ?Proceed with installation? [Y/n] - enter Y pacman -S mingw-w64-x86_64-readline ?Proceed with installation? [Y/n] - enter Y

enter the following commands in msys2 to setup paths for compiling jack_mixer

export C_INCLUDE_PATH=/mingw64/include
export PKG_CONFIG_PATH=/mingw64/lib/pkgconfig
export PATH="/mingw64/bin:/mingw64/lib/bin:/mingw64/lib:$PATH"
export LD_LIBRARY_PATH=/mingw64/lib:/mingw64/lib/bin:/mingw64/bin

export CFLAGS="-I/mingw64/include"
export CXXFLAGS="-I/mingw64/include"
export LDFLAGS="-L/mingw64/lib"

now we can build jack_mixer

cd /home/<UserName>/jack_mixer-15/
/mingw64/bin/meson setup builddir --prefix=/mingw64 --buildtype=release

with notepad++ open C:\msys64\home\<UserName>\jack_mixer-15\src\jack_mix_box.c

comment lines 168 and 170 (sigusr1 and sighup) add // to front of line to comment it out

    //signal(SIGUSR1, reportVolume);
    signal(SIGTERM, triggerShutDown);
    //signal(SIGHUP, triggerShutDown);
    signal(SIGINT, triggerShutDown);
meson compile -C builddir
meson install -C builddir

post_install script will error (this can be ignored everything still works)

install vc_redist.x64.exe

install jack2 from installer (same version as built) (install jack dll and jack router not qjackctl or dev tools)

error will show about jackrouter.dll pick ignore the error and continue

change line 41 of

open C:\msys64\mingw64\lib\python3.8\site-packages\jack_mixer\nsmclient.py

from signal import signal, SIGTERM, SIGINT#, SIGKILL #react to exit signals to close the client gracefully. Or kill if the client fails to do so.

comment line 1061 and 1064 of C:\msys64\mingw64\lib\python3.8\site-packages\jack_mixer\app.py by adding # infront of lines

        #signal.signal(signal.SIGUSR1, self.sighandler)
        signal.signal(signal.SIGTERM, self.sighandler)
        signal.signal(signal.SIGINT, self.sighandler)
        #signal.signal(signal.SIGHUP, signal.SIG_IGN)
cp /mingw64/lib/python3.8/site-packages/jack_mixer/_jack_mixer-cpython-38.dll /mingw64/bin
cp -R /mingw64/lib/jack/ /mingw64/bin

cp /mingw64/lib/libjack64.dll /mingw64/bin
cp /mingw64/lib/libjacknet64.dll /mingw64/bin
cp /mingw64/lib/libjackserver64.dll /mingw64/bin

start jack server

open cmd in windows

cd "C:\Program Files\Jack2"
jackd.exe -R -P95 -S -d portaudio -r 4800

then back in msys2

/mingw64/bin/python jack_mixer

jack2 PKGBUILD

_realname='jack2'
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.9.17
pkgrel=1
pkgdesc='The next-generation JACK with SMP support (mingw-w64)'
arch=('any')
url='http://jackaudio.org/'
license=('GPL')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-pkg-config"
             'python3'
             'git')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-portaudio"
         "${MINGW_PACKAGE_PREFIX}-opus"
         "${MINGW_PACKAGE_PREFIX}-libsamplerate"
         "${MINGW_PACKAGE_PREFIX}-libsndfile"
         "${MINGW_PACKAGE_PREFIX}-readline")
source=(${_realname}-${pkgver}.tar.gz)
sha256sums=('SKIP')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  /usr/bin/python3 waf configure "--prefix=${MINGW_PREFIX}" --celt=no
  /usr/bin/python3 waf build
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"
  /usr/bin/python3 waf "--destdir=${pkgdir}" install
  cd "${pkgdir}/${MINGW_PREFIX}"
}

portaudio PKGBUILD

# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=portaudio
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=190600_20161030
pkgrel=3
pkgdesc="A free, cross-platform, open source, audio I/O library (mingw-w64)"
arch=('any')
url="http://www.portaudio.com"
license=("custom")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
options=(!libtool strip staticlibs)
source=("http://www.portaudio.com/archives/pa_stable_v${pkgver}.tgz"
        "fix-build.patch"
        "wdmks-wasapi-dsound.patch")
sha256sums=('f5a21d7dcd6ee84397446fa1fa1a0675bb2e8a4a6dceb4305a8404698d8d1513'
            '77e8438d482ad03baa5c23afbe293e8cbdb95287ff6a489515bde61231e78525'
            'fd62577c6fcf2811618701d49c68d6f0de515fad26f644ccacce57a16cf11bbc'
            )

prepare() {
  cd ${srcdir}/${_realname}

  patch -p0 -i ${srcdir}/fix-build.patch
  patch -p0 -i ${srcdir}/wdmks-wasapi-dsound.patch

  autoconf
}

# In order to build with ASIO-support, download the ASIOSDK2.3 from Steinberg, add 
# the path below and add "asio" to --with-winapi. Both for shared and static, e.g:
#    --with-asiodir=${HOME}/ASIOSDK2.3 \
#    --with-winapi=wmme,directx,wasapi,wdmks,asio
# Unfortunately each build creates artefacts in the ASIO-SDK (.libs) that conflict 
# with the subsequent build (shared/static, 32-/64-bit. You may need to clean out
# manually or replace the SDK with a fresh copy. You may also need to provice two
# separate copies for asiodir in the shared and static build.

build() {
  export lt_cv_deplibs_check_method='pass_all'

  [[ -d "build-static-${MINGW_CHOST}" ]] && rm -rf "build-static-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-static-${MINGW_CHOST}"
  cd "${srcdir}/build-static-${MINGW_CHOST}"

  ../${_realname}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --disable-shared \
    --enable-static \
    --with-dxdir=${MINGW_PREFIX}/${MINGW_CHOST} \
    --with-winapi=wmme,directx,wasapi,wdmks,asio \
    --with-asiodir=/opt/asiosdkstatic

  make

  [[ -d "build-shared-${MINGW_CHOST}" ]] && rm -rf "build-shared-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-shared-${MINGW_CHOST}"
  cd "${srcdir}/build-shared-${MINGW_CHOST}"

  ../${_realname}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-shared \
    --with-dxdir=${MINGW_PREFIX}/${MINGW_CHOST} \
    --with-winapi=wmme,directx,wasapi,wdmks,asio \
    --with-asiodir=/opt/asiosdkshared

  make
}

package() {
  cd "${srcdir}/build-static-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install

  cd "${srcdir}/build-shared-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
}
SpotlightKid commented 3 years ago

Thanks for that. I'll have a closer look as soon as I can.

Why do you need to build jack? Wouldn't it be enough to point meson at the jack headers?

markweenwork commented 3 years ago

hi i built jack because it wasnt finding the jack libs because the jack.pc file was missing from the lib/pkgconfig folder and i didnt know how to create it - building jack created this file for me if i had know how to create it or if i got a correct .pc file i could have avoided building jack

SpotlightKid commented 3 years ago

jack_mixer, now that PR #150 is merged, now uses appdir to save preferences and mixer setting files in the correct locations, which should work on windows too, so that's one step further towards windows compatibility, I hope.

shushz commented 3 years ago

@markweenwork, thank you so much for the Jack building instructions, they are great! FYI, the process of building portaudio with ASIO support seems to have changed somewhat, at least it didn't work out of the box, but I didn't use ASIO and too was only building jack for its jack.pc.