Browse Source

Misc stuff

tags/1.9.4
falkTX 13 years ago
parent
commit
13b915b1b1
7 changed files with 68 additions and 36 deletions
  1. +3
    -1
      source/utils/carla_backend_utils.hpp
  2. +19
    -17
      source/utils/carla_ladspa_utils.hpp
  3. +2
    -2
      source/utils/carla_lib_utils.hpp
  4. +1
    -1
      source/utils/carla_lv2_utils.hpp
  5. +9
    -9
      source/utils/carla_osc_utils.hpp
  6. +30
    -2
      source/utils/carla_utils.hpp
  7. +4
    -4
      source/utils/carla_vst_utils.hpp

+ 3
- 1
source/utils/carla_backend_utils.hpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla Backend utils * Carla Backend utils
* Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -121,10 +121,12 @@ const char* ParameterType2Str(const ParameterType& type)
return "PARAMETER_LATENCY"; return "PARAMETER_LATENCY";
case PARAMETER_SAMPLE_RATE: case PARAMETER_SAMPLE_RATE:
return "PARAMETER_SAMPLE_RATE"; return "PARAMETER_SAMPLE_RATE";
#ifdef WANT_LV2
case PARAMETER_LV2_FREEWHEEL: case PARAMETER_LV2_FREEWHEEL:
return "PARAMETER_LV2_FREEWHEEL"; return "PARAMETER_LV2_FREEWHEEL";
case PARAMETER_LV2_TIME: case PARAMETER_LV2_TIME:
return "PARAMETER_LV2_TIME"; return "PARAMETER_LV2_TIME";
#endif
} }


qWarning("CarlaBackend::ParameterType2Str(%i) - invalid type", type); qWarning("CarlaBackend::ParameterType2Str(%i) - invalid type", type);


+ 19
- 17
source/utils/carla_ladspa_utils.hpp View File

@@ -9,7 +9,7 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* For a full copy of the GNU General Public License see the COPYING file * For a full copy of the GNU General Public License see the COPYING file
@@ -55,27 +55,31 @@ const LADSPA_RDF_Descriptor* ladspa_rdf_dup(const LADSPA_RDF_Descriptor* const o


for (unsigned long i=0; i < newDescriptor->PortCount; i++) for (unsigned long i=0; i < newDescriptor->PortCount; i++)
{ {
LADSPA_RDF_Port* const oldPort = &oldDescriptor->Ports[i];
LADSPA_RDF_Port* const newPort = &newDescriptor->Ports[i]; LADSPA_RDF_Port* const newPort = &newDescriptor->Ports[i];
newPort->Type = oldDescriptor->Ports[i].Type;
newPort->Hints = oldDescriptor->Ports[i].Hints;
newPort->Default = oldDescriptor->Ports[i].Default;
newPort->Unit = oldDescriptor->Ports[i].Unit;
newPort->ScalePointCount = oldDescriptor->Ports[i].ScalePointCount;


if (oldDescriptor->Ports[i].Label)
newPort->Label = strdup(oldDescriptor->Ports[i].Label);
newPort->Type = oldPort->Type;
newPort->Hints = oldPort->Hints;
newPort->Default = oldPort->Default;
newPort->Unit = oldPort->Unit;
newPort->ScalePointCount = oldPort->ScalePointCount;


if (newPort->ScalePointCount > 0)
if (oldPort->Label)
newPort->Label = strdup(oldPort->Label);

if (oldPort->ScalePointCount > 0)
{ {
newPort->ScalePoints = new LADSPA_RDF_ScalePoint[newPort->ScalePointCount];
newPort->ScalePoints = new LADSPA_RDF_ScalePoint[oldPort->ScalePointCount];


for (unsigned long j=0; j < newPort->ScalePointCount; j++)
for (unsigned long j=0; j < oldPort->ScalePointCount; j++)
{ {
LADSPA_RDF_ScalePoint* const oldScalePoint = &oldPort->ScalePoints[j];
LADSPA_RDF_ScalePoint* const newScalePoint = &newPort->ScalePoints[j]; LADSPA_RDF_ScalePoint* const newScalePoint = &newPort->ScalePoints[j];
newScalePoint->Value = oldDescriptor->Ports[i].ScalePoints[j].Value;


if (oldDescriptor->Ports[i].ScalePoints[j].Label)
newScalePoint->Label = strdup(oldDescriptor->Ports[i].ScalePoints[j].Label);
newScalePoint->Value = oldScalePoint->Value;

if (oldScalePoint->Label)
newScalePoint->Label = strdup(oldScalePoint->Label);
} }
} }
} }
@@ -110,9 +114,7 @@ bool is_ladspa_rdf_descriptor_valid(const LADSPA_RDF_Descriptor* const rdfDescri
CARLA_ASSERT(rdfDescriptor); CARLA_ASSERT(rdfDescriptor);
CARLA_ASSERT(descriptor); CARLA_ASSERT(descriptor);


if (! rdfDescriptor)
return false;
if (! descriptor)
if (! (rdfDescriptor && descriptor))
return false; return false;


if (rdfDescriptor->UniqueID != descriptor->UniqueID) if (rdfDescriptor->UniqueID != descriptor->UniqueID)


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

@@ -9,7 +9,7 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* For a full copy of the GNU General Public License see the COPYING file * For a full copy of the GNU General Public License see the COPYING file
@@ -33,7 +33,7 @@ void* lib_open(const char* const filename)
CARLA_ASSERT(filename); CARLA_ASSERT(filename);


#ifdef Q_OS_WIN #ifdef Q_OS_WIN
return LoadLibraryA(filename);
return (void*)LoadLibraryA(filename);
#else #else
return dlopen(filename, RTLD_NOW|RTLD_LOCAL); return dlopen(filename, RTLD_NOW|RTLD_LOCAL);
#endif #endif


+ 1
- 1
source/utils/carla_lv2_utils.hpp View File

@@ -9,7 +9,7 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* For a full copy of the GNU General Public License see the COPYING file * For a full copy of the GNU General Public License see the COPYING file


+ 9
- 9
source/utils/carla_osc_utils.hpp View File

@@ -1,6 +1,6 @@
/* /*
* Carla OSC utils * Carla OSC utils
* Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -9,21 +9,21 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* For a full copy of the GNU General Public License see the COPYING file * For a full copy of the GNU General Public License see the COPYING file
*/ */


#ifndef CARLA_OSC_UTILS_HPP
#define CARLA_OSC_UTILS_HPP
#ifndef __CARLA_OSC_UTILS_HPP__
#define __CARLA_OSC_UTILS_HPP__


#include "carla_utils.hpp" #include "carla_utils.hpp"


#include <cstdint> #include <cstdint>
#include <lo/lo.h> #include <lo/lo.h>


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


struct CarlaOscData { struct CarlaOscData {
const char* path; const char* path;
@@ -57,7 +57,7 @@ struct CarlaOscData {
} }
}; };


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


static inline static inline
void osc_send_configure(const CarlaOscData* const oscData, const char* const key, const char* const value) void osc_send_configure(const CarlaOscData* const oscData, const char* const key, const char* const value)
@@ -269,7 +269,7 @@ void osc_send_quit(const CarlaOscData* const oscData)
} }
} }


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


