Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Jack Audio on macOS and Windows #1489

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
27 changes: 14 additions & 13 deletions modules/juce_audio_devices/juce_audio_devices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -258,6 +245,20 @@ 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.

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.cpp"
#endif

#include "midi_io/juce_MidiDevices.cpp"

#if ! JUCE_SYSTEMAUDIOVOL_IMPLEMENTED
Expand Down
2 changes: 1 addition & 1 deletion modules/juce_audio_devices/juce_audio_devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down Expand Up @@ -604,8 +608,18 @@ class JackAudioIODeviceType final : public AudioIODeviceType
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 = {};
Expand Down
Loading