Browse Source

Tweaks for getting some stuff working under Haiku

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 6 years ago
parent
commit
41f81a8af2
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
8 changed files with 103 additions and 25 deletions
  1. +1
    -1
      source/backend/CarlaUtils.h
  2. +53
    -4
      source/backend/utils/PipeClient.cpp
  3. +8
    -6
      source/frontend/carla_database.py
  4. +7
    -5
      source/frontend/carla_shared.py
  5. +13
    -5
      source/frontend/carla_utils.py
  6. +1
    -1
      source/modules/lilv/config/lilv_config.h
  7. +2
    -2
      source/utils/CarlaOscUtils.hpp
  8. +18
    -1
      source/utils/CarlaStringList.hpp

+ 1
- 1
source/backend/CarlaUtils.h View File

@@ -193,7 +193,7 @@ CARLA_EXPORT CarlaPipeClientHandle carla_pipe_client_new(const char* argv[], Car
/*!
* TODO.
*/
CARLA_EXPORT void carla_pipe_client_idle(CarlaPipeClientHandle handle);
CARLA_EXPORT const char* carla_pipe_client_idle(CarlaPipeClientHandle handle);

/*!
* TODO.


+ 53
- 4
source/backend/utils/PipeClient.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2019 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
@@ -19,6 +19,11 @@

#include "CarlaPipeUtils.hpp"

#ifdef CARLA_OS_HAIKU
# include "CarlaStringList.hpp"
# define CARLA_PIPE_WITHOUT_CALLBACK
#endif

namespace CB = CarlaBackend;

// -------------------------------------------------------------------------------------------------------------------
@@ -30,6 +35,10 @@ public:
: CarlaPipeClient(),
fCallbackFunc(callbackFunc),
fCallbackPtr(callbackPtr),
#ifdef CARLA_PIPE_WITHOUT_CALLBACK
fMsgsReceived(),
fLastMsgReceived(nullptr),
#endif
fLastReadLine(nullptr)
{
CARLA_SAFE_ASSERT(fCallbackFunc != nullptr);
@@ -42,10 +51,42 @@ public:
delete[] fLastReadLine;
fLastReadLine = nullptr;
}
#ifdef CARLA_PIPE_WITHOUT_CALLBACK
if (fLastMsgReceived != nullptr)
{
delete[] fLastMsgReceived;
fLastMsgReceived = nullptr;
}
#endif
}

const char* idlePipeAndReturnMessage()
{
CarlaPipeClient::idlePipe();

#ifdef CARLA_PIPE_WITHOUT_CALLBACK
if (fMsgsReceived.count() == 0)
return nullptr;

delete[] fLastMsgReceived;
fLastMsgReceived = fMsgsReceived.getAndRemoveFirst();
return fLastMsgReceived;
#else
return nullptr;
#endif
}

const char* readlineblock(const uint timeout) noexcept
{
#ifdef CARLA_PIPE_WITHOUT_CALLBACK
if (fMsgsReceived.count() != 0)
{
delete[] fLastMsgReceived;
fLastMsgReceived = fMsgsReceived.getAndRemoveFirst();
return fLastMsgReceived;
}
#endif

delete[] fLastReadLine;
fLastReadLine = CarlaPipeClient::_readlineblock(timeout);
return fLastReadLine;
@@ -53,12 +94,16 @@ public:

bool msgReceived(const char* const msg) noexcept override
{
#ifdef CARLA_PIPE_WITHOUT_CALLBACK
fMsgsReceived.append(msg);
#else
if (fCallbackFunc != nullptr)
{
try {
fCallbackFunc(fCallbackPtr, msg);
} CARLA_SAFE_EXCEPTION("msgReceived");
}
#endif

return true;
}
@@ -66,6 +111,10 @@ public:
private:
const CarlaPipeCallbackFunc fCallbackFunc;
void* const fCallbackPtr;
#ifdef CARLA_PIPE_WITHOUT_CALLBACK
CarlaStringList fMsgsReceived;
const char* fLastMsgReceived;
#endif
const char* fLastReadLine;

CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ExposedCarlaPipeClient)
@@ -86,11 +135,11 @@ CarlaPipeClientHandle carla_pipe_client_new(const char* argv[], CarlaPipeCallbac
return pipe;
}

void carla_pipe_client_idle(CarlaPipeClientHandle handle)
const char* carla_pipe_client_idle(CarlaPipeClientHandle handle)
{
CARLA_SAFE_ASSERT_RETURN(handle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(handle != nullptr, nullptr);

((ExposedCarlaPipeClient*)handle)->idlePipe();
return ((ExposedCarlaPipeClient*)handle)->idlePipeAndReturnMessage();
}

bool carla_pipe_client_is_running(CarlaPipeClientHandle handle)


+ 8
- 6
source/frontend/carla_database.py View File

@@ -68,13 +68,15 @@ if haveLRDF and readEnvVars:
# ---------------------------------------------------------------------------------------------------------------------
# Plugin Query (helper functions)

def findBinaries(binPath, OS):
def findBinaries(binPath, pluginType, OS):
binaries = []

if OS == "WINDOWS":
extensions = (".dll",)
if OS == "HAIKU":
extensions = ("") if pluginType == PLUGIN_VST2 else (".so",)
elif OS == "MACOS":
extensions = (".dylib", ".so")
elif OS == "WINDOWS":
extensions = (".dll",)
else:
extensions = (".so",)

@@ -715,7 +717,7 @@ class SearchPluginsThread(QThread):
del settings

for iPATH in LADSPA_PATH:
binaries = findBinaries(iPATH, OS)
binaries = findBinaries(iPATH, PLUGIN_LADSPA, OS)
for binary in binaries:
if binary not in ladspaBinaries:
ladspaBinaries.append(binary)
@@ -751,7 +753,7 @@ class SearchPluginsThread(QThread):
del settings

for iPATH in DSSI_PATH:
binaries = findBinaries(iPATH, OS)
binaries = findBinaries(iPATH, PLUGIN_DSSI, OS)
for binary in binaries:
if binary not in dssiBinaries:
dssiBinaries.append(binary)
@@ -793,7 +795,7 @@ class SearchPluginsThread(QThread):
if MACOS and not isWine:
binaries = findMacVSTBundles(iPATH, False)
else:
binaries = findBinaries(iPATH, OS)
binaries = findBinaries(iPATH, PLUGIN_VST2, OS)
for binary in binaries:
if binary not in vst2Binaries:
vst2Binaries.append(binary)


+ 7
- 5
source/frontend/carla_shared.py View File

@@ -393,19 +393,21 @@ elif HAIKU:
splitter = ":"

DEFAULT_LADSPA_PATH = HOME + "/.ladspa"
DEFAULT_LADSPA_PATH += ":/boot/common/add-ons/ladspa"
DEFAULT_LADSPA_PATH += ":/system/add-ons/media/ladspaplugins"
DEFAULT_LADSPA_PATH += ":/system/lib/ladspa"

DEFAULT_DSSI_PATH = HOME + "/.dssi"
DEFAULT_DSSI_PATH += ":/boot/common/add-ons/dssi"
DEFAULT_DSSI_PATH += ":/system/add-ons/media/dssiplugins"
DEFAULT_DSSI_PATH += ":/system/lib/dssi"

DEFAULT_LV2_PATH = HOME + "/.lv2"
DEFAULT_LV2_PATH += ":/boot/common/add-ons/lv2"
DEFAULT_LV2_PATH += ":/system/add-ons/media/lv2plugins"

DEFAULT_VST2_PATH = HOME + "/.vst"
DEFAULT_VST2_PATH += ":/boot/common/add-ons/vst"
DEFAULT_VST2_PATH += ":/system/add-ons/media/vstplugins"

DEFAULT_VST3_PATH = HOME + "/.vst3"
DEFAULT_VST3_PATH += ":/boot/common/add-ons/vst3"
DEFAULT_VST3_PATH += ":/system/add-ons/media/vst3plugins"

elif MACOS:
splitter = ":"


+ 13
- 5
source/frontend/carla_utils.py View File

@@ -203,7 +203,7 @@ class CarlaUtils(object):
self.lib.carla_pipe_client_new.restype = CarlaPipeClientHandle

self.lib.carla_pipe_client_idle.argtypes = [CarlaPipeClientHandle]
self.lib.carla_pipe_client_idle.restype = None
self.lib.carla_pipe_client_idle.restype = c_char_p

self.lib.carla_pipe_client_is_running.argtypes = [CarlaPipeClientHandle]
self.lib.carla_pipe_client_is_running.restype = c_bool
@@ -318,14 +318,22 @@ class CarlaUtils(object):
for i in range(argc):
cargv[i] = c_char_p(argv[i].encode("utf-8"))

self._pipeClientFunc = func
self._pipeClientCallback = CarlaPipeCallbackFunc(func)
return self.lib.carla_pipe_client_new(cargv, self._pipeClientCallback, None)

def pipe_client_idle(self, handle):
try:
self.lib.carla_pipe_client_idle(handle)
except OSError as e:
print("pipe_client_idle", e)
while True:
try:
msg = self.lib.carla_pipe_client_idle(handle)
except OSError as e:
print("pipe_client_idle", e)
return

if not msg:
break

self._pipeClientFunc(None, msg.decode("utf-8", errors="ignore"))

def pipe_client_is_running(self, handle):
return bool(self.lib.carla_pipe_client_is_running(handle))


+ 1
- 1
source/modules/lilv/config/lilv_config.h View File

@@ -25,7 +25,7 @@
#if defined(__APPLE__)
#define LILV_DEFAULT_LV2_PATH "~/Library/Audio/Plug-Ins/LV2:/Library/Audio/Plug-Ins/LV2"
#elif defined(__HAIKU__)
#define LILV_DEFAULT_LV2_PATH "~/.lv2:/boot/common/add-ons/lv2"
#define LILV_DEFAULT_LV2_PATH "~/.lv2:/system/add-ons/media/lv2plugins"
#elif defined(__WIN32__)
#define LILV_DEFAULT_LV2_PATH "%APPDATA%\\LV2;%COMMONPROGRAMFILES%\\LV2"
#else


+ 2
- 2
source/utils/CarlaOscUtils.hpp View File

@@ -131,7 +131,7 @@ void osc_send_control(const CarlaOscData& oscData, const int32_t index, const fl
CARLA_SAFE_ASSERT_RETURN(oscData.path != nullptr && oscData.path[0] != '\0',);
CARLA_SAFE_ASSERT_RETURN(oscData.target != nullptr,);
CARLA_SAFE_ASSERT_RETURN(index != -1,); // -1 == PARAMETER_NULL
carla_debug("osc_send_control(path:\"%s\", %i, %f)", oscData.path, index, value);
carla_debug("osc_send_control(path:\"%s\", %i, %f)", oscData.path, index, static_cast<double>(value));

char targetPath[std::strlen(oscData.path)+9];
std::strcpy(targetPath, oscData.path);
@@ -212,7 +212,7 @@ void osc_send_sample_rate(const CarlaOscData& oscData, const float sampleRate) n
CARLA_SAFE_ASSERT_RETURN(oscData.path != nullptr && oscData.path[0] != '\0',);
CARLA_SAFE_ASSERT_RETURN(oscData.target != nullptr,);
CARLA_SAFE_ASSERT_RETURN(sampleRate > 0.0f,);
carla_debug("osc_send_sample_rate(path:\"%s\", %f)", oscData.path, sampleRate);
carla_debug("osc_send_sample_rate(path:\"%s\", %f)", oscData.path, static_cast<double>(sampleRate));

char targetPath[std::strlen(oscData.path)+13];
std::strcpy(targetPath, oscData.path);


+ 18
- 1
source/utils/CarlaStringList.hpp View File

@@ -1,6 +1,6 @@
/*
* Carla String List
* Copyright (C) 2014-2017 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2014-2019 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
@@ -281,6 +281,23 @@ public:

// -------------------------------------------------------------------

const char* getAndRemoveFirst() noexcept
{
CARLA_SAFE_ASSERT_RETURN(fCount > 0, nullptr);

const Data* const data = list_entry_const(fQueue.next, Data, siblings);
CARLA_SAFE_ASSERT_RETURN(data != nullptr, nullptr);

const char* const ret = data->value;

Itenerator it = begin2();
LinkedList<const char*>::remove(it);

return ret;
}

// -------------------------------------------------------------------

bool contains(const char* const string) noexcept
{
CARLA_SAFE_ASSERT_RETURN(string != nullptr, false);


Loading…
Cancel
Save