#ifdef BUILD_BRIDGE_PLUGIN #ifdef BUILD_BRIDGE_PLUGIN
static inline static inline
@@ -343,6 +343,6 @@ void osc_send_lv2_transfer_event(const CarlaOscData* const oscData, const int32_
} }
#endif #endif


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


#endif // CARLA_OSC_UTILS_HPP
#endif // __CARLA_OSC_UTILS_HPP__

+ 30
- 2
source/utils/carla_utils.hpp View File

@@ -23,7 +23,12 @@
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <pthread.h>

#ifdef DONT_USE_PTHREAD
# include <mutex>
#else
# include <pthread.h>
#endif


#if defined(Q_OS_HAIKU) #if defined(Q_OS_HAIKU)
# include <kernel/OS.h> # include <kernel/OS.h>
@@ -178,29 +183,46 @@ class CarlaMutex
{ {
public: public:
CarlaMutex() CarlaMutex()
//: pmutex PTHREAD_MUTEX_INITIALIZER
{ {
#ifndef DONT_USE_PTHREAD
pthread_mutex_init(&pmutex, nullptr); pthread_mutex_init(&pmutex, nullptr);
#endif
} }


~CarlaMutex() ~CarlaMutex()
{ {
#ifndef DONT_USE_PTHREAD
pthread_mutex_destroy(&pmutex); pthread_mutex_destroy(&pmutex);
#endif
} }


bool lock() bool lock()
{ {
#ifdef DONT_USE_PTHREAD
cmutex.lock();
return true;
#else
return (pthread_mutex_lock(&pmutex) == 0); return (pthread_mutex_lock(&pmutex) == 0);
#endif
} }


bool tryLock() bool tryLock()
{ {
#ifdef DONT_USE_PTHREAD
return cmutex.try_lock();
#else
return (pthread_mutex_trylock(&pmutex) == 0); return (pthread_mutex_trylock(&pmutex) == 0);
#endif
} }


bool unlock() bool unlock()
{ {
#ifdef DONT_USE_PTHREAD
cmutex.unlock();
return true;
#else
return (pthread_mutex_unlock(&pmutex) == 0); return (pthread_mutex_unlock(&pmutex) == 0);
#endif
} }


class ScopedLocker class ScopedLocker
@@ -222,7 +244,11 @@ public:
}; };


private: private:
#ifdef DONT_USE_PTHREAD
std::mutex cmutex;
#else
pthread_mutex_t pmutex; pthread_mutex_t pmutex;
#endif
}; };


// ------------------------------------------------- // -------------------------------------------------
@@ -343,6 +369,8 @@ public:
if (*strBuf == 0) if (*strBuf == 0)
return false; return false;


// FIXME - use strstr

size_t thisLen = ::strlen(buffer); size_t thisLen = ::strlen(buffer);
size_t thatLen = ::strlen(strBuf)-1; size_t thatLen = ::strlen(strBuf)-1;




+ 4
- 4
source/utils/carla_vst_utils.hpp View File

@@ -9,7 +9,7 @@
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* For a full copy of the GNU General Public License see the COPYING file * For a full copy of the GNU General Public License see the COPYING file
@@ -18,9 +18,6 @@
#ifndef __CARLA_VST_UTILS_HPP__ #ifndef __CARLA_VST_UTILS_HPP__
#define __CARLA_VST_UTILS_HPP__ #define __CARLA_VST_UTILS_HPP__


// Disable deprecated VST features (NOT)
#define VST_FORCE_DEPRECATED 0

#include "carla_utils.hpp" #include "carla_utils.hpp"


#include <cstdint> #include <cstdint>
@@ -28,6 +25,9 @@
// ------------------------------------------------- // -------------------------------------------------
// Include fixes // Include fixes


// Disable deprecated VST features (NOT)
#define VST_FORCE_DEPRECATED 0

#if VESTIGE_HEADER #if VESTIGE_HEADER
#include "vestige/aeffectx.h" #include "vestige/aeffectx.h"
#define audioMasterGetOutputSpeakerArrangement audioMasterGetSpeakerArrangement #define audioMasterGetOutputSpeakerArrangement audioMasterGetSpeakerArrangement


Loading…
Cancel
Save