1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

juce_audio_devices: Add support for JACK on Windows and macOS

This commit is contained in:
Oliver James 2024-12-06 13:34:47 +00:00
parent b7d0364e69
commit f608e7cce2
4 changed files with 36 additions and 15 deletions

View file

@ -100,7 +100,7 @@ void AudioIODeviceType::callDeviceChangeListeners()
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_ALSA() { return nullptr; }
#endif
#if (JUCE_LINUX || JUCE_BSD) && JUCE_JACK
#if (JUCE_LINUX || JUCE_BSD || JUCE_MAC || JUCE_WINDOWS) && JUCE_JACK
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_JACK() { return new JackAudioIODeviceType(); }
#else
AudioIODeviceType* AudioIODeviceType::createAudioIODeviceType_JACK() { return nullptr; }

View file

@ -176,19 +176,6 @@
#include "native/juce_ALSA_linux.cpp"
#endif
#if JUCE_JACK
/* Got an include error here? If so, you've either not got jack-audio-connection-kit
installed, or you've not got your paths set up correctly to find its header files.
The package you need to install to get JACK support is "libjack-dev".
If you don't have the jack-audio-connection-kit library and don't want to build
JUCE with low latency audio support, just set the JUCE_JACK flag to 0.
*/
#include <jack/jack.h>
#include "native/juce_JackAudio_linux.cpp"
#endif
#if (JUCE_LINUX && JUCE_BELA)
/* Got an include error here? If so, you've either not got the bela headers
installed, or you've not got your paths set up correctly to find its header
@ -258,6 +245,25 @@ namespace juce
#endif
#if (JUCE_LINUX || JUCE_BSD || JUCE_MAC || JUCE_WINDOWS) && JUCE_JACK
/* Got an include error here? If so, you've either not got jack-audio-connection-kit
installed, or you've not got your paths set up correctly to find its header files.
Linux: The package you need to install to get JACK support is libjack-dev.
macOS: The package you need to install to get JACK support is jack, which you can
install using Homebrew.
Windows: The package you need to install to get JACK support is available from the
JACK Audio website. Download and run the installer for Windows.
If you don't have the jack-audio-connection-kit library and don't want to build
JUCE with low latency audio support, just set the JUCE_JACK flag to 0.
*/
#include <jack/jack.h>
#include "native/juce_JackAudio.cpp"
#endif
#include "midi_io/juce_MidiDevices.cpp"
#if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED

View file

@ -121,7 +121,7 @@
#endif
/** Config: JUCE_JACK
Enables JACK audio devices (Linux only).
Enables JACK audio devices.
*/
#ifndef JUCE_JACK
#define JUCE_JACK 0

View file

@ -42,7 +42,11 @@ static void* juce_loadJackFunction (const char* const name)
if (juce_libjackHandle == nullptr)
return nullptr;
#if JUCE_WINDOWS
return GetProcAddress ((HMODULE) juce_libjackHandle, name);
#else
return dlsym (juce_libjackHandle, name);
#endif
}
#define JUCE_DECL_JACK_FUNCTION(return_type, fn_name, argument_types, arguments) \
@ -604,8 +608,19 @@ public:
inputNames.clear();
outputNames.clear();
#if (JUCE_LINUX || JUCE_BSD)
if (juce_libjackHandle == nullptr) juce_libjackHandle = dlopen ("libjack.so.0", RTLD_LAZY);
if (juce_libjackHandle == nullptr) juce_libjackHandle = dlopen ("libjack.so", RTLD_LAZY);
#elif JUCE_MAC
if (juce_libjackHandle == nullptr) juce_libjackHandle = dlopen ("libjack.dylib", RTLD_LAZY);
#elif JUCE_WINDOWS
#if JUCE_64BIT
if (juce_libjackHandle == nullptr) juce_libjackHandle = LoadLibraryA ("libjack64.dll");
#else
if (juce_libjackHandle == nullptr) juce_libjackHandle = LoadLibraryA ("libjack.dll");
#endif
#endif
if (juce_libjackHandle == nullptr) return;
jack_status_t status = {};