| @@ -34,7 +34,7 @@ static const EngineEvent kFallbackEngineEvent; | |||
| #ifndef BUILD_BRIDGE | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| // Bridge Helper, defined in plugin/CarlaBlugin.cpp | |||
| // Bridge Helper, defined in CarlaPlugin.cpp | |||
| extern BinaryType CarlaPluginGetBridgeBinaryType(CarlaPlugin* const plugin); | |||
| @@ -153,7 +153,7 @@ uint32_t CarlaEngineEventPort::getEventCount() | |||
| uint32_t count = 0; | |||
| const EngineEvent* const events = fBuffer; | |||
| for (uint32_t i=0; i < kMaxEventCount; i++, count++) | |||
| for (uint32_t i=0; i < kMaxEventCount; ++i, ++count) | |||
| { | |||
| if (events[i].type == kEngineEventTypeNull) | |||
| break; | |||
| @@ -205,7 +205,7 @@ void CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t | |||
| CARLA_ASSERT(! MIDI_IS_CONTROL_BANK_SELECT(param)); | |||
| } | |||
| for (uint32_t i=0; i < kMaxEventCount; i++) | |||
| for (uint32_t i=0; i < kMaxEventCount; ++i) | |||
| { | |||
| if (fBuffer[i].type != kEngineEventTypeNull) | |||
| continue; | |||
| @@ -245,10 +245,10 @@ void CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t cha | |||
| return; | |||
| if (size == 0) | |||
| return; | |||
| if (size > 3) | |||
| if (size > 4) | |||
| return; | |||
| for (uint32_t i=0; i < kMaxEventCount; i++) | |||
| for (uint32_t i=0; i < kMaxEventCount; ++i) | |||
| { | |||
| if (fBuffer[i].type != kEngineEventTypeNull) | |||
| continue; | |||
| @@ -257,11 +257,10 @@ void CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t cha | |||
| fBuffer[i].time = time; | |||
| fBuffer[i].channel = channel; | |||
| fBuffer[i].midi.port = port; | |||
| fBuffer[i].midi.data[0] = data[0]; | |||
| fBuffer[i].midi.data[1] = data[1]; | |||
| fBuffer[i].midi.data[2] = data[2]; | |||
| fBuffer[i].midi.size = size; | |||
| fBuffer[i].midi.port = port; | |||
| fBuffer[i].midi.size = size; | |||
| carla_copy<uint8_t>(fBuffer[i].midi.data, data, size); | |||
| return; | |||
| } | |||
| @@ -380,7 +379,7 @@ void doPluginRemove(CarlaEngineProtectedData* const kData, const bool unlock) | |||
| CarlaPlugin* plugin; | |||
| // move all plugins 1 spot backwards | |||
| for (unsigned int i=id; i < kData->curPluginCount; i++) | |||
| for (unsigned int i=id; i < kData->curPluginCount; ++i) | |||
| { | |||
| plugin = kData->plugins[i+1].plugin; | |||
| @@ -650,7 +649,7 @@ void CarlaEngine::idle() | |||
| CARLA_ASSERT(kData->plugins != nullptr); | |||
| //CARLA_ASSERT(isRunning()); | |||
| for (unsigned int i=0; i < kData->curPluginCount; i++) | |||
| for (unsigned int i=0; i < kData->curPluginCount; ++i) | |||
| { | |||
| CarlaPlugin* const plugin = kData->plugins[i].plugin; | |||
| @@ -865,7 +864,7 @@ void CarlaEngine::removeAllPlugins() | |||
| kData->curPluginCount = 0; | |||
| for (unsigned int i=0; i < oldCount; i++) | |||
| for (unsigned int i=0; i < oldCount; ++i) | |||
| { | |||
| CarlaPlugin* const plugin = kData->plugins[i].plugin; | |||
| @@ -999,7 +998,7 @@ const char* CarlaEngine::getNewUniquePluginName(const char* const name) | |||
| sname.truncate(maxClientNameSize()-5-1); // 5 = strlen(" (10)") | |||
| sname.replace(':', '.'); // ':' is used in JACK1 to split client/port names | |||
| for (unsigned short i=0; i < kData->curPluginCount; i++) | |||
| for (unsigned short i=0; i < kData->curPluginCount; ++i) | |||
| { | |||
| CARLA_ASSERT(kData->plugins[i].plugin); | |||
| @@ -1152,7 +1151,7 @@ bool CarlaEngine::saveProject(const char* const filename) | |||
| bool firstPlugin = true; | |||
| char strBuf[STR_MAX+1]; | |||
| for (unsigned int i=0; i < kData->curPluginCount; i++) | |||
| for (unsigned int i=0; i < kData->curPluginCount; ++i) | |||
| { | |||
| CarlaPlugin* const plugin = kData->plugins[i].plugin; | |||
| @@ -1464,7 +1463,7 @@ void CarlaEngine::bufferSizeChanged(const uint32_t newBufferSize) | |||
| { | |||
| carla_debug("CarlaEngine::bufferSizeChanged(%i)", newBufferSize); | |||
| for (unsigned int i=0; i < kData->curPluginCount; i++) | |||
| for (unsigned int i=0; i < kData->curPluginCount; ++i) | |||
| { | |||
| CarlaPlugin* const plugin = kData->plugins[i].plugin; | |||
| @@ -1479,7 +1478,7 @@ void CarlaEngine::sampleRateChanged(const double newSampleRate) | |||
| { | |||
| carla_debug("CarlaEngine::sampleRateChanged(%g)", newSampleRate); | |||
| for (unsigned int i=0; i < kData->curPluginCount; i++) | |||
| for (unsigned int i=0; i < kData->curPluginCount; ++i) | |||
| { | |||
| CarlaPlugin* const plugin = kData->plugins[i].plugin; | |||
| @@ -1512,7 +1511,7 @@ void CarlaEngine::proccessPendingEvents() | |||
| fTimeInfo.frame = kData->time.frame; | |||
| } | |||
| for (unsigned int i=0; i < kData->curPluginCount; i++) | |||
| for (unsigned int i=0; i < kData->curPluginCount; ++i) | |||
| { | |||
| // TODO - peak values? | |||
| } | |||
| @@ -1548,7 +1547,7 @@ void CarlaEngine::processRack(float* inBuf[2], float* outBuf[2], const uint32_t | |||
| bool processed = false; | |||
| // process plugins | |||
| for (unsigned int i=0; i < kData->curPluginCount; i++) | |||
| for (unsigned int i=0; i < kData->curPluginCount; ++i) | |||
| { | |||
| CarlaPlugin* const plugin = kData->plugins[i].plugin; | |||
| @@ -1577,7 +1576,7 @@ void CarlaEngine::processRack(float* inBuf[2], float* outBuf[2], const uint32_t | |||
| // if plugin has no audio inputs, add previous buffers | |||
| if (plugin->audioInCount() == 0) | |||
| { | |||
| for (uint32_t j=0; j < frames; j++) | |||
| for (uint32_t j=0; j < frames; ++j) | |||
| { | |||
| outBuf[0][j] += inBuf[0][j]; | |||
| outBuf[1][j] += inBuf[1][j]; | |||
| @@ -1586,7 +1585,7 @@ void CarlaEngine::processRack(float* inBuf[2], float* outBuf[2], const uint32_t | |||
| // if plugin has no midi output, add previous events | |||
| if (plugin->midiOutCount() == 0) | |||
| { | |||
| for (uint32_t j=0, k=0; j < frames; j++) | |||
| for (uint32_t j=0, k=0; j < frames; ++j) | |||
| { | |||
| } | |||
| @@ -1601,7 +1600,7 @@ void CarlaEngine::processRack(float* inBuf[2], float* outBuf[2], const uint32_t | |||
| float outPeak1 = 0.0f; | |||
| float outPeak2 = 0.0f; | |||
| for (uint32_t k=0; k < frames; k++) | |||
| for (uint32_t k=0; k < frames; ++k) | |||
| { | |||
| setValueIfHigher(inPeak1, std::fabs(inBuf[0][k])); | |||
| setValueIfHigher(inPeak2, std::fabs(inBuf[1][k])); | |||
| @@ -47,7 +47,6 @@ PKGCONFIG += alsa | |||
| # JACK | |||
| DEFINES += __UNIX_JACK__ | |||
| PKGCONFIG += jack | |||
| # PulseAudio | |||
| DEFINES += __LINUX_PULSE__ | |||
| @@ -228,9 +228,9 @@ public: | |||
| float* inBuffer[inCount]; | |||
| float* outBuffer[outCount]; | |||
| for (uint32_t i=0; i < inCount; i++) | |||
| for (uint32_t i=0; i < inCount; ++i) | |||
| inBuffer[i] = fShmAudioPool.data + i*fBufferSize; | |||
| for (uint32_t i=0; i < outCount; i++) | |||
| for (uint32_t i=0; i < outCount; ++i) | |||
| outBuffer[i] = fShmAudioPool.data + (i+inCount)*fBufferSize; | |||
| plugin->initBuffers(); | |||
| @@ -21,7 +21,7 @@ | |||
| #include "CarlaBackendUtils.hpp" | |||
| #include "CarlaMIDI.h" | |||
| #include "jackbridge/jackbridge.h" | |||
| #include "jackbridge/JackBridge.cpp" | |||
| #include <cmath> | |||
| #include <QtCore/QStringList> | |||
| @@ -591,15 +591,10 @@ public: | |||
| initJackPatchbay(jackClientName); | |||
| // TODO - update jackbridge | |||
| jack_set_client_registration_callback(fClient, carla_jack_client_registration_callback, this); | |||
| jack_set_port_registration_callback(fClient, carla_jack_port_registration_callback, this); | |||
| jack_set_port_connect_callback(fClient, carla_jack_port_connect_callback, this); | |||
| #ifdef WANT_JACK_PORT_RENAME | |||
| if (jack_set_port_rename_callback) | |||
| jack_set_port_rename_callback(fClient, carla_jack_port_rename_callback, this); | |||
| #endif | |||
| jackbridge_set_client_registration_callback(fClient, carla_jack_client_registration_callback, this); | |||
| jackbridge_set_port_registration_callback(fClient, carla_jack_port_registration_callback, this); | |||
| jackbridge_set_port_connect_callback(fClient, carla_jack_port_connect_callback, this); | |||
| jackbridge_set_port_rename_callback(fClient, carla_jack_port_rename_callback, this); | |||
| if (fOptions.processMode == PROCESS_MODE_CONTINUOUS_RACK) | |||
| { | |||
| @@ -776,7 +771,7 @@ public: | |||
| return false; | |||
| } | |||
| for (int i=0, count=fUsedConnections.count(); i < count; i++) | |||
| for (int i=0, count=fUsedConnections.count(); i < count; ++i) | |||
| { | |||
| if (fUsedConnections[i].id == connectionId) | |||
| { | |||
| @@ -950,7 +945,7 @@ protected: | |||
| #else | |||
| if (fOptions.processMode == PROCESS_MODE_SINGLE_CLIENT) | |||
| { | |||
| for (unsigned int i=0; i < kData->curPluginCount; i++) | |||
| for (unsigned int i=0; i < kData->curPluginCount; ++i) | |||
| { | |||
| CarlaPlugin* const plugin = getPluginUnchecked(i); | |||
| @@ -992,7 +987,7 @@ protected: | |||
| jack_midi_event_t jackEvent; | |||
| const uint32_t jackEventCount = jackbridge_midi_get_event_count(eventIn); | |||
| for (uint32_t jackEventIndex=0; jackEventIndex < jackEventCount; jackEventIndex++) | |||
| for (uint32_t jackEventIndex=0; jackEventIndex < jackEventCount; ++jackEventIndex) | |||
| { | |||
| if (jackbridge_midi_event_get(&jackEvent, eventIn, jackEventIndex) != 0) | |||
| continue; | |||
| @@ -1071,7 +1066,7 @@ protected: | |||
| { | |||
| jackbridge_midi_clear_buffer(eventOut); | |||
| for (unsigned short i=0; i < RACK_EVENT_COUNT; i++) | |||
| for (unsigned short i=0; i < RACK_EVENT_COUNT; ++i) | |||
| { | |||
| EngineEvent* const engineEvent = &kData->rack.out[i]; | |||
| @@ -1158,7 +1153,7 @@ protected: | |||
| if (fOptions.processMode != PROCESS_MODE_SINGLE_CLIENT) | |||
| return; | |||
| for (unsigned int i=0; i < kData->curPluginCount; i++) | |||
| for (unsigned int i=0; i < kData->curPluginCount; ++i) | |||
| { | |||
| CarlaPlugin* const plugin = getPluginUnchecked(i); | |||
| @@ -1183,7 +1178,7 @@ protected: | |||
| } | |||
| else | |||
| { | |||
| for (int i=0, count=fUsedGroupNames.count(); i < count; i++) | |||
| for (int i=0, count=fUsedGroupNames.count(); i < count; ++i) | |||
| { | |||
| if (fUsedGroupNames[i].name == name) | |||
| { | |||
| @@ -1226,7 +1221,7 @@ protected: | |||
| } | |||
| else | |||
| { | |||
| for (int i=0, count=fUsedPortNames.count(); i < count; i++) | |||
| for (int i=0, count=fUsedPortNames.count(); i < count; ++i) | |||
| { | |||
| if (fUsedPortNames[i].groupId == groupId && fUsedPortNames[i].name == portName) | |||
| { | |||
| @@ -1259,7 +1254,7 @@ protected: | |||
| } | |||
| else | |||
| { | |||
| for (int i=0, count=fUsedConnections.count(); i < count; i++) | |||
| for (int i=0, count=fUsedConnections.count(); i < count; ++i) | |||
| { | |||
| if (fUsedConnections[i].portOut == portIdA && fUsedConnections[i].portIn == portIdB) | |||
| { | |||
| @@ -1281,7 +1276,7 @@ protected: | |||
| const char* portName = jack_port_short_name(jackPort); | |||
| for (int i=0, count=fUsedPortNames.count(); i < count; i++) | |||
| for (int i=0, count=fUsedPortNames.count(); i < count; ++i) | |||
| { | |||
| if (fUsedPortNames[i].groupId == groupId && fUsedPortNames[i].name == portName) | |||
| { | |||
| @@ -1295,7 +1290,7 @@ protected: | |||
| void handleJackShutdownCallback() | |||
| { | |||
| for (unsigned int i=0; i < kData->curPluginCount; i++) | |||
| for (unsigned int i=0; i < kData->curPluginCount; ++i) | |||
| { | |||
| //CarlaPlugin* const plugin = getPluginUnchecked(i); | |||
| @@ -1360,7 +1355,7 @@ private: | |||
| int getGroupId(QString groupName) | |||
| { | |||
| for (int i=0, count=fUsedGroupNames.count(); i < count; i++) | |||
| for (int i=0, count=fUsedGroupNames.count(); i < count; ++i) | |||
| { | |||
| if (fUsedGroupNames[i].name == groupName) | |||
| { | |||
| @@ -1377,7 +1372,7 @@ private: | |||
| int groupId = getGroupId(groupName); | |||
| for (int i=0, count=fUsedPortNames.count(); i < count; i++) | |||
| for (int i=0, count=fUsedPortNames.count(); i < count; ++i) | |||
| { | |||
| if (fUsedPortNames[i].groupId == groupId && fUsedPortNames[i].name == portName) | |||
| { | |||
| @@ -1392,7 +1387,7 @@ private: | |||
| { | |||
| static QString fallbackString; | |||
| for (int i=0, count=fUsedPortNames.count(); i < count; i++) | |||
| for (int i=0, count=fUsedPortNames.count(); i < count; ++i) | |||
| { | |||
| if (fUsedPortNames[i].portId == portId) | |||
| { | |||
| @@ -1423,7 +1418,7 @@ private: | |||
| if (const char** ports = jack_get_ports(fClient, nullptr, nullptr, 0)) | |||
| { | |||
| for (int i=0; ports[i] != nullptr; i++) | |||
| for (int i=0; ports[i] != nullptr; ++i) | |||
| { | |||
| jack_port_t* jackPort = jack_port_by_name(fClient, ports[i]); | |||
| const char* portName = jack_port_short_name(jackPort); | |||
| @@ -1477,7 +1472,7 @@ private: | |||
| // query connections, after all ports are in place | |||
| if (const char** ports = jack_get_ports(fClient, nullptr, nullptr, JackPortIsOutput)) | |||
| { | |||
| for (int i=0; ports[i] != nullptr; i++) | |||
| for (int i=0; ports[i] != nullptr; ++i) | |||
| { | |||
| jack_port_t* jackPort = jack_port_by_name(fClient, ports[i]); | |||
| @@ -1485,7 +1480,7 @@ private: | |||
| if (const char** jackConnections = jack_port_get_connections(jackPort)) | |||
| { | |||
| for (int j=0; jackConnections[j] != nullptr; j++) | |||
| for (int j=0; jackConnections[j] != nullptr; ++j) | |||
| { | |||
| int targetPortId = getPortId(QString(jackConnections[j])); | |||
| @@ -1526,21 +1521,21 @@ private: | |||
| if (outCount > 0) | |||
| carla_zeroFloat(outPeaks, outCount); | |||
| for (uint32_t i=0; i < inCount; i++) | |||
| for (uint32_t i=0; i < inCount; ++i) | |||
| { | |||
| CarlaEngineAudioPort* const port = CarlaPluginGetAudioInPort(plugin, i); | |||
| inBuffer[i] = port->getBuffer(); | |||
| } | |||
| for (uint32_t i=0; i < outCount; i++) | |||
| for (uint32_t i=0; i < outCount; ++i) | |||
| { | |||
| CarlaEngineAudioPort* const port = CarlaPluginGetAudioOutPort(plugin, i); | |||
| outBuffer[i] = port->getBuffer(); | |||
| } | |||
| for (uint32_t i=0; i < inCount; i++) | |||
| for (uint32_t i=0; i < inCount; ++i) | |||
| { | |||
| for (uint32_t j=0; j < nframes; j++) | |||
| for (uint32_t j=0; j < nframes; ++j) | |||
| { | |||
| const float absV = std::fabs(inBuffer[i][j]); | |||
| @@ -1551,9 +1546,9 @@ private: | |||
| plugin->process(inBuffer, outBuffer, nframes); | |||
| for (uint32_t i=0; i < outCount; i++) | |||
| for (uint32_t i=0; i < outCount; ++i) | |||
| { | |||
| for (uint32_t j=0; j < nframes; j++) | |||
| for (uint32_t j=0; j < nframes; ++j) | |||
| { | |||
| const float absV = std::fabs(outBuffer[i][j]); | |||
| @@ -1579,7 +1574,7 @@ private: | |||
| if (mode == JackCaptureLatency) | |||
| { | |||
| for (uint32_t i=0; i < inCount; i++) | |||
| for (uint32_t i=0; i < inCount; ++i) | |||
| { | |||
| uint32_t aOutI = (i >= outCount) ? outCount : i; | |||
| jack_port_t* const portIn = ((CarlaEngineJackAudioPort*)CarlaPluginGetAudioInPort(plugin, i))->kPort; | |||
| @@ -1593,7 +1588,7 @@ private: | |||
| } | |||
| else | |||
| { | |||
| for (uint32_t i=0; i < outCount; i++) | |||
| for (uint32_t i=0; i < outCount; ++i) | |||
| { | |||
| uint32_t aInI = (i >= inCount) ? inCount : i; | |||
| jack_port_t* const portIn = ((CarlaEngineJackAudioPort*)CarlaPluginGetAudioInPort(plugin, aInI))->kPort; | |||
| @@ -29,7 +29,7 @@ CARLA_BACKEND_START_NAMESPACE | |||
| #ifndef BUILD_BRIDGE | |||
| // ------------------------------------------------------------------- | |||
| // Bridge Helper, defined in plugin/CarlaBlugin.cpp | |||
| // Bridge Helper, defined in CarlaPlugin.cpp | |||
| extern int CarlaPluginSetOscBridgeInfo(CarlaPlugin* const plugin, const PluginBridgeInfoType type, | |||
| const int argc, const lo_arg* const* const argv, const char* const types); | |||
| @@ -416,7 +416,7 @@ int CarlaEngineOsc::handleMsgRegister(const bool isTCP, const int argc, const lo | |||
| std::free(port); | |||
| } | |||
| for (unsigned short i=0; i < kEngine->currentPluginCount(); i++) | |||
| for (unsigned short i=0; i < kEngine->currentPluginCount(); ++i) | |||
| { | |||
| CarlaPlugin* const plugin = kEngine->getPluginUnchecked(i); | |||
| @@ -543,7 +543,7 @@ protected: | |||
| // initialize audio input | |||
| if (fAudioIsInterleaved) | |||
| { | |||
| for (unsigned int i=0; i < nframes*2; i++) | |||
| for (unsigned int i=0; i < nframes*2; ++i) | |||
| { | |||
| if (i % 2 == 0) | |||
| fAudioInBuf1[i/2] = insPtr[i]; | |||
| @@ -662,7 +662,7 @@ protected: | |||
| // output audio | |||
| if (fAudioIsInterleaved) | |||
| { | |||
| for (unsigned int i=0; i < nframes*2; i++) | |||
| for (unsigned int i=0; i < nframes*2; ++i) | |||
| { | |||
| if (i % 2 == 0) | |||
| outsPtr[i] = fAudioOutBuf1[i/2]; | |||
| @@ -806,7 +806,7 @@ protected: | |||
| { | |||
| carla_debug("CarlaEngineRtAudio::getPatchbayPortId(\"%s\")", name.toUtf8().constData()); | |||
| for (int i=0, count=fUsedPortNames.count(); i < count; i++) | |||
| for (int i=0, count=fUsedPortNames.count(); i < count; ++i) | |||
| { | |||
| carla_debug("CarlaEngineRtAudio::getPatchbayPortId(\"%s\") VS \"%s\"", name.toUtf8().constData(), fUsedPortNames[i].name.toUtf8().constData()); | |||
| @@ -85,7 +85,7 @@ void CarlaEngineThread::run() | |||
| oscRegisted = kEngine->isOscControlRegistered(); | |||
| #endif | |||
| for (i=0, count = kEngine->currentPluginCount(); i < count; i++) | |||
| for (i=0, count = kEngine->currentPluginCount(); i < count; ++i) | |||
| { | |||
| CarlaPlugin* const plugin = kEngine->getPluginUnchecked(i); | |||
| @@ -107,7 +107,7 @@ void CarlaEngineThread::run() | |||
| // --------------------------------------------------- | |||
| // Update parameter outputs | |||
| for (uint32_t j=0; j < plugin->parameterCount(); j++) | |||
| for (uint32_t j=0; j < plugin->parameterCount(); ++j) | |||
| { | |||
| if (! plugin->parameterIsOutput(j)) | |||
| continue; | |||
| @@ -0,0 +1,604 @@ | |||
| /* | |||
| * JackBridge | |||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Lesser General Public | |||
| * License as published by the Free Software Foundation. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * GNU Lesser General Public License for more details. | |||
| * | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #include "JackBridge.hpp" | |||
| #include "CarlaLibUtils.hpp" | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| # include <time.h> | |||
| # include <semaphore.h> | |||
| #endif | |||
| // ----------------------------------------------------------------------------- | |||
| typedef const char* (*jacksym_get_version_string)(); | |||
| typedef jack_client_t* (*jacksym_client_open)(const char*, jack_options_t, jack_status_t*, ...); | |||
| typedef int (*jacksym_client_close)(jack_client_t*); | |||
| typedef int (*jacksym_client_name_size)(); | |||
| typedef char* (*jacksym_get_client_name)(jack_client_t*); | |||
| typedef int (*jacksym_activate)(jack_client_t*); | |||
| typedef int (*jacksym_deactivate)(jack_client_t*); | |||
| typedef void (*jacksym_on_shutdown)(jack_client_t*, JackShutdownCallback, void*); | |||
| typedef int (*jacksym_set_process_callback)(jack_client_t*, JackProcessCallback, void*); | |||
| typedef int (*jacksym_set_freewheel_callback)(jack_client_t*, JackFreewheelCallback, void*); | |||
| typedef int (*jacksym_set_buffer_size_callback)(jack_client_t*, JackBufferSizeCallback, void*); | |||
| typedef int (*jacksym_set_sample_rate_callback)(jack_client_t*, JackSampleRateCallback, void*); | |||
| typedef int (*jacksym_set_client_registration_callback)(jack_client_t*, JackClientRegistrationCallback, void*); | |||
| typedef int (*jacksym_set_port_registration_callback)(jack_client_t*, JackPortRegistrationCallback, void*); | |||
| typedef int (*jacksym_set_port_connect_callback)(jack_client_t*, JackPortConnectCallback, void*); | |||
| typedef int (*jacksym_set_port_rename_callback)(jack_client_t*, JackPortRenameCallback, void*); | |||
| typedef int (*jacksym_set_latency_callback)(jack_client_t*, JackLatencyCallback, void*); | |||
| typedef jack_nframes_t (*jacksym_get_sample_rate)(jack_client_t*); | |||
| typedef jack_nframes_t (*jacksym_get_buffer_size)(jack_client_t*); | |||
| typedef jack_port_t* (*jacksym_port_register)(jack_client_t*, const char*, const char*, unsigned long, unsigned long); | |||
| typedef int (*jacksym_port_unregister)(jack_client_t*, jack_port_t*); | |||
| typedef void* (*jacksym_port_get_buffer)(jack_port_t*, jack_nframes_t); | |||
| typedef const char* (*jacksym_port_name)(const jack_port_t*); | |||
| typedef const char* (*jacksym_port_short_name)(const jack_port_t*); | |||
| typedef int (*jacksym_port_flags)(const jack_port_t*); | |||
| typedef const char* (*jacksym_port_type)(const jack_port_t*); | |||
| typedef int (*jacksym_port_set_name)(jack_port_t*, const char*); | |||
| typedef int (*jacksym_connect)(jack_client_t*, const char*, const char*); | |||
| typedef int (*jacksym_disconnect)(jack_client_t*, const char*, const char*); | |||
| typedef int (*jacksym_port_name_size)(); | |||
| typedef void (*jacksym_port_get_latency_range)(jack_port_t*, jack_latency_callback_mode_t, jack_latency_range_t*); | |||
| typedef void (*jacksym_port_set_latency_range)(jack_port_t*, jack_latency_callback_mode_t, jack_latency_range_t*); | |||
| typedef int (*jacksym_recompute_total_latencies)(jack_client_t*); | |||
| typedef void (*jacksym_free)(void*); | |||
| typedef uint32_t (*jacksym_midi_get_event_count)(void*); | |||
| typedef int (*jacksym_midi_event_get)(jack_midi_event_t*, void*, uint32_t); | |||
| typedef void (*jacksym_midi_clear_buffer)(void*); | |||
| typedef int (*jacksym_midi_event_write)(void*, jack_nframes_t, const jack_midi_data_t*, size_t); | |||
| typedef jack_midi_data_t* (*jacksym_midi_event_reserve)(void*, jack_nframes_t, size_t); | |||
| typedef int (*jacksym_transport_locate)(jack_client_t*, jack_nframes_t); | |||
| typedef void (*jacksym_transport_start)(jack_client_t*); | |||
| typedef void (*jacksym_transport_stop)(jack_client_t*); | |||
| typedef jack_transport_state_t (*jacksym_transport_query)(const jack_client_t*, jack_position_t*); | |||
| // ----------------------------------------------------------------------------- | |||
| struct JackBridge | |||
| { | |||
| void* lib; | |||
| jacksym_get_version_string get_version_string_ptr; | |||
| jacksym_client_open client_open_ptr; | |||
| jacksym_client_close client_close_ptr; | |||
| jacksym_client_name_size client_name_size_ptr; | |||
| jacksym_get_client_name get_client_name_ptr; | |||
| jacksym_activate activate_ptr; | |||
| jacksym_deactivate deactivate_ptr; | |||
| jacksym_on_shutdown on_shutdown_ptr; | |||
| jacksym_set_process_callback set_process_callback_ptr; | |||
| jacksym_set_freewheel_callback set_freewheel_callback_ptr; | |||
| jacksym_set_buffer_size_callback set_buffer_size_callback_ptr; | |||
| jacksym_set_sample_rate_callback set_sample_rate_callback_ptr; | |||
| jacksym_set_client_registration_callback set_client_registration_callback_ptr; | |||
| jacksym_set_port_registration_callback set_port_registration_callback_ptr; | |||
| jacksym_set_port_connect_callback set_port_connect_callback_ptr; | |||
| jacksym_set_port_rename_callback set_port_rename_callback_ptr; | |||
| jacksym_set_latency_callback set_latency_callback_ptr; | |||
| jacksym_get_sample_rate get_sample_rate_ptr; | |||
| jacksym_get_buffer_size get_buffer_size_ptr; | |||
| jacksym_port_register port_register_ptr; | |||
| jacksym_port_unregister port_unregister_ptr; | |||
| jacksym_port_get_buffer port_get_buffer_ptr; | |||
| jacksym_port_name port_name_ptr; | |||
| jacksym_port_short_name port_short_name_ptr; | |||
| jacksym_port_flags port_flags_ptr; | |||
| jacksym_port_type port_type_ptr; | |||
| jacksym_port_set_name port_set_name_ptr; | |||
| jacksym_connect connect_ptr; | |||
| jacksym_disconnect disconnect_ptr; | |||
| jacksym_port_name_size port_name_size_ptr; | |||
| jacksym_port_get_latency_range port_get_latency_range_ptr; | |||
| jacksym_port_set_latency_range port_set_latency_range_ptr; | |||
| jacksym_recompute_total_latencies recompute_total_latencies_ptr; | |||
| jacksym_free free_ptr; | |||
| jacksym_midi_get_event_count midi_get_event_count_ptr; | |||
| jacksym_midi_event_get midi_event_get_ptr; | |||
| jacksym_midi_clear_buffer midi_clear_buffer_ptr; | |||
| jacksym_midi_event_write midi_event_write_ptr; | |||
| jacksym_midi_event_reserve midi_event_reserve_ptr; | |||
| jacksym_transport_locate transport_locate_ptr; | |||
| jacksym_transport_start transport_start_ptr; | |||
| jacksym_transport_stop transport_stop_ptr; | |||
| jacksym_transport_query transport_query_ptr; | |||
| JackBridge() | |||
| : lib(nullptr), | |||
| get_version_string_ptr(nullptr), | |||
| client_open_ptr(nullptr), | |||
| client_close_ptr(nullptr), | |||
| client_name_size_ptr(nullptr), | |||
| get_client_name_ptr(nullptr), | |||
| activate_ptr(nullptr), | |||
| deactivate_ptr(nullptr), | |||
| on_shutdown_ptr(nullptr), | |||
| set_process_callback_ptr(nullptr), | |||
| set_freewheel_callback_ptr(nullptr), | |||
| set_buffer_size_callback_ptr(nullptr), | |||
| set_sample_rate_callback_ptr(nullptr), | |||
| set_client_registration_callback_ptr(nullptr), | |||
| set_port_registration_callback_ptr(nullptr), | |||
| set_port_connect_callback_ptr(nullptr), | |||
| set_port_rename_callback_ptr(nullptr), | |||
| set_latency_callback_ptr(nullptr), | |||
| get_sample_rate_ptr(nullptr), | |||
| get_buffer_size_ptr(nullptr), | |||
| port_register_ptr(nullptr), | |||
| port_unregister_ptr(nullptr), | |||
| port_get_buffer_ptr(nullptr), | |||
| port_name_ptr(nullptr), | |||
| port_short_name_ptr(nullptr), | |||
| port_flags_ptr(nullptr), | |||
| port_type_ptr(nullptr), | |||
| port_set_name_ptr(nullptr), | |||
| connect_ptr(nullptr), | |||
| disconnect_ptr(nullptr), | |||
| port_name_size_ptr(nullptr), | |||
| port_get_latency_range_ptr(nullptr), | |||
| port_set_latency_range_ptr(nullptr), | |||
| recompute_total_latencies_ptr(nullptr), | |||
| free_ptr(nullptr), | |||
| midi_get_event_count_ptr(nullptr), | |||
| midi_event_get_ptr(nullptr), | |||
| midi_clear_buffer_ptr(nullptr), | |||
| midi_event_write_ptr(nullptr), | |||
| midi_event_reserve_ptr(nullptr), | |||
| transport_locate_ptr(nullptr), | |||
| transport_start_ptr(nullptr), | |||
| transport_stop_ptr(nullptr), | |||
| transport_query_ptr(nullptr) | |||
| { | |||
| #if defined(CARLA_OS_MAC) | |||
| lib = lib_open("libjack.dylib"); | |||
| #elif defined(CARLA_OS_WIN) | |||
| lib = lib_open("libjack.dll"); | |||
| #else | |||
| lib = lib_open("libjack.so"); | |||
| #endif | |||
| if (lib == nullptr) | |||
| return; | |||
| #define JOIN(a, b) a ## b | |||
| #define LIB_SYMBOL(NAME) JOIN(NAME, _ptr) = (jacksym_##NAME)lib_symbol(lib, "jack_" #NAME); | |||
| LIB_SYMBOL(get_version_string) | |||
| LIB_SYMBOL(client_open) | |||
| LIB_SYMBOL(client_close) | |||
| LIB_SYMBOL(client_name_size) | |||
| LIB_SYMBOL(get_client_name) | |||
| LIB_SYMBOL(activate) | |||
| LIB_SYMBOL(deactivate) | |||
| LIB_SYMBOL(on_shutdown) | |||
| LIB_SYMBOL(set_process_callback) | |||
| LIB_SYMBOL(set_freewheel_callback) | |||
| LIB_SYMBOL(set_buffer_size_callback) | |||
| LIB_SYMBOL(set_sample_rate_callback) | |||
| LIB_SYMBOL(set_client_registration_callback) | |||
| LIB_SYMBOL(set_port_registration_callback) | |||
| LIB_SYMBOL(set_port_connect_callback) | |||
| LIB_SYMBOL(set_port_rename_callback) | |||
| LIB_SYMBOL(set_latency_callback) | |||
| LIB_SYMBOL(get_sample_rate) | |||
| LIB_SYMBOL(get_buffer_size) | |||
| LIB_SYMBOL(port_register) | |||
| LIB_SYMBOL(port_unregister) | |||
| LIB_SYMBOL(port_get_buffer) | |||
| LIB_SYMBOL(port_name) | |||
| LIB_SYMBOL(port_short_name) | |||
| LIB_SYMBOL(port_flags) | |||
| LIB_SYMBOL(port_type) | |||
| LIB_SYMBOL(port_set_name) | |||
| LIB_SYMBOL(connect) | |||
| LIB_SYMBOL(disconnect) | |||
| LIB_SYMBOL(port_name_size) | |||
| LIB_SYMBOL(port_get_latency_range) | |||
| LIB_SYMBOL(port_set_latency_range) | |||
| LIB_SYMBOL(recompute_total_latencies) | |||
| LIB_SYMBOL(free) | |||
| LIB_SYMBOL(midi_get_event_count) | |||
| LIB_SYMBOL(midi_event_get) | |||
| LIB_SYMBOL(midi_clear_buffer) | |||
| LIB_SYMBOL(midi_event_write) | |||
| LIB_SYMBOL(midi_event_reserve) | |||
| LIB_SYMBOL(transport_locate) | |||
| LIB_SYMBOL(transport_start) | |||
| LIB_SYMBOL(transport_stop) | |||
| LIB_SYMBOL(transport_query) | |||
| #undef JOIN | |||
| #undef LIB_SYMBOL | |||
| } | |||
| ~JackBridge() | |||
| { | |||
| if (lib != nullptr) | |||
| lib_close(lib); | |||
| } | |||
| }; | |||
| static JackBridge bridge; | |||
| int main(){return 0;} | |||
| // ----------------------------------------------------------------------------- | |||
| const char* jackbridge_get_version_string() | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.get_version_string_ptr != nullptr) | |||
| return bridge.get_version_string_ptr(); | |||
| #endif | |||
| return nullptr; | |||
| } | |||
| jack_client_t* jackbridge_client_open(const char* client_name, jack_options_t options, jack_status_t* status, ...) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.client_open_ptr != nullptr) | |||
| return bridge.client_open_ptr(client_name, options, status); | |||
| #endif | |||
| return nullptr; | |||
| } | |||
| // ----------------------------------------------------------------------------- | |||
| int jackbridge_client_close(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.client_close_ptr != nullptr) | |||
| return bridge.client_close_ptr(client); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_client_name_size() | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.client_name_size_ptr != nullptr) | |||
| return bridge.client_name_size_ptr(); | |||
| #endif | |||
| return 0; | |||
| } | |||
| char* jackbridge_get_client_name(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.get_client_name_ptr != nullptr) | |||
| return bridge.get_client_name_ptr(client); | |||
| #endif | |||
| return nullptr; | |||
| } | |||
| // ----------------------------------------------------------------------------- | |||
| int jackbridge_activate(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.activate_ptr != nullptr) | |||
| return bridge.activate_ptr(client); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_deactivate(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.deactivate_ptr != nullptr) | |||
| return bridge.deactivate_ptr(client); | |||
| #endif | |||
| return 0; | |||
| } | |||
| void jackbridge_on_shutdown(jack_client_t* client, JackShutdownCallback shutdown_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.on_shutdown_ptr != nullptr) | |||
| bridge.on_shutdown_ptr(client, shutdown_callback, arg); | |||
| #endif | |||
| } | |||
| int jackbridge_set_process_callback(jack_client_t* client, JackProcessCallback process_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.set_process_callback_ptr != nullptr) | |||
| return bridge.set_process_callback_ptr(client, process_callback, arg); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback freewheel_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.set_freewheel_callback_ptr != nullptr) | |||
| return bridge.set_freewheel_callback_ptr(client, freewheel_callback, arg); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback bufsize_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.set_buffer_size_callback_ptr != nullptr) | |||
| return bridge.set_buffer_size_callback_ptr(client, bufsize_callback, arg); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback srate_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.set_sample_rate_callback_ptr != nullptr) | |||
| return bridge.set_sample_rate_callback_ptr(client, srate_callback, arg); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_set_client_registration_callback(jack_client_t* client, JackClientRegistrationCallback registration_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.set_client_registration_callback_ptr != nullptr) | |||
| return bridge.set_client_registration_callback_ptr(client, registration_callback, arg); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_set_port_registration_callback (jack_client_t* client, JackPortRegistrationCallback registration_callback, void *arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.set_port_registration_callback_ptr != nullptr) | |||
| return bridge.set_port_registration_callback_ptr(client, registration_callback, arg); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_set_port_connect_callback (jack_client_t* client, JackPortConnectCallback connect_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.set_port_connect_callback_ptr != nullptr) | |||
| return bridge.set_port_connect_callback_ptr(client, connect_callback, arg); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_set_port_rename_callback (jack_client_t* client, JackPortRenameCallback rename_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.set_port_rename_callback_ptr != nullptr) | |||
| return bridge.set_port_rename_callback_ptr(client, rename_callback, arg); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_set_latency_callback(jack_client_t* client, JackLatencyCallback latency_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.set_latency_callback_ptr != nullptr) | |||
| return bridge.set_latency_callback_ptr(client, latency_callback, arg); | |||
| #endif | |||
| return 0; | |||
| } | |||
| // ----------------------------------------------------------------------------- | |||
| jack_nframes_t jackbridge_get_sample_rate(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.get_sample_rate_ptr != nullptr) | |||
| return bridge.get_sample_rate_ptr(client); | |||
| #endif | |||
| return 0; | |||
| } | |||
| jack_nframes_t jackbridge_get_buffer_size(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.get_buffer_size_ptr != nullptr) | |||
| return bridge.get_buffer_size_ptr(client); | |||
| #endif | |||
| return 0; | |||
| } | |||
| jack_port_t* jackbridge_port_register(jack_client_t* client, const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.port_register_ptr != nullptr) | |||
| return bridge.port_register_ptr(client, port_name, port_type, flags, buffer_size); | |||
| #endif | |||
| return nullptr; | |||
| } | |||
| int jackbridge_port_unregister(jack_client_t* client, jack_port_t* port) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.port_unregister_ptr != nullptr) | |||
| return bridge.port_unregister_ptr(client, port); | |||
| #endif | |||
| return 0; | |||
| } | |||
| void* jackbridge_port_get_buffer(jack_port_t* port, jack_nframes_t nframes) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.port_get_buffer_ptr != nullptr) | |||
| return bridge.port_get_buffer_ptr(port, nframes); | |||
| #endif | |||
| return nullptr; | |||
| } | |||
| // ----------------------------------------------------------------------------- | |||
| // ----------------------------------------------------------------------------- | |||
| int jackbridge_port_name_size() | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.port_name_size_ptr != nullptr) | |||
| return bridge.port_name_size_ptr(); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_recompute_total_latencies(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.recompute_total_latencies_ptr != nullptr) | |||
| return bridge.recompute_total_latencies_ptr(client); | |||
| #endif | |||
| return 0; | |||
| } | |||
| void jackbridge_port_get_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.port_get_latency_range_ptr != nullptr) | |||
| bridge.port_get_latency_range_ptr(port, mode, range); | |||
| #endif | |||
| } | |||
| void jackbridge_port_set_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.port_set_latency_range_ptr != nullptr) | |||
| bridge.port_set_latency_range_ptr(port, mode, range); | |||
| #endif | |||
| } | |||
| // ----------------------------------------------------------------------------- | |||
| uint32_t jackbridge_midi_get_event_count(void* port_buffer) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.midi_get_event_count_ptr != nullptr) | |||
| return bridge.midi_get_event_count_ptr(port_buffer); | |||
| #endif | |||
| return 0; | |||
| } | |||
| int jackbridge_midi_event_get(jack_midi_event_t* event, void* port_buffer, uint32_t event_index) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.midi_event_get_ptr != nullptr) | |||
| return bridge.midi_event_get_ptr(event, port_buffer, event_index); | |||
| #endif | |||
| return 0; | |||
| } | |||
| void jackbridge_midi_clear_buffer(void* port_buffer) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.midi_clear_buffer_ptr != nullptr) | |||
| bridge.midi_clear_buffer_ptr(port_buffer); | |||
| #endif | |||
| } | |||
| int jackbridge_midi_event_write(void* port_buffer, jack_nframes_t time, const jack_midi_data_t* data, size_t data_size) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.midi_event_write_ptr != nullptr) | |||
| return bridge.midi_event_write_ptr(port_buffer, time, data, data_size); | |||
| #endif | |||
| return 0; | |||
| } | |||
| jack_midi_data_t* jackbridge_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.midi_event_reserve_ptr != nullptr) | |||
| return bridge.midi_event_reserve_ptr(port_buffer, time, data_size); | |||
| #endif | |||
| return nullptr; | |||
| } | |||
| // ----------------------------------------------------------------------------- | |||
| int jackbridge_transport_locate(jack_client_t* client, jack_nframes_t frame) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.transport_locate_ptr != nullptr) | |||
| return bridge.transport_locate_ptr(client, frame); | |||
| #endif | |||
| return 0; | |||
| } | |||
| void jackbridge_transport_start(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.transport_start_ptr != nullptr) | |||
| bridge.transport_start_ptr(client); | |||
| #endif | |||
| } | |||
| void jackbridge_transport_stop(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.transport_stop_ptr != nullptr) | |||
| bridge.transport_stop_ptr(client); | |||
| #endif | |||
| } | |||
| jack_transport_state_t jackbridge_transport_query(const jack_client_t* client, jack_position_t* pos) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| if (bridge.transport_query_ptr != nullptr) | |||
| return bridge.transport_query_ptr(client, pos); | |||
| #endif | |||
| return JackTransportStopped; | |||
| } | |||
| // ----------------------------------------------------------------------------- | |||
| #if 0 | |||
| void linux_clock_gettime_rt(struct timespec* ts) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| clock_gettime(CLOCK_REALTIME, ts); | |||
| #endif | |||
| } | |||
| int linux_sem_post(void* sem) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return sem_post(sem); | |||
| #else | |||
| return 1; | |||
| #endif | |||
| } | |||
| int linux_sem_timedwait(void* sem, struct timespec* ts) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return sem_timedwait(sem, ts); | |||
| #else | |||
| return 1; | |||
| #endif | |||
| } | |||
| #endif | |||
| @@ -0,0 +1,96 @@ | |||
| /* | |||
| * JackBridge | |||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Lesser General Public | |||
| * License as published by the Free Software Foundation. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * GNU Lesser General Public License for more details. | |||
| * | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __JACKBRIDGE_HPP__ | |||
| #define __JACKBRIDGE_HPP__ | |||
| #include "CarlaDefines.hpp" | |||
| #ifndef JACKBRIDGE_EXPORT | |||
| # undef CARLA_EXPORT | |||
| # define CARLA_EXPORT | |||
| #endif | |||
| #ifdef __WINE__ | |||
| # define GNU_WIN32 // fix jack threads, always use pthread | |||
| #endif | |||
| #include <cstdint> | |||
| #include <sys/time.h> | |||
| #include <jack/jack.h> | |||
| #include <jack/midiport.h> | |||
| #include <jack/transport.h> | |||
| CARLA_EXPORT const char* jackbridge_get_version_string(); | |||
| CARLA_EXPORT jack_client_t* jackbridge_client_open(const char* client_name, jack_options_t options, jack_status_t* status, ...); | |||
| CARLA_EXPORT int jackbridge_client_close(jack_client_t* client); | |||
| CARLA_EXPORT int jackbridge_client_name_size(); | |||
| CARLA_EXPORT char* jackbridge_get_client_name(jack_client_t* client); | |||
| CARLA_EXPORT int jackbridge_activate(jack_client_t* client); | |||
| CARLA_EXPORT int jackbridge_deactivate(jack_client_t* client); | |||
| CARLA_EXPORT void jackbridge_on_shutdown(jack_client_t* client, JackShutdownCallback shutdown_callback, void* arg); | |||
| CARLA_EXPORT int jackbridge_set_process_callback(jack_client_t* client, JackProcessCallback process_callback, void* arg); | |||
| CARLA_EXPORT int jackbridge_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback freewheel_callback, void* arg); | |||
| CARLA_EXPORT int jackbridge_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback bufsize_callback, void* arg); | |||
| CARLA_EXPORT int jackbridge_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback srate_callback, void* arg); | |||
| CARLA_EXPORT int jackbridge_set_client_registration_callback(jack_client_t* client, JackClientRegistrationCallback registration_callback, void* arg); | |||
| CARLA_EXPORT int jackbridge_set_port_registration_callback (jack_client_t* client, JackPortRegistrationCallback registration_callback, void *arg); | |||
| CARLA_EXPORT int jackbridge_set_port_connect_callback (jack_client_t* client, JackPortConnectCallback connect_callback, void* arg); | |||
| CARLA_EXPORT int jackbridge_set_port_rename_callback (jack_client_t* client, JackPortRenameCallback rename_callback, void* arg); | |||
| CARLA_EXPORT int jackbridge_set_latency_callback(jack_client_t* client, JackLatencyCallback latency_callback, void* arg); | |||
| CARLA_EXPORT jack_nframes_t jackbridge_get_sample_rate(jack_client_t* client); | |||
| CARLA_EXPORT jack_nframes_t jackbridge_get_buffer_size(jack_client_t* client); | |||
| CARLA_EXPORT jack_port_t* jackbridge_port_register(jack_client_t* client, const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size); | |||
| CARLA_EXPORT int jackbridge_port_unregister(jack_client_t* client, jack_port_t* port); | |||
| CARLA_EXPORT void* jackbridge_port_get_buffer(jack_port_t* port, jack_nframes_t nframes); | |||
| // port_register_ptr(nullptr), | |||
| // port_unregister_ptr(nullptr), | |||
| // port_get_buffer_ptr(nullptr), | |||
| // port_name_ptr(nullptr), | |||
| // port_short_name_ptr(nullptr), | |||
| // port_flags_ptr(nullptr), | |||
| // port_type_ptr(nullptr), | |||
| // port_set_name_ptr(nullptr), | |||
| // connect_ptr(nullptr), | |||
| // disconnect_ptr(nullptr), | |||
| CARLA_EXPORT int jackbridge_port_name_size(); | |||
| CARLA_EXPORT void jackbridge_port_get_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range); | |||
| CARLA_EXPORT void jackbridge_port_set_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range); | |||
| CARLA_EXPORT int jackbridge_recompute_total_latencies(jack_client_t* client); | |||
| CARLA_EXPORT uint32_t jackbridge_midi_get_event_count(void* port_buffer); | |||
| CARLA_EXPORT int jackbridge_midi_event_get(jack_midi_event_t* event, void* port_buffer, uint32_t event_index); | |||
| CARLA_EXPORT void jackbridge_midi_clear_buffer(void* port_buffer); | |||
| CARLA_EXPORT int jackbridge_midi_event_write(void* port_buffer, jack_nframes_t time, const jack_midi_data_t* data, size_t data_size); | |||
| CARLA_EXPORT jack_midi_data_t* jackbridge_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size); | |||
| CARLA_EXPORT int jackbridge_transport_locate(jack_client_t* client, jack_nframes_t frame); | |||
| CARLA_EXPORT void jackbridge_transport_start(jack_client_t* client); | |||
| CARLA_EXPORT void jackbridge_transport_stop(jack_client_t* client); | |||
| CARLA_EXPORT jack_transport_state_t jackbridge_transport_query(const jack_client_t* client, jack_position_t* pos); | |||
| // CARLA_EXPORT void jackbridge_clock_gettime_rt(struct timespec*); | |||
| // CARLA_EXPORT int jackbridge_sem_post(void*); | |||
| // CARLA_EXPORT int jackbridge_sem_timedwait(void*, struct timespec*); | |||
| #endif // __JACKBRIDGE_HPP__ | |||
| @@ -8,26 +8,31 @@ include ../../Makefile.mk | |||
| # -------------------------------------------------------------- | |||
| WINECC ?= winegcc | |||
| WINECXX ?= wineg++ | |||
| BUILD_C_FLAGS += -DJACKBRIDGE_EXPORT -I. | |||
| LINK_FLAGS += -shared | |||
| BUILD_CXX_FLAGS += -I. -I../../includes -I../../utils | |||
| WIN_BUILD_FLAGS = $(BUILD_C_FLAGS) -DJACKBRIDGE_DUMMY -w | |||
| ifeq ($(MACOS),true) | |||
| LINK_FLAGS += -dynamiclib | |||
| else | |||
| LINK_FLAGS += -shared | |||
| endif | |||
| WIN_BUILD_FLAGS = $(BUILD_CXX_FLAGS) -DJACKBRIDGE_DUMMY -w | |||
| WIN_32BIT_FLAGS = $(32BIT_FLAGS) | |||
| WIN_64BIT_FLAGS = $(64BIT_FLAGS) | |||
| WIN_LINK_FLAGS = $(LINK_FLAGS) | |||
| WINE_BUILD_FLAGS = $(BUILD_C_FLAGS) -fPIC | |||
| WINE_BUILD_FLAGS = $(BUILD_CXX_FLAGS) -fPIC | |||
| WINE_32BIT_FLAGS = $(32BIT_FLAGS) -L/usr/lib32/wine -L/usr/lib/i386-linux-gnu/wine | |||
| WINE_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64/wine -L/usr/lib/x86_64-linux-gnu/wine | |||
| WINE_LINK_FLAGS = $(LINK_FLAGS) $(shell pkg-config --libs jack) -lrt -lpthread | |||
| WINE_LINK_FLAGS = $(LINK_FLAGS) -ldl -lrt -lpthread | |||
| OBJS = jackbridge.c | |||
| OBJS = JackBridge.cpp | |||
| # -------------------------------------------------------------- | |||
| all: | |||
| all: test | |||
| win32: ../jackbridge-win32.dll | |||
| win64: ../jackbridge-win64.dll | |||
| @@ -36,16 +41,19 @@ wine64: ../jackbridge-win64.dll.so | |||
| # -------------------------------------------------------------- | |||
| test: $(OBJS) | |||
| $(CXX) $^ $(WINE_BUILD_FLAGS) $(WINE_LINK_FLAGS) -o $@ | |||
| ../jackbridge-win32.dll: $(OBJS) | |||
| $(CC) $^ $(WIN_BUILD_FLAGS) $(WIN_32BIT_FLAGS) $(WIN_LINK_FLAGS) -Wl,--output-def,$@.def,--out-implib,$@.a -o $@ && $(STRIP) $@ | |||
| $(CXX) $^ $(WIN_BUILD_FLAGS) $(WIN_32BIT_FLAGS) $(WIN_LINK_FLAGS) -Wl,--output-def,$@.def,--out-implib,$@.a -o $@ && $(STRIP) $@ | |||
| ../jackbridge-win64.dll: $(OBJS) | |||
| $(CC) $^ $(WIN_BUILD_FLAGS) $(WIN_64BIT_FLAGS) $(WIN_LINK_FLAGS) -Wl,--output-def,$@.def,--out-implib,$@.a -o $@ && $(STRIP) $@ | |||
| $(CXX) $^ $(WIN_BUILD_FLAGS) $(WIN_64BIT_FLAGS) $(WIN_LINK_FLAGS) -Wl,--output-def,$@.def,--out-implib,$@.a -o $@ && $(STRIP) $@ | |||
| ../jackbridge-win32.dll.so: $(OBJS) ../jackbridge-win32.dll.def | |||
| $(WINECC) $^ $(WINE_BUILD_FLAGS) $(WINE_32BIT_FLAGS) $(WINE_LINK_FLAGS) -mno-cygwin -o $@ && $(STRIP) $@ | |||
| $(WINECXX) $^ $(WINE_BUILD_FLAGS) $(WINE_32BIT_FLAGS) $(WINE_LINK_FLAGS) -mno-cygwin -o $@ && $(STRIP) $@ | |||
| ../jackbridge-win64.dll.so: $(OBJS) ../jackbridge-win64.dll.def | |||
| $(WINECC) $^ $(WINE_BUILD_FLAGS) $(WINE_64BIT_FLAGS) $(WINE_LINK_FLAGS) -mno-cygwin -o $@ && $(STRIP) $@ | |||
| $(WINECXX) $^ $(WINE_BUILD_FLAGS) $(WINE_64BIT_FLAGS) $(WINE_LINK_FLAGS) -mno-cygwin -o $@ && $(STRIP) $@ | |||
| # -------------------------------------------------------------- | |||
| @@ -1,313 +0,0 @@ | |||
| /* | |||
| * JackBridge | |||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Lesser General Public | |||
| * License as published by the Free Software Foundation. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * GNU Lesser General Public License for more details. | |||
| * | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #include "jackbridge.h" | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| # include <time.h> | |||
| # include <semaphore.h> | |||
| #endif | |||
| // ----------------------------------------------------------------------------- | |||
| jack_client_t* jackbridge_client_open(const char* client_name, jack_options_t options, jack_status_t* status, ...) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_client_open(client_name, options, status); | |||
| #else | |||
| return NULL; | |||
| #endif | |||
| } | |||
| int jackbridge_client_close(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_client_close(client); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| int jackbridge_client_name_size() | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_client_name_size(); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| char* jackbridge_get_client_name(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_get_client_name(client); | |||
| #else | |||
| return NULL; | |||
| #endif | |||
| } | |||
| int jackbridge_port_name_size() | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_port_name_size(); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| int jackbridge_recompute_total_latencies(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_recompute_total_latencies(client); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| void jackbridge_port_get_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| jack_port_get_latency_range(port, mode, range); | |||
| #endif | |||
| } | |||
| void jackbridge_port_set_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| jack_port_set_latency_range(port, mode, range); | |||
| #endif | |||
| } | |||
| int jackbridge_activate(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_activate(client); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| int jackbridge_deactivate(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_deactivate(client); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| void jackbridge_on_shutdown(jack_client_t* client, JackShutdownCallback shutdown_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| jack_on_shutdown(client, shutdown_callback, arg); | |||
| #endif | |||
| } | |||
| int jackbridge_set_latency_callback(jack_client_t* client, JackLatencyCallback latency_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_set_latency_callback(client, latency_callback, arg); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| int jackbridge_set_process_callback(jack_client_t* client, JackProcessCallback process_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_set_process_callback(client, process_callback, arg); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| int jackbridge_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback freewheel_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_set_freewheel_callback(client, freewheel_callback, arg); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| int jackbridge_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback bufsize_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_set_buffer_size_callback(client, bufsize_callback, arg); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| int jackbridge_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback srate_callback, void* arg) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_set_sample_rate_callback(client, srate_callback, arg); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| jack_nframes_t jackbridge_get_sample_rate(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_get_sample_rate(client); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| jack_nframes_t jackbridge_get_buffer_size(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_get_buffer_size(client); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| jack_port_t* jackbridge_port_register(jack_client_t* client, const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_port_register(client, port_name, port_type, flags, buffer_size); | |||
| #else | |||
| return NULL; | |||
| #endif | |||
| } | |||
| int jackbridge_port_unregister(jack_client_t* client, jack_port_t* port) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_port_unregister(client, port); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| void* jackbridge_port_get_buffer(jack_port_t* port, jack_nframes_t nframes) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_port_get_buffer(port, nframes); | |||
| #else | |||
| return NULL; | |||
| #endif | |||
| } | |||
| // ----------------------------------------------------------------------------- | |||
| uint32_t jackbridge_midi_get_event_count(void* port_buffer) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_midi_get_event_count(port_buffer); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| int jackbridge_midi_event_get(jack_midi_event_t* event, void* port_buffer, uint32_t event_index) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_midi_event_get(event, port_buffer, event_index); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| void jackbridge_midi_clear_buffer(void* port_buffer) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| jack_midi_clear_buffer(port_buffer); | |||
| #endif | |||
| } | |||
| jack_midi_data_t* jackbridge_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_midi_event_reserve(port_buffer, time, data_size); | |||
| #else | |||
| return NULL; | |||
| #endif | |||
| } | |||
| int jackbridge_midi_event_write(void* port_buffer, jack_nframes_t time, const jack_midi_data_t* data, size_t data_size) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_midi_event_write(port_buffer, time, data, data_size); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| // ----------------------------------------------------------------------------- | |||
| int jackbridge_transport_locate(jack_client_t* client, jack_nframes_t frame) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_transport_locate(client, frame); | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| jack_transport_state_t jackbridge_transport_query(const jack_client_t* client, jack_position_t* pos) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return jack_transport_query(client, pos); | |||
| #else | |||
| return JackTransportStopped; | |||
| #endif | |||
| } | |||
| void jackbridge_transport_start(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| jack_transport_start(client); | |||
| #endif | |||
| } | |||
| void jackbridge_transport_stop(jack_client_t* client) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| jack_transport_stop(client); | |||
| #endif | |||
| } | |||
| // ----------------------------------------------------------------------------- | |||
| void linux_clock_gettime_rt(struct timespec* ts) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| clock_gettime(CLOCK_REALTIME, ts); | |||
| #endif | |||
| } | |||
| int linux_sem_post(void* sem) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return sem_post(sem); | |||
| #else | |||
| return 1; | |||
| #endif | |||
| } | |||
| int linux_sem_timedwait(void* sem, struct timespec* ts) | |||
| { | |||
| #ifndef JACKBRIDGE_DUMMY | |||
| return sem_timedwait(sem, ts); | |||
| #else | |||
| return 1; | |||
| #endif | |||
| } | |||
| @@ -1,125 +0,0 @@ | |||
| /* | |||
| * JackBridge | |||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Lesser General Public | |||
| * License as published by the Free Software Foundation. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * GNU Lesser General Public License for more details. | |||
| * | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __JACKBRIDGE_H__ | |||
| #define __JACKBRIDGE_H__ | |||
| #if defined(_WIN32) && ! defined(__WINE__) | |||
| # include <stdint.h> | |||
| # include <windows.h> | |||
| # define BRIDGE_EXPORT __declspec (dllexport) | |||
| #else | |||
| # define BRIDGE_EXPORT __attribute__ ((visibility("default"))) | |||
| #endif | |||
| #ifdef JACKBRIDGE_EXPORT | |||
| # define GNU_WIN32 // fix jack threads, always use pthread | |||
| # include <sys/time.h> | |||
| #endif | |||
| #include <jack/jack.h> | |||
| #include <jack/midiport.h> | |||
| #include <jack/transport.h> | |||
| #ifdef JACKBRIDGE_EXPORT | |||
| #ifdef __cplusplus | |||
| extern "C" { | |||
| #endif | |||
| BRIDGE_EXPORT jack_client_t* jackbridge_client_open(const char* client_name, jack_options_t options, jack_status_t* status, ...); | |||
| BRIDGE_EXPORT int jackbridge_client_close(jack_client_t* client); | |||
| BRIDGE_EXPORT int jackbridge_client_name_size(); | |||
| BRIDGE_EXPORT char* jackbridge_get_client_name(jack_client_t* client); | |||
| BRIDGE_EXPORT int jackbridge_port_name_size(); | |||
| BRIDGE_EXPORT int jackbridge_recompute_total_latencies(jack_client_t* client); | |||
| BRIDGE_EXPORT void jackbridge_port_get_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range); | |||
| BRIDGE_EXPORT void jackbridge_port_set_latency_range(jack_port_t* port, jack_latency_callback_mode_t mode, jack_latency_range_t* range); | |||
| BRIDGE_EXPORT int jackbridge_activate(jack_client_t* client); | |||
| BRIDGE_EXPORT int jackbridge_deactivate(jack_client_t* client); | |||
| BRIDGE_EXPORT void jackbridge_on_shutdown(jack_client_t* client, JackShutdownCallback shutdown_callback, void* arg); | |||
| BRIDGE_EXPORT int jackbridge_set_latency_callback(jack_client_t* client, JackLatencyCallback latency_callback, void* arg); | |||
| BRIDGE_EXPORT int jackbridge_set_process_callback(jack_client_t* client, JackProcessCallback process_callback, void* arg); | |||
| BRIDGE_EXPORT int jackbridge_set_freewheel_callback(jack_client_t* client, JackFreewheelCallback freewheel_callback, void* arg); | |||
| BRIDGE_EXPORT int jackbridge_set_buffer_size_callback(jack_client_t* client, JackBufferSizeCallback bufsize_callback, void* arg); | |||
| BRIDGE_EXPORT int jackbridge_set_sample_rate_callback(jack_client_t* client, JackSampleRateCallback srate_callback, void* arg); | |||
| BRIDGE_EXPORT jack_nframes_t jackbridge_get_sample_rate(jack_client_t* client); | |||
| BRIDGE_EXPORT jack_nframes_t jackbridge_get_buffer_size(jack_client_t* client); | |||
| BRIDGE_EXPORT jack_port_t* jackbridge_port_register(jack_client_t* client, const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size); | |||
| BRIDGE_EXPORT int jackbridge_port_unregister(jack_client_t* client, jack_port_t* port); | |||
| BRIDGE_EXPORT void* jackbridge_port_get_buffer(jack_port_t* port, jack_nframes_t nframes); | |||
| BRIDGE_EXPORT uint32_t jackbridge_midi_get_event_count(void* port_buffer); | |||
| BRIDGE_EXPORT int jackbridge_midi_event_get(jack_midi_event_t* event, void* port_buffer, uint32_t event_index); | |||
| BRIDGE_EXPORT void jackbridge_midi_clear_buffer(void* port_buffer); | |||
| BRIDGE_EXPORT jack_midi_data_t* jackbridge_midi_event_reserve(void* port_buffer, jack_nframes_t time, size_t data_size); | |||
| BRIDGE_EXPORT int jackbridge_midi_event_write(void* port_buffer, jack_nframes_t time, const jack_midi_data_t* data, size_t data_size); | |||
| BRIDGE_EXPORT int jackbridge_transport_locate(jack_client_t* client, jack_nframes_t frame); | |||
| BRIDGE_EXPORT jack_transport_state_t jackbridge_transport_query(const jack_client_t* client, jack_position_t* pos); | |||
| BRIDGE_EXPORT void jackbridge_transport_start(jack_client_t* client); | |||
| BRIDGE_EXPORT void jackbridge_transport_stop(jack_client_t* client); | |||
| BRIDGE_EXPORT void linux_clock_gettime_rt(struct timespec*); | |||
| BRIDGE_EXPORT int linux_sem_post(void*); | |||
| BRIDGE_EXPORT int linux_sem_timedwait(void*, struct timespec*); | |||
| #ifdef __cplusplus | |||
| } | |||
| #endif | |||
| #else // JACKBRIDGE_EXPORT | |||
| #define jackbridge_client_open jack_client_open | |||
| #define jackbridge_client_close jack_client_close | |||
| #define jackbridge_client_name_size jack_client_name_size | |||
| #define jackbridge_get_client_name jack_get_client_name | |||
| #define jackbridge_port_name_size jack_port_name_size | |||
| #define jackbridge_recompute_total_latencies jack_recompute_total_latencies | |||
| #define jackbridge_port_get_latency_range jack_port_get_latency_range | |||
| #define jackbridge_port_set_latency_range jack_port_set_latency_range | |||
| #define jackbridge_activate jack_activate | |||
| #define jackbridge_deactivate jack_deactivate | |||
| #define jackbridge_on_shutdown jack_on_shutdown | |||
| #define jackbridge_set_latency_callback jack_set_latency_callback | |||
| #define jackbridge_set_process_callback jack_set_process_callback | |||
| #define jackbridge_set_freewheel_callback jack_set_freewheel_callback | |||
| #define jackbridge_set_buffer_size_callback jack_set_buffer_size_callback | |||
| #define jackbridge_set_sample_rate_callback jack_set_sample_rate_callback | |||
| #define jackbridge_get_sample_rate jack_get_sample_rate | |||
| #define jackbridge_get_buffer_size jack_get_buffer_size | |||
| #define jackbridge_port_register jack_port_register | |||
| #define jackbridge_port_unregister jack_port_unregister | |||
| #define jackbridge_port_get_buffer jack_port_get_buffer | |||
| #define jackbridge_midi_get_event_count jack_midi_get_event_count | |||
| #define jackbridge_midi_event_get jack_midi_event_get | |||
| #define jackbridge_midi_clear_buffer jack_midi_clear_buffer | |||
| #define jackbridge_midi_event_reserve jack_midi_event_reserve | |||
| #define jackbridge_midi_event_write jack_midi_event_write | |||
| #define jackbridge_transport_locate jack_transport_locate | |||
| #define jackbridge_transport_query jack_transport_query | |||
| #define jackbridge_transport_start jack_transport_start | |||
| #define jackbridge_transport_stop jack_transport_stop | |||
| #define linux_clock_gettime_rt(ts) clock_gettime(CLOCK_REALTIME, ts) | |||
| #define linux_sem_post sem_post | |||
| #define linux_sem_timedwait sem_timedwait | |||
| #endif // JACKBRIDGE_EXPORT | |||
| #endif // __JACKBRIDGE_H__ | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Carla Qt4 Style, based on Qt5 fusion style | |||
| * Carla Style, based on Qt5 fusion style | |||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies) | |||
| * | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Carla Qt4 Style, based on Qt5 fusion style | |||
| * Carla Style, based on Qt5 fusion style | |||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies) | |||
| * | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Carla Qt4 Style, based on Qt5 fusion style | |||
| * Carla Style, based on Qt5 fusion style | |||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies) | |||
| * | |||
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Carla Qt4 Style, based on Qt5 fusion style | |||
| * Carla Style, based on Qt5 fusion style | |||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
| * Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies) | |||
| * | |||