| @@ -108,6 +108,10 @@ ifneq ($(WIN32),true) | |||
| BASE_FLAGS += -fPIC -DPIC | |||
| endif | |||
| ifeq ($(CLANG),true) | |||
| BASE_FLAGS += -Wabsolute-value | |||
| endif | |||
| ifeq ($(STOAT),true) | |||
| CC = clang | |||
| CXX = clang++ | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * Carla Plugin Host | |||
| * Copyright (C) 2011-2014 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2011-2015 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU General Public License as | |||
| @@ -1215,8 +1215,6 @@ public: | |||
| const char* const fullPortNameB = fUsedPorts.getFullPortName(groupB, portB); | |||
| CARLA_SAFE_ASSERT_RETURN(fullPortNameB != nullptr && fullPortNameB[0] != '\0', false); | |||
| carla_stdout("patchbayConnect(%u, %u, %u, %u => %s, %s)", groupA, portA, groupB, portB, fullPortNameA, fullPortNameB); | |||
| if (! jackbridge_connect(fClient, fullPortNameA, fullPortNameB)) | |||
| { | |||
| setLastError("JACK operation failed"); | |||
| @@ -2198,39 +2196,29 @@ private: | |||
| static int JACKBRIDGE_API carla_jack_bufsize_callback(jack_nframes_t newBufferSize, void* arg) | |||
| { | |||
| carla_stdout("JACK %s", __FUNCTION__); | |||
| carla_stdout("JACK bufSize %i", newBufferSize); | |||
| carla_stdout("JACK bufSize %p", arg); | |||
| handlePtr->handleJackBufferSizeCallback(newBufferSize); | |||
| return 0; | |||
| } | |||
| static int JACKBRIDGE_API carla_jack_srate_callback(jack_nframes_t newSampleRate, void* arg) | |||
| { | |||
| carla_stdout("JACK %s", __FUNCTION__); | |||
| carla_stdout("JACK srate %i", newSampleRate); | |||
| carla_stdout("JACK srate %p", arg); | |||
| handlePtr->handleJackSampleRateCallback(newSampleRate); | |||
| return 0; | |||
| } | |||
| static void JACKBRIDGE_API carla_jack_freewheel_callback(int starting, void* arg) | |||
| { | |||
| carla_stdout("JACK %s", __FUNCTION__); | |||
| handlePtr->handleJackFreewheelCallback(bool(starting)); | |||
| } | |||
| static int JACKBRIDGE_API carla_jack_process_callback(jack_nframes_t nframes, void* arg) __attribute__((annotate("realtime"))) | |||
| { | |||
| carla_stdout("PROCESS CALLBACK START"); | |||
| handlePtr->handleJackProcessCallback(nframes); | |||
| carla_stdout("PROCESS CALLBACK END"); | |||
| return 0; | |||
| } | |||
| static void JACKBRIDGE_API carla_jack_latency_callback(jack_latency_callback_mode_t mode, void* arg) | |||
| { | |||
| carla_stdout("JACK %s", __FUNCTION__); | |||
| handlePtr->handleJackLatencyCallback(mode); | |||
| } | |||
| @@ -2266,7 +2254,6 @@ private: | |||
| static void JACKBRIDGE_API carla_jack_shutdown_callback(void* arg) | |||
| { | |||
| carla_stdout("JACK %s", __FUNCTION__); | |||
| handlePtr->handleJackShutdownCallback(); | |||
| } | |||
| @@ -390,6 +390,7 @@ int main(int argc, char* argv[]) | |||
| rtClientBaseName[0] = '\0'; | |||
| nonRtClientBaseName[0] = '\0'; | |||
| nonRtServerBaseName[0] = '\0'; | |||
| jackbridge_init(); | |||
| } | |||
| // --------------------------------------------------------------------- | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * JackBridge | |||
| * Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -31,21 +31,22 @@ | |||
| #include "CarlaDefines.h" | |||
| #ifdef __cdecl | |||
| # define JACKBRIDGE_API __cdecl | |||
| #else | |||
| # define JACKBRIDGE_API | |||
| #endif | |||
| #ifdef JACKBRIDGE_DIRECT | |||
| # include <jack/jack.h> | |||
| # include <jack/midiport.h> | |||
| # include <jack/transport.h> | |||
| # include <jack/session.h> | |||
| # include <jack/metadata.h> | |||
| #else | |||
| #include <cstddef> | |||
| #if (defined(CARLA_OS_WIN) && ! defined(BUILDING_CARLA_FOR_WINDOWS)) || defined(__WINE__) | |||
| # define JACKBRIDGE_API __cdecl | |||
| #else | |||
| # define JACKBRIDGE_API | |||
| #endif | |||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | |||
| # include <cstdint> | |||
| #else | |||
| @@ -281,6 +282,7 @@ typedef void (JACKBRIDGE_API *JackPropertyChangeCallback)(jack_uuid_t subject, c | |||
| #endif // ! JACKBRIDGE_DIRECT | |||
| JACKBRIDGE_API bool jackbridge_is_ok() noexcept; | |||
| JACKBRIDGE_API void jackbridge_init(); | |||
| JACKBRIDGE_API void jackbridge_get_version(int* major_ptr, int* minor_ptr, int* micro_ptr, int* proto_ptr); | |||
| JACKBRIDGE_API const char* jackbridge_get_version_string(); | |||
| @@ -1,6 +1,6 @@ | |||
| /* | |||
| * JackBridge (Part 3, Export) | |||
| * Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * Permission to use, copy, modify, and/or distribute this software for any purpose with | |||
| * or without fee is hereby granted, provided that the above copyright notice and this | |||
| @@ -28,17 +28,16 @@ | |||
| // ----------------------------------------------------------------------------- | |||
| JACKBRIDGE_EXPORT | |||
| const JackBridgeExportedFunctions* JACKBRIDGE_API jackbridge_get_exported_functions(); | |||
| JACKBRIDGE_EXPORT | |||
| const JackBridgeExportedFunctions* JACKBRIDGE_API jackbridge_get_exported_functions() | |||
| { | |||
| static JackBridgeExportedFunctions funcs; | |||
| carla_zeroStruct(funcs); | |||
| funcs.unique1 = funcs.unique2 = funcs.unique3 = 0xdeadf00d; | |||
| carla_stdout("WINE jackbridge_get_exported_functions() called, data: %lu %lu %lu", funcs.unique1, funcs.unique2, funcs.unique3); | |||
| carla_stdout("WINE jackbridge_get_exported_functions() %p %p %p %lu", &funcs.unique1, &funcs.unique2, &funcs.unique3, | |||
| uintptr_t(&funcs.unique3) - uintptr_t(&funcs.unique1)); | |||
| funcs.init_ptr = jackbridge_init; | |||
| funcs.get_version_ptr = jackbridge_get_version; | |||
| funcs.get_version_string_ptr = jackbridge_get_version_string; | |||
| funcs.client_open_ptr = jackbridge_client_open; | |||
| @@ -137,6 +136,8 @@ const JackBridgeExportedFunctions* JACKBRIDGE_API jackbridge_get_exported_functi | |||
| funcs.shm_close_ptr = jackbridge_shm_close; | |||
| funcs.shm_map_ptr = jackbridge_shm_map; | |||
| funcs.unique1 = funcs.unique2 = funcs.unique3 = 0xdeadf00d; | |||
| return &funcs; | |||
| } | |||
| @@ -62,13 +62,6 @@ public: | |||
| const JackBridgeExportedFunctions* const funcs(bridge.func()); | |||
| CARLA_SAFE_ASSERT_RETURN(funcs != nullptr, fallback); | |||
| CARLA_SAFE_ASSERT_RETURN(funcs->unique1 != 0, fallback); | |||
| carla_stdout("unique1: %lu", funcs->unique1); | |||
| carla_stdout("unique2: %lu", funcs->unique2); | |||
| carla_stdout("unique3: %lu", funcs->unique3); | |||
| carla_stdout("WINDOWS get_exported_functions() %p %p %p %lu", &funcs->unique1, &funcs->unique2, &funcs->unique3, | |||
| uintptr_t(&funcs->unique3) - uintptr_t(&funcs->unique1)); | |||
| CARLA_SAFE_ASSERT_RETURN(funcs->unique1 == funcs->unique2, fallback); | |||
| CARLA_SAFE_ASSERT_RETURN(funcs->unique2 == funcs->unique3, fallback); | |||
| CARLA_SAFE_ASSERT_RETURN(funcs->shm_map_ptr != nullptr, fallback); | |||
| @@ -97,7 +90,12 @@ static const JackBridgeExportedFunctions& getBridgeInstance() noexcept | |||
| bool jackbridge_is_ok() noexcept | |||
| { | |||
| const JackBridgeExportedFunctions& instance(getBridgeInstance()); | |||
| return (instance.unique1 != 0 && instance.unique1 == instance.unique2); | |||
| return (instance.unique1 != 0 && instance.unique1 == instance.unique2 && instance.init_ptr != nullptr); | |||
| } | |||
| void jackbridge_init() | |||
| { | |||
| return getBridgeInstance().init_ptr(); | |||
| } | |||
| void jackbridge_get_version(int* major_ptr, int* minor_ptr, int* micro_ptr, int* proto_ptr) | |||
| @@ -20,7 +20,8 @@ extern "C" { | |||
| // ----------------------------------------------------------------------------- | |||
| typedef void (JACKBRIDGE_API *jackbridgesym_get_version)(int* major_ptr, int* minor_ptr, int* micro_ptr, int* proto_ptr); | |||
| typedef void (JACKBRIDGE_API *jackbridgesym_init)(); | |||
| typedef void (JACKBRIDGE_API *jackbridgesym_get_version)(int* major_ptr, int* minor_ptr, int* micro_ptr, int* proto_ptr); | |||
| typedef const char* (JACKBRIDGE_API *jackbridgesym_get_version_string)(void); | |||
| typedef jack_client_t* (JACKBRIDGE_API *jackbridgesym_client_open)(const char* client_name, uint32_t options, jack_status_t* status); | |||
| typedef bool (JACKBRIDGE_API *jackbridgesym_client_close)(jack_client_t* client); | |||
| @@ -122,6 +123,7 @@ typedef void* (JACKBRIDGE_API *jackbridgesym_shm_map)(void* shm, uint64_t size); | |||
| struct _JackBridgeExportedFunctions { | |||
| ulong unique1; | |||
| jackbridgesym_init init_ptr; | |||
| jackbridgesym_get_version get_version_ptr; | |||
| jackbridgesym_get_version_string get_version_string_ptr; | |||
| jackbridgesym_client_open client_open_ptr; | |||