Browse Source

Rename more files, ensure ANSI compatible

tags/1.9.4
falkTX 12 years ago
parent
commit
353ad65fc8
32 changed files with 1171 additions and 96 deletions
  1. +2
    -0
      .gitignore
  2. +1
    -1
      source/backend/CarlaBackend.hpp
  3. +2
    -2
      source/backend/CarlaEngine.hpp
  4. +16
    -16
      source/backend/CarlaNative.hpp
  5. +3
    -3
      source/backend/CarlaPlugin.hpp
  6. +1
    -1
      source/backend/CarlaStandalone.hpp
  7. +1
    -1
      source/backend/engine/carla_engine.pro
  8. +125
    -0
      source/includes/CarlaDefines.hpp
  9. +144
    -0
      source/includes/CarlaMIDI.h
  10. +192
    -0
      source/includes/ladspa_rdf.hpp
  11. +550
    -0
      source/includes/lv2_rdf.hpp
  12. +2
    -2
      source/includes/vestige/aeffectx.h
  13. +51
    -0
      source/tests/ANSI.cpp
  14. +1
    -1
      source/tests/CarlaString.cpp
  15. +13
    -5
      source/tests/Makefile
  16. +1
    -1
      source/tests/Print.cpp
  17. +3
    -3
      source/tests/RtList.cpp
  18. +1
    -1
      source/tests/Thread.cpp
  19. +2
    -2
      source/utils/CarlaBackendUtils.hpp
  20. +1
    -1
      source/utils/CarlaJuceUtils.hpp
  21. +6
    -7
      source/utils/CarlaLadspaUtils.hpp
  22. +9
    -7
      source/utils/CarlaLibUtils.hpp
  23. +1
    -1
      source/utils/CarlaLv2Utils.hpp
  24. +1
    -1
      source/utils/CarlaMutex.hpp
  25. +18
    -18
      source/utils/CarlaOscUtils.hpp
  26. +3
    -3
      source/utils/CarlaStateUtils.hpp
  27. +1
    -1
      source/utils/CarlaString.hpp
  28. +11
    -11
      source/utils/CarlaThread.hpp
  29. +4
    -2
      source/utils/CarlaUtils.hpp
  30. +2
    -2
      source/utils/CarlaVstUtils.hpp
  31. +2
    -2
      source/utils/Lv2AtomQueue.hpp
  32. +1
    -1
      source/utils/RtList.hpp

+ 2
- 0
.gitignore View File

@@ -56,7 +56,9 @@ carla-discovery-native
carla-discovery-posix32
carla-discovery-posix64

source/tests/ANSI
source/tests/CarlaString
source/tests/Print
source/tests/RtList
source/tests/Thread



+ 1
- 1
source/backend/CarlaBackend.hpp View File

@@ -18,7 +18,7 @@
#ifndef __CARLA_BACKEND_HPP__
#define __CARLA_BACKEND_HPP__

#include "carla_defines.hpp"
#include "CarlaDefines.hpp"

#include <cstdint>



+ 2
- 2
source/backend/CarlaEngine.hpp View File

@@ -18,8 +18,8 @@
#ifndef __CARLA_ENGINE_HPP__
#define __CARLA_ENGINE_HPP__

#include "carla_backend.hpp"
#include "carla_utils.hpp"
#include "CarlaBackend.hpp"
#include "CarlaString.hpp"

#ifdef BUILD_BRIDGE
struct CarlaOscData;


+ 16
- 16
source/backend/CarlaNative.hpp View File

@@ -18,8 +18,8 @@
#ifndef __CARLA_NATIVE_HPP__
#define __CARLA_NATIVE_HPP__

#include "carla_native.h"
#include "carla_utils.hpp"
#include "CarlaNative.h"
#include "CarlaJuceUtils.hpp"

/*!
* @defgroup CarlaNativeAPI Carla Native API
@@ -133,7 +133,7 @@ protected:
return nullptr;

// unused
Q_UNUSED(index);
(void)index;
}

virtual float getParameterValue(const uint32_t index)
@@ -143,7 +143,7 @@ protected:
return 0.0f;

// unused
Q_UNUSED(index);
(void)index;
}

virtual const char* getParameterText(const uint32_t index)
@@ -153,7 +153,7 @@ protected:
return nullptr;

// unused
Q_UNUSED(index);
(void)index;
}

// -------------------------------------------------------------------
@@ -171,7 +171,7 @@ protected:
return nullptr;

// unused
Q_UNUSED(index);
(void)index;
}

// -------------------------------------------------------------------
@@ -184,8 +184,8 @@ protected:
return;

// unused
Q_UNUSED(index);
Q_UNUSED(value);
(void)index;
(void)value;
}

virtual void setMidiProgram(const uint32_t bank, const uint32_t program)
@@ -193,8 +193,8 @@ protected:
return;

// unused
Q_UNUSED(bank);
Q_UNUSED(program);
(void)bank;
(void)program;
}

virtual void setCustomData(const char* const key, const char* const value)
@@ -230,7 +230,7 @@ protected:
return;

// unused
Q_UNUSED(show);
(void)show;
}

virtual void uiIdle()
@@ -244,7 +244,7 @@ protected:
return;

// unused
Q_UNUSED(value);
(void)value;
}

virtual void uiSetMidiProgram(const uint32_t bank, const uint32_t program)
@@ -252,8 +252,8 @@ protected:
return;

// unused
Q_UNUSED(bank);
Q_UNUSED(program);
(void)bank;
(void)program;
}

virtual void uiSetCustomData(const char* const key, const char* const value)
@@ -264,8 +264,8 @@ protected:
return;

// unused
Q_UNUSED(key);
Q_UNUSED(value);
(void)key;
(void)value;
}

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


+ 3
- 3
source/backend/CarlaPlugin.hpp View File

@@ -18,9 +18,9 @@
#ifndef __CARLA_PLUGIN_HPP__
#define __CARLA_PLUGIN_HPP__

#include "carla_backend.hpp"
#include "carla_native.h"
#include "carla_utils.hpp"
#include "CarlaBackend.hpp"
#include "CarlaNative.h"
#include "CarlaString.hpp"

#ifndef DOXYGEN
// Avoid including extra libs here


+ 1
- 1
source/backend/CarlaStandalone.hpp View File

@@ -18,7 +18,7 @@
#ifndef __CARLA_STANDALONE_HPP__
#define __CARLA_STANDALONE_HPP__

#include "carla_backend.hpp"
#include "CarlaBackend.hpp"

/*!
* @defgroup CarlaBackendStandalone Carla Backend Standalone


+ 1
- 1
source/backend/engine/carla_engine.pro View File

@@ -91,7 +91,7 @@ QMAKE_CXXFLAGS += -isystem /opt/kxstudio/include/

WARN_FLAGS = \
-ansi -pedantic -pedantic-errors -Wall -Wextra -Wformat=2 -Wunused-parameter -Wuninitialized \
-Wcast-qual -Wconversion -Wsign-conversion -Wlogical-op -Waggregate-return -Wno-vla \
-Wcast-qual -Wconversion -Wsign-conversion -Wlogical-op -Waggregate-return -Wno-vla \
-fipa-pure-const -Wsuggest-attribute=const #pure,const,noreturn

QMAKE_CFLAGS += $${WARN_FLAGS} -std=c99 -Wc++-compat -Wunsuffixed-float-constants -Wwrite-strings


+ 125
- 0
source/includes/CarlaDefines.hpp View File

@@ -0,0 +1,125 @@
/*
* Carla common defines
* Copyright (C) 2011-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 General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* 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 General Public License for more details.
*
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#ifndef __CARLA_DEFINES_HPP__
#define __CARLA_DEFINES_HPP__

// Check OS
#if defined(__APPLE__)
# define CARLA_OS_MAC
#elif defined(__HAIKU__)
# define CARLA_OS_HAIKU
#elif defined(__linux__) || defined(__linux) || defined(QTCREATOR_TEST)
# define CARLA_OS_LINUX
#elif defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
# define CARLA_OS_WIN64
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define CARLA_OS_WIN32
#else
# warning Unsupported platform!
#endif

#if defined(CARLA_OS_WIN32) || defined(CARLA_OS_WIN64)
# define CARLA_OS_WIN
#elif ! defined(CARLA_OS_HAIKU)
# define CARLA_OS_UNIX
#endif

// Check for C++11 support
#if defined(HAVE_CPP11_SUPPORT) || defined(QTCREATOR_TEST)
# define CARLA_CPP11_SUPPORT
#elif defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
# if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
# define CARLA_CPP11_SUPPORT
# endif
#endif

// Common includes
#ifdef CARLA_OS_WIN
# include <winsock2.h>
# include <windows.h>
#else
# include <unistd.h>
# ifndef __cdecl
# define __cdecl
# endif
#endif

// Define various string format types
#if defined(CARLA_OS_WIN64)
# define P_INT64 "%I64i"
# define P_INTPTR "%I64i"
# define P_UINTPTR "%I64x"
# define P_SIZE "%I64u"
#elif defined(CARLA_OS_WIN32)
# define P_INT64 "%I64i"
# define P_INTPTR "%i"
# define P_UINTPTR "%x"
# define P_SIZE "%u"
#elif __WORDSIZE == 64
# define P_INT64 "%li"
# define P_INTPTR "%li"
# define P_UINTPTR "%lx"
# define P_SIZE "%lu"
#else
# define P_INT64 "%lli"
# define P_INTPTR "%i"
# define P_UINTPTR "%x"
# define P_SIZE "%u"
#endif

// Define BINARY_NATIVE
#if defined(CARLA_OS_HAIKU) || defined(CARLA_OS_UNIX)
# ifdef __LP64__
# define BINARY_NATIVE BINARY_POSIX64
# else
# define BINARY_NATIVE BINARY_POSIX32
# endif
#elif defined(CARLA_OS_WIN)
# ifdef CARLA_OS_WIN64
# define BINARY_NATIVE BINARY_WIN64
# else
# define BINARY_NATIVE BINARY_WIN32
# endif
#else
# warning Unknown binary native
# define BINARY_NATIVE BINARY_OTHER
#endif

// Define CARLA_ASSERT*
#ifdef NDEBUG
# define CARLA_ASSERT(cond) ((!(cond)) ? carla_assert(#cond, __FILE__, __LINE__) : pass())
# define CARLA_ASSERT_INT(cond, value) ((!(cond)) ? carla_assert_int(#cond, __FILE__, __LINE__, value) : pass())
# define CARLA_ASSERT_INT2(cond, v1, v2) ((!(cond)) ? carla_assert_int2(#cond, __FILE__, __LINE__, v1, v2) : pass())
#else
# define CARLA_ASSERT(cond) assert(cond)
# define CARLA_ASSERT_INT(cond, value) assert(cond)
# define CARLA_ASSERT_INT2(cond, v1, v2) assert(cond)
#endif

// Define CARLA_EXPORT
#ifdef BUILD_BRIDGE
# define CARLA_EXPORT extern "C"
#else
# if defined(CARLA_OS_WIN) && ! defined(__WINE__)
# define CARLA_EXPORT extern "C" __declspec (dllexport)
# else
# define CARLA_EXPORT extern "C" __attribute__ ((visibility("default")))
# endif
#endif

#endif // __CARLA_DEFINES_HPP__

+ 144
- 0
source/includes/CarlaMIDI.h View File

@@ -0,0 +1,144 @@
/*
* Carla common MIDI code
* Copyright (C) 2012-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 General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* 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 General Public License for more details.
*
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#ifndef __CARLA_MIDI_H__
#define __CARLA_MIDI_H__

#define MAX_MIDI_CHANNELS 16
#define MAX_MIDI_NOTE 128
#define MAX_MIDI_VALUE 128

// MIDI Messages List
#define MIDI_STATUS_NOTE_OFF 0x80 // note (0-127), velocity (0-127)
#define MIDI_STATUS_NOTE_ON 0x90 // note (0-127), velocity (0-127)
#define MIDI_STATUS_POLYPHONIC_AFTERTOUCH 0xA0 // note (0-127), pressure (0-127)
#define MIDI_STATUS_CONTROL_CHANGE 0xB0 // see 'Control Change Messages List'
#define MIDI_STATUS_PROGRAM_CHANGE 0xC0 // program (0-127), none
#define MIDI_STATUS_AFTERTOUCH 0xD0 // pressure (0-127), none
#define MIDI_STATUS_PITCH_WHEEL_CONTROL 0xE0 // LSB (0-127), MSB (0-127)

#define MIDI_IS_STATUS_NOTE_OFF(status) (((status) & 0xF0) == MIDI_STATUS_NOTE_OFF)
#define MIDI_IS_STATUS_NOTE_ON(status) (((status) & 0xF0) == MIDI_STATUS_NOTE_ON)
#define MIDI_IS_STATUS_POLYPHONIC_AFTERTOUCH(status) (((status) & 0xF0) == MIDI_STATUS_POLYPHONIC_AFTERTOUCH)
#define MIDI_IS_STATUS_CONTROL_CHANGE(status) (((status) & 0xF0) == MIDI_STATUS_CONTROL_CHANGE)
#define MIDI_IS_STATUS_PROGRAM_CHANGE(status) (((status) & 0xF0) == MIDI_STATUS_PROGRAM_CHANGE)
#define MIDI_IS_STATUS_AFTERTOUCH(status) (((status) & 0xF0) == MIDI_STATUS_AFTERTOUCH)
#define MIDI_IS_STATUS_PITCH_WHEEL_CONTROL(status) (((status) & 0xF0) == MIDI_STATUS_PITCH_WHEEL_CONTROL)

// MIDI Utils
#define MIDI_GET_STATUS_FROM_DATA(data) ((data[0]) & 0xF0)
#define MIDI_GET_CHANNEL_FROM_DATA(data) ((data[0]) & 0x0F)

// Control Change Messages List
#define MIDI_CONTROL_BANK_SELECT 0x00 // 0-127, MSB
#define MIDI_CONTROL_MODULATION_WHEEL 0x01 // 0-127, MSB
#define MIDI_CONTROL_BREATH_CONTROLLER 0x02 // 0-127, MSB
#define MIDI_CONTROL_FOOT_CONTROLLER 0x04 // 0-127, MSB
#define MIDI_CONTROL_PORTAMENTO_TIME 0x05 // 0-127, MSB
#define MIDI_CONTROL_DATA_ENTRY 0x06 // 0-127, MSB
#define MIDI_CONTROL_CHANNEL_VOLUME 0x07 // 0-127, MSB
#define MIDI_CONTROL_BALANCE 0x08 // 0-127, MSB
#define MIDI_CONTROL_PAN 0x0A // 0-127, MSB
#define MIDI_CONTROL_EXPRESSION_CONTROLLER 0x0B // 0-127, MSB
#define MIDI_CONTROL_EFFECT_CONTROL_1 0x0C // 0-127, MSB
#define MIDI_CONTROL_EFFECT_CONTROL_2 0x0D // 0-127, MSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_1 0x10 // 0-127, MSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_2 0x11 // 0-127, MSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_3 0x12 // 0-127, MSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_4 0x13 // 0-127, MSB
#define MIDI_CONTROL_BANK_SELECT__LSB 0x20 // 0-127, LSB
#define MIDI_CONTROL_MODULATION_WHEEL__LSB 0x21 // 0-127, LSB
#define MIDI_CONTROL_BREATH_CONTROLLER__LSB 0x22 // 0-127, LSB
#define MIDI_CONTROL_FOOT_CONTROLLER__LSB 0x24 // 0-127, LSB
#define MIDI_CONTROL_PORTAMENTO_TIME__LSB 0x25 // 0-127, LSB
#define MIDI_CONTROL_DATA_ENTRY__LSB 0x26 // 0-127, LSB
#define MIDI_CONTROL_CHANNEL_VOLUME__LSB 0x27 // 0-127, LSB
#define MIDI_CONTROL_BALANCE__LSB 0x28 // 0-127, LSB
#define MIDI_CONTROL_PAN__LSB 0x2A // 0-127, LSB
#define MIDI_CONTROL_EXPRESSION_CONTROLLER__LSB 0x2B // 0-127, LSB
#define MIDI_CONTROL_EFFECT_CONTROL_1__LSB 0x2C // 0-127, LSB
#define MIDI_CONTROL_EFFECT_CONTROL_2__LSB 0x3D // 0-127, LSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_1__LSB 0x30 // 0-127, LSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_2__LSB 0x31 // 0-127, LSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_3__LSB 0x32 // 0-127, LSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_4__LSB 0x33 // 0-127, LSB
#define MIDI_CONTROL_DAMPER_PEDAL 0x40 // <= 63 off, >= 64 off
#define MIDI_CONTROL_PORTAMENTO 0x41 // <= 63 off, >= 64 off
#define MIDI_CONTROL_SOSTENUDO 0x42 // <= 63 off, >= 64 off
#define MIDI_CONTROL_SOFT_PEDAL 0x43 // <= 63 off, >= 64 off
#define MIDI_CONTROL_LEGAL_FOOTSWITCH 0x44 // <= 63 normal, >= 64 legato
#define MIDI_CONTROL_HOLD_2 0x45 // <= 63 off, >= 64 off
#define MIDI_CONTROL_SOUND_CONTROLLER_1 0x46 // 0-127, LSB
#define MIDI_CONTROL_SOUND_CONTROLLER_2 0x47 // 0-127, LSB
#define MIDI_CONTROL_SOUND_CONTROLLER_3 0x48 // 0-127, LSB
#define MIDI_CONTROL_SOUND_CONTROLLER_4 0x49 // 0-127, LSB
#define MIDI_CONTROL_SOUND_CONTROLLER_5 0x4A // 0-127, LSB
#define MIDI_CONTROL_SOUND_CONTROLLER_6 0x4B // 0-127, LSB
#define MIDI_CONTROL_SOUND_CONTROLLER_7 0x4C // 0-127, LSB
#define MIDI_CONTROL_SOUND_CONTROLLER_8 0x4D // 0-127, LSB
#define MIDI_CONTROL_SOUND_CONTROLLER_9 0x4E // 0-127, LSB
#define MIDI_CONTROL_SOUND_CONTROLLER_10 0x4F // 0-127, LSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_5 0x50 // 0-127, LSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_6 0x51 // 0-127, LSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_7 0x52 // 0-127, LSB
#define MIDI_CONTROL_GENERAL_PURPOSE_CONTROLLER_8 0x53 // 0-127, LSB
#define MIDI_CONTROL_PORTAMENTO_CONTROL 0x54 // 0-127, LSB
#define MIDI_CONTROL_HIGH_RESOLUTION_VELOCITY_PREFIX 0x58 // 0-127, LSB
#define MIDI_CONTROL_EFFECTS_1_DEPTH 0x5B // 0-127
#define MIDI_CONTROL_EFFECTS_2_DEPTH 0x5C // 0-127
#define MIDI_CONTROL_EFFECTS_3_DEPTH 0x5D // 0-127
#define MIDI_CONTROL_EFFECTS_4_DEPTH 0x5E // 0-127
#define MIDI_CONTROL_EFFECTS_5_DEPTH 0x5F // 0-127

#define MIDI_CONTROL_ALL_SOUND_OFF 0x78 // 0
#define MIDI_CONTROL_RESET_ALL_CONTROLLERS 0x79 // 0
#define MIDI_CONTROL_LOCAL_CONTROL 0x7A // 0 off, 127 on
#define MIDI_CONTROL_ALL_NOTES_OFF 0x7B // 0
#define MIDI_CONTROL_OMNI_MODE_OFF 0x7C // 0 (+ all notes off)
#define MIDI_CONTROL_OMNI_MODE_ON 0x7D // 0 (+ all notes off)
#define MIDI_CONTROL_MONO_MODE_ON 0x7E // ...
#define MIDI_CONTROL_POLY_MODE_ON 0x7F // 0 ( + mono off, + all notes off)

#define MIDI_CONTROL_SOUND_VARIATION MIDI_CONTROL_SOUND_CONTROLLER_1
#define MIDI_CONTROL_TIMBRE MIDI_CONTROL_SOUND_CONTROLLER_2
#define MIDI_CONTROL_RELEASE_TIME MIDI_CONTROL_SOUND_CONTROLLER_3
#define MIDI_CONTROL_ATTACK_TIME MIDI_CONTROL_SOUND_CONTROLLER_4
#define MIDI_CONTROL_BRIGHTNESS MIDI_CONTROL_SOUND_CONTROLLER_5
#define MIDI_CONTROL_DECAY_TIME MIDI_CONTROL_SOUND_CONTROLLER_6
#define MIDI_CONTROL_VIBRATO_RATE MIDI_CONTROL_SOUND_CONTROLLER_7
#define MIDI_CONTROL_VIBRATO_DEPTH MIDI_CONTROL_SOUND_CONTROLLER_8
#define MIDI_CONTROL_VIBRATO_DELAY MIDI_CONTROL_SOUND_CONTROLLER_9
#define MIDI_CONTROL_REVERB_SEND_LEVEL MIDI_CONTROL_EFFECTS_1_DEPTH
#define MIDI_CONTROL_TREMOLO_DEPTH MIDI_CONTROL_EFFECTS_2_DEPTH
#define MIDI_CONTROL_CHORUS_SEND_LEVEL MIDI_CONTROL_EFFECTS_3_DEPTH
#define MIDI_CONTROL_DETUNE_DEPTH MIDI_CONTROL_EFFECTS_4_DEPTH
#define MIDI_CONTROL_PHASER_DEPTH MIDI_CONTROL_EFFECTS_5_DEPTH

#define MIDI_IS_CONTROL_BANK_SELECT(control) ((control) == MIDI_CONTROL_BANK_SELECT || (control) == MIDI_CONTROL_BANK_SELECT__LSB)
#define MIDI_IS_CONTROL_MODULATION_WHEEL(control) ((control) == MIDI_CONTROL_MODULATION_WHEEL || (control) == MIDI_CONTROL_MODULATION_WHEEL__LSB)
#define MIDI_IS_CONTROL_BREATH_CONTROLLER(control) ((control) == MIDI_CONTROL_BREATH_CONTROLLER || (control) == MIDI_CONTROL_BREATH_CONTROLLER__LSB)
#define MIDI_IS_CONTROL_FOOT_CONTROLLER(control) ((control) == MIDI_CONTROL_FOOT_CONTROLLER || (control) == MIDI_CONTROL_FOOT_CONTROLLER__LSB)
#define MIDI_IS_CONTROL_PORTAMENTO_TIME(control) ((control) == MIDI_CONTROL_PORTAMENTO_TIME || (control) == MIDI_CONTROL_PORTAMENTO_TIME__LSB)
#define MIDI_IS_CONTROL_DATA_ENTRY(control) ((control) == MIDI_CONTROL_DATA_ENTRY || (control) == MIDI_CONTROL_DATA_ENTRY__LSB)
#define MIDI_IS_CONTROL_CHANNEL_VOLUME(control) ((control) == MIDI_CONTROL_CHANNEL_VOLUME || (control) == MIDI_CONTROL_CHANNEL_VOLUME__LSB)
#define MIDI_IS_CONTROL_BALANCE(control) ((control) == MIDI_CONTROL_BALANCE || (control) == MIDI_CONTROL_BALANCE__LSB)
#define MIDI_IS_CONTROL_PAN(control) ((control) == MIDI_CONTROL_PAN || (control) == MIDI_CONTROL_PAN__LSB)
#define MIDI_IS_CONTROL_EXPRESSION_CONTROLLER(control) ((control) == MIDI_CONTROL_EXPRESSION_CONTROLLER || (control) == MIDI_CONTROL_EXPRESSION_CONTROLLER__LSB)
#define MIDI_IS_CONTROL_EFFECT_CONTROL_1(control) ((control) == MIDI_CONTROL_EFFECT_CONTROL_1 || (control) == MIDI_CONTROL_EFFECT_CONTROL_1__LSB)
#define MIDI_IS_CONTROL_EFFECT_CONTROL_2(control) ((control) == MIDI_CONTROL_EFFECT_CONTROL_2 || (control) == MIDI_CONTROL_EFFECT_CONTROL_2__LSB)

#endif // __CARLA_MIDI_H__

+ 192
- 0
source/includes/ladspa_rdf.hpp View File

@@ -0,0 +1,192 @@
/*
* Custom types to store LADSPA-RDF information
* Copyright (C) 2011-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 General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* 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 General Public License for more details.
*
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#ifndef LADSPA_RDF_INCLUDED
#define LADSPA_RDF_INCLUDED

// Base Types
typedef float LADSPA_Data;
typedef int LADSPA_Property;
typedef unsigned long long LADSPA_PluginType;

// Unit Types
#define LADSPA_UNIT_DB 0x01
#define LADSPA_UNIT_COEF 0x02
#define LADSPA_UNIT_HZ 0x04
#define LADSPA_UNIT_S 0x08
#define LADSPA_UNIT_MS 0x10
#define LADSPA_UNIT_MIN 0x20

#define LADSPA_UNIT_CLASS_AMPLITUDE (LADSPA_UNIT_DB|LADSPA_UNIT_COEF)
#define LADSPA_UNIT_CLASS_FREQUENCY (LADSPA_UNIT_HZ)
#define LADSPA_UNIT_CLASS_TIME (LADSPA_UNIT_S|LADSPA_UNIT_MS|LADSPA_UNIT_MIN)

#define LADSPA_IS_UNIT_DB(x) ((x) == LADSPA_UNIT_DB)
#define LADSPA_IS_UNIT_COEF(x) ((x) == LADSPA_UNIT_COEF)
#define LADSPA_IS_UNIT_HZ(x) ((x) == LADSPA_UNIT_HZ)
#define LADSPA_IS_UNIT_S(x) ((x) == LADSPA_UNIT_S)
#define LADSPA_IS_UNIT_MS(x) ((x) == LADSPA_UNIT_MS)
#define LADSPA_IS_UNIT_MIN(x) ((x) == LADSPA_UNIT_MIN)

#define LADSPA_IS_UNIT_CLASS_AMPLITUDE(x) ((x) & LADSPA_UNIT_CLASS_AMPLITUDE)
#define LADSPA_IS_UNIT_CLASS_FREQUENCY(x) ((x) & LADSPA_UNIT_CLASS_FREQUENCY)
#define LADSPA_IS_UNIT_CLASS_TIME(x) ((x) & LADSPA_UNIT_CLASS_TIME)

// Port Types (Official API)
#define LADSPA_PORT_INPUT 0x1
#define LADSPA_PORT_OUTPUT 0x2
#define LADSPA_PORT_CONTROL 0x4
#define LADSPA_PORT_AUDIO 0x8

// Port Hints
#define LADSPA_PORT_UNIT 0x1
#define LADSPA_PORT_DEFAULT 0x2
#define LADSPA_PORT_LABEL 0x4

#define LADSPA_PORT_HAS_UNIT(x) ((x) & LADSPA_PORT_UNIT)
#define LADSPA_PORT_HAS_DEFAULT(x) ((x) & LADSPA_PORT_DEFAULT)
#define LADSPA_PORT_HAS_LABEL(x) ((x) & LADSPA_PORT_LABEL)

// Plugin Types
#define LADSPA_PLUGIN_UTILITY 0x000000001LL
#define LADSPA_PLUGIN_GENERATOR 0x000000002LL
#define LADSPA_PLUGIN_SIMULATOR 0x000000004LL
#define LADSPA_PLUGIN_OSCILLATOR 0x000000008LL
#define LADSPA_PLUGIN_TIME 0x000000010LL
#define LADSPA_PLUGIN_DELAY 0x000000020LL
#define LADSPA_PLUGIN_PHASER 0x000000040LL
#define LADSPA_PLUGIN_FLANGER 0x000000080LL
#define LADSPA_PLUGIN_CHORUS 0x000000100LL
#define LADSPA_PLUGIN_REVERB 0x000000200LL
#define LADSPA_PLUGIN_FREQUENCY 0x000000400LL
#define LADSPA_PLUGIN_FREQUENCY_METER 0x000000800LL
#define LADSPA_PLUGIN_FILTER 0x000001000LL
#define LADSPA_PLUGIN_LOWPASS 0x000002000LL
#define LADSPA_PLUGIN_HIGHPASS 0x000004000LL
#define LADSPA_PLUGIN_BANDPASS 0x000008000LL
#define LADSPA_PLUGIN_COMB 0x000010000LL
#define LADSPA_PLUGIN_ALLPASS 0x000020000LL
#define LADSPA_PLUGIN_EQ 0x000040000LL
#define LADSPA_PLUGIN_PARAEQ 0x000080000LL
#define LADSPA_PLUGIN_MULTIEQ 0x000100000LL
#define LADSPA_PLUGIN_AMPLITUDE 0x000200000LL
#define LADSPA_PLUGIN_PITCH 0x000400000LL
#define LADSPA_PLUGIN_AMPLIFIER 0x000800000LL
#define LADSPA_PLUGIN_WAVESHAPER 0x001000000LL
#define LADSPA_PLUGIN_MODULATOR 0x002000000LL
#define LADSPA_PLUGIN_DISTORTION 0x004000000LL
#define LADSPA_PLUGIN_DYNAMICS 0x008000000LL
#define LADSPA_PLUGIN_COMPRESSOR 0x010000000LL
#define LADSPA_PLUGIN_EXPANDER 0x020000000LL
#define LADSPA_PLUGIN_LIMITER 0x040000000LL
#define LADSPA_PLUGIN_GATE 0x080000000LL
#define LADSPA_PLUGIN_SPECTRAL 0x100000000LL
#define LADSPA_PLUGIN_NOTCH 0x200000000LL

#define LADSPA_GROUP_DYNAMICS (LADSPA_PLUGIN_DYNAMICS|LADSPA_PLUGIN_COMPRESSOR|LADSPA_PLUGIN_EXPANDER|LADSPA_PLUGIN_LIMITER|LADSPA_PLUGIN_GATE)
#define LADSPA_GROUP_AMPLITUDE (LADSPA_PLUGIN_AMPLITUDE|LADSPA_PLUGIN_AMPLIFIER|LADSPA_PLUGIN_WAVESHAPER|LADSPA_PLUGIN_MODULATOR|LADSPA_PLUGIN_DISTORTION|LADSPA_GROUP_DYNAMICS)
#define LADSPA_GROUP_EQ (LADSPA_PLUGIN_EQ|LADSPA_PLUGIN_PARAEQ|LADSPA_PLUGIN_MULTIEQ)
#define LADSPA_GROUP_FILTER (LADSPA_PLUGIN_FILTER|LADSPA_PLUGIN_LOWPASS|LADSPA_PLUGIN_HIGHPASS|LADSPA_PLUGIN_BANDPASS|LADSPA_PLUGIN_COMB|LADSPA_PLUGIN_ALLPASS|LADSPA_PLUGIN_NOTCH)
#define LADSPA_GROUP_FREQUENCY (LADSPA_PLUGIN_FREQUENCY|LADSPA_PLUGIN_FREQUENCY_METER|LADSPA_GROUP_FILTER|LADSPA_GROUP_EQ|LADSPA_PLUGIN_PITCH)
#define LADSPA_GROUP_SIMULATOR (LADSPA_PLUGIN_SIMULATOR|LADSPA_PLUGIN_REVERB)
#define LADSPA_GROUP_TIME (LADSPA_PLUGIN_TIME|LADSPA_PLUGIN_DELAY|LADSPA_PLUGIN_PHASER|LADSPA_PLUGIN_FLANGER|LADSPA_PLUGIN_CHORUS|LADSPA_PLUGIN_REVERB)
#define LADSPA_GROUP_GENERATOR (LADSPA_PLUGIN_GENERATOR|LADSPA_PLUGIN_OSCILLATOR)

#define LADSPA_IS_PLUGIN_DYNAMICS(x) ((x) & LADSPA_GROUP_DYNAMICS)
#define LADSPA_IS_PLUGIN_AMPLITUDE(x) ((x) & LADSPA_GROUP_AMPLITUDE)
#define LADSPA_IS_PLUGIN_EQ(x) ((x) & LADSPA_GROUP_EQ)
#define LADSPA_IS_PLUGIN_FILTER(x) ((x) & LADSPA_GROUP_FILTER)
#define LADSPA_IS_PLUGIN_FREQUENCY(x) ((x) & LADSPA_GROUP_FREQUENCY)
#define LADSPA_IS_PLUGIN_SIMULATOR(x) ((x) & LADSPA_GROUP_SIMULATOR)
#define LADSPA_IS_PLUGIN_TIME(x) ((x) & LADSPA_GROUP_TIME)
#define LADSPA_IS_PLUGIN_GENERATOR(x) ((x) & LADSPA_GROUP_GENERATOR)

// Scale Point
struct LADSPA_RDF_ScalePoint {
LADSPA_Data Value;
const char* Label;

LADSPA_RDF_ScalePoint()
: Value(0.0f),
Label(nullptr) {}

~LADSPA_RDF_ScalePoint()
{
if (Label != nullptr)
delete[] Label;
}
};

// Port
struct LADSPA_RDF_Port {
LADSPA_Property Type;
LADSPA_Property Hints;
const char* Label;
LADSPA_Data Default;
LADSPA_Property Unit;

unsigned long ScalePointCount;
LADSPA_RDF_ScalePoint* ScalePoints;

LADSPA_RDF_Port()
: Type(0x0),
Hints(0x0),
Label(nullptr),
Default(0.0f),
Unit(0),
ScalePointCount(0),
ScalePoints(nullptr) {}

~LADSPA_RDF_Port()
{
if (Label != nullptr)
delete[] Label;
if (ScalePoints != nullptr)
delete[] ScalePoints;
}
};

// Plugin
struct LADSPA_RDF_Descriptor {
LADSPA_PluginType Type;
unsigned long UniqueID;
const char* Title;
const char* Creator;

unsigned long PortCount;
LADSPA_RDF_Port* Ports;

LADSPA_RDF_Descriptor()
: Type(0x0),
UniqueID(0),
Title(nullptr),
Creator(nullptr),
PortCount(0),
Ports(nullptr) {}

~LADSPA_RDF_Descriptor()
{
if (Title != nullptr)
delete[] Title;
if (Creator != nullptr)
delete[] Creator;
if (Ports != nullptr)
delete[] Ports;
}
};

#endif // LADSPA_RDF_INCLUDED

+ 550
- 0
source/includes/lv2_rdf.hpp View File

@@ -0,0 +1,550 @@
/*
* Custom types to store LV2 information
* Copyright (C) 2011-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 General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* 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 General Public License for more details.
*
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#ifndef LV2_RDF_INCLUDED
#define LV2_RDF_INCLUDED

#include <cstdint>

// Base Types
typedef const char* LV2_URI;
typedef uint32_t LV2_Property;

struct LV2_Type {
LV2_Property Value;
LV2_URI URI;

LV2_Type()
: Value(0),
URI(nullptr) {}

~LV2_Type()
{
if (URI != nullptr)
delete[] URI;
}
};

// Port Midi Map Types
#define LV2_PORT_MIDI_MAP_CC 0x1
#define LV2_PORT_MIDI_MAP_NRPN 0x2

#define LV2_IS_PORT_MIDI_MAP_CC(x) ((x) == LV2_PORT_MIDI_MAP_CC)
#define LV2_IS_PORT_MIDI_MAP_NRPN(x) ((x) == LV2_PORT_MIDI_MAP_NRPN)

// Port Point Hints
#define LV2_PORT_POINT_DEFAULT 0x1
#define LV2_PORT_POINT_MINIMUM 0x2
#define LV2_PORT_POINT_MAXIMUM 0x4

#define LV2_HAVE_DEFAULT_PORT_POINT(x) ((x) & LV2_PORT_POINT_DEFAULT)
#define LV2_HAVE_MINIMUM_PORT_POINT(x) ((x) & LV2_PORT_POINT_MINIMUM)
#define LV2_HAVE_MAXIMUM_PORT_POINT(x) ((x) & LV2_PORT_POINT_MAXIMUM)

// Port Unit Hints
#define LV2_PORT_UNIT_NAME 0x1
#define LV2_PORT_UNIT_RENDER 0x2
#define LV2_PORT_UNIT_SYMBOL 0x4
#define LV2_PORT_UNIT_UNIT 0x8

#define LV2_HAVE_PORT_UNIT_NAME(x) ((x) & LV2_PORT_UNIT_NAME)
#define LV2_HAVE_PORT_UNIT_RENDER(x) ((x) & LV2_PORT_UNIT_RENDER)
#define LV2_HAVE_PORT_UNIT_SYMBOL(x) ((x) & LV2_PORT_UNIT_SYMBOL)
#define LV2_HAVE_PORT_UNIT_UNIT(x) ((x) & LV2_PORT_UNIT_UNIT)

// Port Unit Unit
#define LV2_PORT_UNIT_BAR 0x01
#define LV2_PORT_UNIT_BEAT 0x02
#define LV2_PORT_UNIT_BPM 0x03
#define LV2_PORT_UNIT_CENT 0x04
#define LV2_PORT_UNIT_CM 0x05
#define LV2_PORT_UNIT_COEF 0x06
#define LV2_PORT_UNIT_DB 0x07
#define LV2_PORT_UNIT_DEGREE 0x08
#define LV2_PORT_UNIT_FRAME 0x09
#define LV2_PORT_UNIT_HZ 0x0A
#define LV2_PORT_UNIT_INCH 0x0B
#define LV2_PORT_UNIT_KHZ 0x0C
#define LV2_PORT_UNIT_KM 0x0D
#define LV2_PORT_UNIT_M 0x0E
#define LV2_PORT_UNIT_MHZ 0x0F
#define LV2_PORT_UNIT_MIDINOTE 0x10
#define LV2_PORT_UNIT_MILE 0x11
#define LV2_PORT_UNIT_MIN 0x12
#define LV2_PORT_UNIT_MM 0x13
#define LV2_PORT_UNIT_MS 0x14
#define LV2_PORT_UNIT_OCT 0x15
#define LV2_PORT_UNIT_PC 0x16
#define LV2_PORT_UNIT_S 0x17
#define LV2_PORT_UNIT_SEMITONE 0x18

#define LV2_IS_PORT_UNIT_BAR(x) ((x) == LV2_PORT_UNIT_BAR)
#define LV2_IS_PORT_UNIT_BEAT(x) ((x) == LV2_PORT_UNIT_BEAT)
#define LV2_IS_PORT_UNIT_BPM(x) ((x) == LV2_PORT_UNIT_BPM)
#define LV2_IS_PORT_UNIT_CENT(x) ((x) == LV2_PORT_UNIT_CENT)
#define LV2_IS_PORT_UNIT_CM(x) ((x) == LV2_PORT_UNIT_CM)
#define LV2_IS_PORT_UNIT_COEF(x) ((x) == LV2_PORT_UNIT_COEF)
#define LV2_IS_PORT_UNIT_DB(x) ((x) == LV2_PORT_UNIT_DB)
#define LV2_IS_PORT_UNIT_DEGREE(x) ((x) == LV2_PORT_UNIT_DEGREE)
#define LV2_IS_PORT_UNIT_FRAME(x) ((x) == LV2_PORT_UNIT_FRAME)
#define LV2_IS_PORT_UNIT_HZ(x) ((x) == LV2_PORT_UNIT_HZ)
#define LV2_IS_PORT_UNIT_INCH(x) ((x) == LV2_PORT_UNIT_INCH)
#define LV2_IS_PORT_UNIT_KHZ(x) ((x) == LV2_PORT_UNIT_KHZ)
#define LV2_IS_PORT_UNIT_KM(x) ((x) == LV2_PORT_UNIT_KM)
#define LV2_IS_PORT_UNIT_M(x) ((x) == LV2_PORT_UNIT_M)
#define LV2_IS_PORT_UNIT_MHZ(x) ((x) == LV2_PORT_UNIT_MHZ)
#define LV2_IS_PORT_UNIT_MIDINOTE(x) ((x) == LV2_PORT_UNIT_MIDINOTE)
#define LV2_IS_PORT_UNIT_MILE(x) ((x) == LV2_PORT_UNIT_MILE)
#define LV2_IS_PORT_UNIT_MIN(x) ((x) == LV2_PORT_UNIT_MIN)
#define LV2_IS_PORT_UNIT_MM(x) ((x) == LV2_PORT_UNIT_MM)
#define LV2_IS_PORT_UNIT_MS(x) ((x) == LV2_PORT_UNIT_MS)
#define LV2_IS_PORT_UNIT_OCT(x) ((x) == LV2_PORT_UNIT_OCT)
#define LV2_IS_PORT_UNIT_PC(x) ((x) == LV2_PORT_UNIT_PC)
#define LV2_IS_PORT_UNIT_S(x) ((x) == LV2_PORT_UNIT_S)
#define LV2_IS_PORT_UNIT_SEMITONE(x) ((x) == LV2_PORT_UNIT_SEMITONE)

// Port Types
#define LV2_PORT_INPUT 0x001
#define LV2_PORT_OUTPUT 0x002
#define LV2_PORT_CONTROL 0x004
#define LV2_PORT_AUDIO 0x008
#define LV2_PORT_CV 0x010
#define LV2_PORT_ATOM 0x020
#define LV2_PORT_ATOM_SEQUENCE (0x040 | LV2_PORT_ATOM)
#define LV2_PORT_ATOM_URID (0x080 | LV2_PORT_ATOM)
#define LV2_PORT_EVENT 0x100
#define LV2_PORT_MIDI_LL 0x200

// Port Data Types
#define LV2_PORT_DATA_MIDI_EVENT 0x1000
#define LV2_PORT_DATA_OBJECT 0x2000
#define LV2_PORT_DATA_PATCH_MESSAGE 0x4000
#define LV2_PORT_DATA_TIME 0x8000

#define LV2_IS_PORT_INPUT(x) ((x) & LV2_PORT_INPUT)
#define LV2_IS_PORT_OUTPUT(x) ((x) & LV2_PORT_OUTPUT)
#define LV2_IS_PORT_CONTROL(x) ((x) & LV2_PORT_CONTROL)
#define LV2_IS_PORT_AUDIO(x) ((x) & LV2_PORT_AUDIO)
#define LV2_IS_PORT_ATOM_SEQUENCE(x) ((x) & LV2_PORT_ATOM_SEQUENCE)
#define LV2_IS_PORT_CV(x) ((x) & LV2_PORT_CV)
#define LV2_IS_PORT_EVENT(x) ((x) & LV2_PORT_EVENT)
#define LV2_IS_PORT_MIDI_LL(x) ((x) & LV2_PORT_MIDI_LL)

#define LV2_PORT_SUPPORTS_MIDI_EVENT(x) ((x) & LV2_PORT_DATA_MIDI_EVENT)
#define LV2_PORT_SUPPORTS_PATCH_MESSAGE(x) ((x) & LV2_PORT_DATA_PATCH_MESSAGE)

// Port Properties
#define LV2_PORT_OPTIONAL 0x0001
#define LV2_PORT_ENUMERATION 0x0002
#define LV2_PORT_INTEGER 0x0004
#define LV2_PORT_SAMPLE_RATE 0x0008
#define LV2_PORT_TOGGLED 0x0010
#define LV2_PORT_CAUSES_ARTIFACTS 0x0020
#define LV2_PORT_CONTINUOUS_CV 0x0040
#define LV2_PORT_DISCRETE_CV 0x0080
#define LV2_PORT_EXPENSIVE 0x0100
#define LV2_PORT_STRICT_BOUNDS 0x0200
#define LV2_PORT_LOGARITHMIC 0x0400
#define LV2_PORT_NOT_AUTOMATIC 0x0800
#define LV2_PORT_NOT_ON_GUI 0x1000
#define LV2_PORT_TRIGGER 0x2000

#define LV2_IS_PORT_OPTIONAL(x) ((x) & LV2_PORT_OPTIONAL)
#define LV2_IS_PORT_ENUMERATION(x) ((x) & LV2_PORT_ENUMERATION)
#define LV2_IS_PORT_INTEGER(x) ((x) & LV2_PORT_INTEGER)
#define LV2_IS_PORT_SAMPLE_RATE(x) ((x) & LV2_PORT_SAMPLE_RATE)
#define LV2_IS_PORT_TOGGLED(x) ((x) & LV2_PORT_TOGGLED)
#define LV2_IS_PORT_CAUSES_ARTIFACTS(x) ((x) & LV2_PORT_CAUSES_ARTIFACTS)
#define LV2_IS_PORT_CONTINUOUS_CV(x) ((x) & LV2_PORT_CONTINUOUS_CV)
#define LV2_IS_PORT_DISCRETE_CV(x) ((x) & LV2_PORT_DISCRETE_CV)
#define LV2_IS_PORT_EXPENSIVE(x) ((x) & LV2_PORT_EXPENSIVE)
#define LV2_IS_PORT_STRICT_BOUNDS(x) ((x) & LV2_PORT_STRICT_BOUNDS)
#define LV2_IS_PORT_LOGARITHMIC(x) ((x) & LV2_PORT_LOGARITHMIC)
#define LV2_IS_PORT_NOT_AUTOMATIC(x) ((x) & LV2_PORT_NOT_AUTOMATIC)
#define LV2_IS_PORT_NOT_ON_GUI(x) ((x) & LV2_PORT_NOT_ON_GUI)
#define LV2_IS_PORT_TRIGGER(x) ((x) & LV2_PORT_TRIGGER)

// Port Designation
#define LV2_PORT_DESIGNATION_FREEWHEELING 0x1
#define LV2_PORT_DESIGNATION_LATENCY 0x2
#define LV2_PORT_DESIGNATION_SAMPLE_RATE 0x3
#define LV2_PORT_DESIGNATION_TIME_BAR 0x4
#define LV2_PORT_DESIGNATION_TIME_BAR_BEAT 0x5
#define LV2_PORT_DESIGNATION_TIME_BEAT 0x6
#define LV2_PORT_DESIGNATION_TIME_BEAT_UNIT 0x7
#define LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR 0x8
#define LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE 0x9
#define LV2_PORT_DESIGNATION_TIME_FRAME 0xA
#define LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND 0xB
#define LV2_PORT_DESIGNATION_TIME_POSITION 0xC
#define LV2_PORT_DESIGNATION_TIME_SPEED 0xD

#define LV2_IS_PORT_DESIGNATION_FREEWHEELING(x) ((x) == LV2_PORT_DESIGNATION_FREEWHEELING)
#define LV2_IS_PORT_DESIGNATION_LATENCY(x) ((x) == LV2_PORT_DESIGNATION_LATENCY)
#define LV2_IS_PORT_DESIGNATION_SAMPLE_RATE(x) ((x) == LV2_PORT_DESIGNATION_SAMPLE_RATE)
#define LV2_IS_PORT_DESIGNATION_TIME_BAR(x) ((x) == LV2_PORT_DESIGNATION_TIME_BAR)
#define LV2_IS_PORT_DESIGNATION_TIME_BAR_BEAT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BAR_BEAT)
#define LV2_IS_PORT_DESIGNATION_TIME_BEAT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEAT)
#define LV2_IS_PORT_DESIGNATION_TIME_BEAT_UNIT(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEAT_UNIT)
#define LV2_IS_PORT_DESIGNATION_TIME_BEATS_PER_BAR(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_BAR)
#define LV2_IS_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE(x) ((x) == LV2_PORT_DESIGNATION_TIME_BEATS_PER_MINUTE)
#define LV2_IS_PORT_DESIGNATION_TIME_FRAME(x) ((x) == LV2_PORT_DESIGNATION_TIME_FRAME)
#define LV2_IS_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND(x) ((x) == LV2_PORT_DESIGNATION_TIME_FRAMES_PER_SECOND)
#define LV2_IS_PORT_DESIGNATION_TIME_POSITION(x) ((x) == LV2_PORT_DESIGNATION_TIME_POSITION)
#define LV2_IS_PORT_DESIGNATION_TIME_SPEED(x) ((x) == LV2_PORT_DESIGNATION_TIME_SPEED)
#define LV2_IS_PORT_DESIGNATION_TIME(x) ((x) >= LV2_PORT_DESIGNATION_TIME_BAR && (x) <= LV2_PORT_DESIGNATION_TIME_SPEED)

// Feature Types
#define LV2_FEATURE_OPTIONAL 0x1
#define LV2_FEATURE_REQUIRED 0x2

#define LV2_IS_FEATURE_OPTIONAL(x) ((x) == LV2_FEATURE_OPTIONAL)
#define LV2_IS_FEATURE_REQUIRED(x) ((x) == LV2_FEATURE_REQUIRED)

// UI Types
#define LV2_UI_GTK2 0x1
#define LV2_UI_GTK3 0x2
#define LV2_UI_QT4 0x3
#define LV2_UI_QT5 0x4
#define LV2_UI_COCOA 0x5
#define LV2_UI_WINDOWS 0x6
#define LV2_UI_X11 0x7
#define LV2_UI_EXTERNAL 0x8
#define LV2_UI_OLD_EXTERNAL 0x9

#define LV2_IS_UI_GTK2(x) ((x) == LV2_UI_GTK2)
#define LV2_IS_UI_GTK3(x) ((x) == LV2_UI_GTK3)
#define LV2_IS_UI_QT4(x) ((x) == LV2_UI_QT4)
#define LV2_IS_UI_QT5(x) ((x) == LV2_UI_QT5)
#define LV2_IS_UI_COCOA(x) ((x) == LV2_UI_COCOA)
#define LV2_IS_UI_WINDOWS(x) ((x) == LV2_UI_WINDOWS)
#define LV2_IS_UI_X11(x) ((x) == LV2_UI_X11)
#define LV2_IS_UI_EXTERNAL(x) ((x) == LV2_UI_EXTERNAL)
#define LV2_IS_UI_OLD_EXTERNAL(x) ((x) == LV2_UI_OLD_EXTERNAL)

// Plugin Types
#define LV2_PLUGIN_DELAY 0x000001
#define LV2_PLUGIN_REVERB 0x000002
#define LV2_PLUGIN_SIMULATOR 0x000004
#define LV2_PLUGIN_DISTORTION 0x000008
#define LV2_PLUGIN_WAVESHAPER 0x000010
#define LV2_PLUGIN_DYNAMICS 0x000020
#define LV2_PLUGIN_AMPLIFIER 0x000040
#define LV2_PLUGIN_COMPRESSOR 0x000080
#define LV2_PLUGIN_ENVELOPE 0x000100
#define LV2_PLUGIN_EXPANDER 0x000200
#define LV2_PLUGIN_GATE 0x000400
#define LV2_PLUGIN_LIMITER 0x000800
#define LV2_PLUGIN_EQ 0x001000
#define LV2_PLUGIN_MULTI_EQ 0x002000
#define LV2_PLUGIN_PARA_EQ 0x004000
#define LV2_PLUGIN_FILTER 0x008000
#define LV2_PLUGIN_ALLPASS 0x010000
#define LV2_PLUGIN_BANDPASS 0x020000
#define LV2_PLUGIN_COMB 0x040000
#define LV2_PLUGIN_HIGHPASS 0x080000
#define LV2_PLUGIN_LOWPASS 0x100000

#define LV2_PLUGIN_GENERATOR 0x000001
#define LV2_PLUGIN_CONSTANT 0x000002
#define LV2_PLUGIN_INSTRUMENT 0x000004
#define LV2_PLUGIN_OSCILLATOR 0x000008
#define LV2_PLUGIN_MODULATOR 0x000010
#define LV2_PLUGIN_CHORUS 0x000020
#define LV2_PLUGIN_FLANGER 0x000040
#define LV2_PLUGIN_PHASER 0x000080
#define LV2_PLUGIN_SPATIAL 0x000100
#define LV2_PLUGIN_SPECTRAL 0x000200
#define LV2_PLUGIN_PITCH 0x000400
#define LV2_PLUGIN_UTILITY 0x000800
#define LV2_PLUGIN_ANALYSER 0x001000
#define LV2_PLUGIN_CONVERTER 0x002000
#define LV2_PLUGIN_FUNCTION 0x008000
#define LV2_PLUGIN_MIXER 0x010000

#define LV2_GROUP_DELAY (LV2_PLUGIN_DELAY|LV2_PLUGIN_REVERB)
#define LV2_GROUP_DISTORTION (LV2_PLUGIN_DISTORTION|LV2_PLUGIN_WAVESHAPER)
#define LV2_GROUP_DYNAMICS (LV2_PLUGIN_DYNAMICS|LV2_PLUGIN_AMPLIFIER|LV2_PLUGIN_COMPRESSOR|LV2_PLUGIN_ENVELOPE|LV2_PLUGIN_EXPANDER|LV2_PLUGIN_GATE|LV2_PLUGIN_LIMITER)
#define LV2_GROUP_EQ (LV2_PLUGIN_EQ|LV2_PLUGIN_MULTI_EQ|LV2_PLUGIN_PARA_EQ)
#define LV2_GROUP_FILTER (LV2_PLUGIN_FILTER|LV2_PLUGIN_ALLPASS|LV2_PLUGIN_BANDPASS|LV2_PLUGIN_COMB|LV2_GROUP_EQ|LV2_PLUGIN_HIGHPASS|LV2_PLUGIN_LOWPASS)
#define LV2_GROUP_GENERATOR (LV2_PLUGIN_GENERATOR|LV2_PLUGIN_CONSTANT|LV2_PLUGIN_INSTRUMENT|LV2_PLUGIN_OSCILLATOR)
#define LV2_GROUP_MODULATOR (LV2_PLUGIN_MODULATOR|LV2_PLUGIN_CHORUS|LV2_PLUGIN_FLANGER|LV2_PLUGIN_PHASER)
#define LV2_GROUP_REVERB (LV2_PLUGIN_REVERB)
#define LV2_GROUP_SIMULATOR (LV2_PLUGIN_SIMULATOR|LV2_PLUGIN_REVERB)
#define LV2_GROUP_SPATIAL (LV2_PLUGIN_SPATIAL)
#define LV2_GROUP_SPECTRAL (LV2_PLUGIN_SPECTRAL|LV2_PLUGIN_PITCH)
#define LV2_GROUP_UTILITY (LV2_PLUGIN_UTILITY|LV2_PLUGIN_ANALYSER|LV2_PLUGIN_CONVERTER|LV2_PLUGIN_FUNCTION|LV2_PLUGIN_MIXER)

#define LV2_IS_DELAY(x, y) (((x) & LV2_GROUP_DELAY) || ((y) & LV2_GROUP_DELAY))
#define LV2_IS_DISTORTION(x, y) (((x) & LV2_GROUP_DISTORTION) || ((y) & LV2_GROUP_DISTORTION))
#define LV2_IS_DYNAMICS(x, y) (((x) & LV2_GROUP_DYNAMICS) || ((y) & LV2_GROUP_DYNAMICS))
#define LV2_IS_EQ(x, y) (((x) & LV2_GROUP_EQ) || ((y) & LV2_GROUP_EQ))
#define LV2_IS_FILTER(x, y) (((x) & LV2_GROUP_FILTER) || ((y) & LV2_GROUP_FILTER))
#define LV2_IS_GENERATOR(x, y) (((x) & LV2_GROUP_GENERATOR) || ((y) & LV2_GROUP_GENERATOR))
#define LV2_IS_MODULATOR(x, y) (((x) & LV2_GROUP_MODULATOR) || ((y) & LV2_GROUP_MODULATOR))
#define LV2_IS_REVERB(x, y) (((x) & LV2_GROUP_REVERB) || ((y) & LV2_GROUP_REVERB))
#define LV2_IS_SIMULATOR(x, y) (((x) & LV2_GROUP_SIMULATOR) || ((y) & LV2_GROUP_SIMULATOR))
#define LV2_IS_SPATIAL(x, y) (((x) & LV2_GROUP_SPATIAL) || ((y) & LV2_GROUP_SPATIAL))
#define LV2_IS_SPECTRAL(x, y) (((x) & LV2_GROUP_SPECTRAL) || ((y) & LV2_GROUP_SPECTRAL))
#define LV2_IS_UTILITY(x, y) (((x) & LV2_GROUP_UTILITY) || ((y) & LV2_GROUP_UTILITY))

// Port Midi Map
struct LV2_RDF_PortMidiMap {
LV2_Property Type;
uint32_t Number;

LV2_RDF_PortMidiMap()
: Type(0),
Number(0) {}
};

// Port Points
struct LV2_RDF_PortPoints {
LV2_Property Hints;
float Default;
float Minimum;
float Maximum;

LV2_RDF_PortPoints()
: Hints(0x0),
Default(0.0f),
Minimum(0.0f),
Maximum(1.0f) {}
};

// Port Unit
struct LV2_RDF_PortUnit {
LV2_Property Hints;
const char* Name;
const char* Render;
const char* Symbol;
LV2_Property Unit;

LV2_RDF_PortUnit()
: Hints(0x0),
Name(nullptr),
Render(nullptr),
Symbol(nullptr),
Unit(0) {}

~LV2_RDF_PortUnit()
{
if (Name != nullptr)
delete[] Name;
if (Render != nullptr)
delete[] Render;
if (Symbol != nullptr)
delete[] Symbol;
}
};

// Port Scale Point
struct LV2_RDF_PortScalePoint {
const char* Label;
float Value;

LV2_RDF_PortScalePoint()
: Label(nullptr),
Value(0.0f) {}

~LV2_RDF_PortScalePoint()
{
if (Label != nullptr)
delete[] Label;
}
};

// Port
struct LV2_RDF_Port {
LV2_Property Types;
LV2_Property Properties;
LV2_Property Designation;
const char* Name;
const char* Symbol;

LV2_RDF_PortMidiMap MidiMap;
LV2_RDF_PortPoints Points;
LV2_RDF_PortUnit Unit;

uint32_t ScalePointCount;
LV2_RDF_PortScalePoint* ScalePoints;

LV2_RDF_Port()
: Types(0x0),
Properties(0x0),
Designation(0),
Name(nullptr),
Symbol(nullptr),
ScalePointCount(0),
ScalePoints(nullptr) {}

~LV2_RDF_Port()
{
if (Name != nullptr)
delete[] Name;
if (Symbol != nullptr)
delete[] Symbol;
if (ScalePoints != nullptr)
delete[] ScalePoints;
}
};

// Preset
struct LV2_RDF_Preset {
LV2_URI URI;
const char* Label;

LV2_RDF_Preset()
: URI(nullptr),
Label(nullptr) {}

~LV2_RDF_Preset()
{
if (URI != nullptr)
delete[] URI;
if (Label != nullptr)
delete[] Label;
}
};

// Feature
struct LV2_RDF_Feature {
LV2_Property Type;
LV2_URI URI;

LV2_RDF_Feature()
: Type(0),
URI(nullptr) {}

~LV2_RDF_Feature()
{
if (URI != nullptr)
delete[] URI;
}
};

// UI
struct LV2_RDF_UI {
LV2_Type Type;
LV2_URI URI;
const char* Binary;
const char* Bundle;

uint32_t FeatureCount;
LV2_RDF_Feature* Features;

uint32_t ExtensionCount;
LV2_URI* Extensions;

LV2_RDF_UI()
: URI(nullptr),
Binary(nullptr),
Bundle(nullptr),
FeatureCount(0),
Features(nullptr),
ExtensionCount(0),
Extensions(nullptr) {}

~LV2_RDF_UI()
{
if (URI != nullptr)
delete[] URI;
if (Binary != nullptr)
delete[] Binary;
if (Bundle != nullptr)
delete[] Bundle;
if (Features != nullptr)
delete[] Features;
if (Extensions != nullptr)
delete[] Extensions;
}
};

// Plugin
struct LV2_RDF_Descriptor {
LV2_Property Type[2];
LV2_URI URI;
const char* Name;
const char* Author;
const char* License;
const char* Binary;
const char* Bundle;
unsigned long UniqueID;

uint32_t PortCount;
LV2_RDF_Port* Ports;

uint32_t PresetCount;
LV2_RDF_Preset* Presets;

uint32_t FeatureCount;
LV2_RDF_Feature* Features;

uint32_t ExtensionCount;
LV2_URI* Extensions;

uint32_t UICount;
LV2_RDF_UI* UIs;

LV2_RDF_Descriptor()
: Type{0x0},
URI(nullptr),
Name(nullptr),
Author(nullptr),
License(nullptr),
Binary(nullptr),
Bundle(nullptr),
UniqueID(0),
PortCount(0),
Ports(nullptr),
PresetCount(0),
Presets(nullptr),
FeatureCount(0),
Features(nullptr),
ExtensionCount(0),
Extensions(nullptr),
UICount(0),
UIs(nullptr) {}

~LV2_RDF_Descriptor()
{
if (URI != nullptr)
delete[] URI;
if (Name != nullptr)
delete[] Name;
if (Author != nullptr)
delete[] Author;
if (License != nullptr)
delete[] License;
if (Binary != nullptr)
delete[] Binary;
if (Bundle != nullptr)
delete[] Bundle;
if (Ports != nullptr)
delete[] Ports;
if (Presets != nullptr)
delete[] Presets;
if (Features != nullptr)
delete[] Features;
if (Extensions != nullptr)
delete[] Extensions;
if (UIs != nullptr)
delete[] UIs;
}
};

#endif // LV2_RDF_INCLUDED

+ 2
- 2
source/includes/vestige/aeffectx.h View File

@@ -2,7 +2,7 @@
* aeffectx.h - simple header to allow VeSTige compilation and eventually work
*
* Copyright (c) 2006 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
*
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
@@ -172,7 +172,7 @@ struct _VstEvents
// 04
void *reserved;
// 08
VstEvent * events[];
VstEvent * events[2];
};

typedef struct _VstEvents VstEvents;


+ 51
- 0
source/tests/ANSI.cpp View File

@@ -0,0 +1,51 @@
/*
* Carla Tests
* 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 General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or any later version.
*
* 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 General Public License for more details.
*
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#if 1
#include "CarlaDefines.hpp"
#include "CarlaMIDI.h"
#include "ladspa_rdf.hpp"
#include "lv2_rdf.hpp"

#include "CarlaBackend.hpp"
#include "CarlaEngine.hpp"
#include "CarlaNative.h"
#include "CarlaNative.hpp"
#include "CarlaPlugin.hpp"
#include "CarlaStandalone.hpp"

#include "CarlaUtils.hpp"
#include "CarlaBackendUtils.hpp"
#include "CarlaJuceUtils.hpp"
#include "CarlaLibUtils.hpp"
#include "CarlaOscUtils.hpp"
//#include "CarlaStateUtils.hpp"
#include "CarlaLadspaUtils.hpp"
//#include "CarlaLv2Utils.hpp"
#include "CarlaVstUtils.hpp"

#include "CarlaMutex.hpp"
#include "CarlaString.hpp"
#include "CarlaThread.hpp"
//#include "Lv2AtomQueue.hpp"
#include "RtList.hpp"
#endif

int main()
{
return 0;
}

+ 1
- 1
source/tests/CarlaString.cpp View File

@@ -15,7 +15,7 @@
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#include "carla_string.hpp"
#include "CarlaString.hpp"

int main()
{


+ 13
- 5
source/tests/Makefile View File

@@ -8,15 +8,23 @@ include ../Makefile.mk

# --------------------------------------------------------------

BUILD_CXX_FLAGS += -I../backend -I../includes -I../utils
BUILD_CXX_FLAGS += -I../backend -I../includes -I../utils -Wall -Wextra
# BUILD_CXX_FLAGS += -I/opt/mingw32/include

TARGETS = CarlaString RtList Thread Print_
ANSI_CXX_FLAGS = -ansi -pedantic -pedantic-errors -Wunused-parameter -Wuninitialized -Wno-vla
ANSI_CXX_FLAGS += -Wcast-qual -Wconversion -Wsign-conversion -Wlogical-op -Waggregate-return
ANSI_CXX_FLAGS += -std=c++11 -Wzero-as-null-pointer-constant
ANSI_CXX_FLAGS += -DVESTIGE_HEADER

TARGETS = ANSI CarlaString RtList Thread Print

all: $(TARGETS) RUN

# --------------------------------------------------------------

ANSI: ANSI.cpp
$(CXX) $^ $(BUILD_CXX_FLAGS) $(ANSI_CXX_FLAGS) $(LINK_FLAGS) -o $@

CarlaString: CarlaString.cpp
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@

@@ -26,8 +34,8 @@ RtList: RtList.cpp ../libs/rtmempool.a
Thread: Thread.cpp
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -pthread -lpthread -o $@

Print_: Print.cpp
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o Print # $@
Print: Print.cpp
$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@

GL_: GL.cpp
# $(CXX) $^ $(BUILD_CXX_FLAGS) -I../backend/engine/plugin -I../libs/distrho-plugin-toolkit $(LINK_FLAGS) -lgdi32 -lopengl32 -lole32 -luuid -lws2_32 -o GL # $@
@@ -35,7 +43,7 @@ GL_: GL.cpp

RUN: $(TARGETS)
# ./CarlaString && ./RtList && ./Thread
./Print
# ./Print
# ./GL

# --------------------------------------------------------------


+ 1
- 1
source/tests/Print.cpp View File

@@ -15,7 +15,7 @@
* For a full copy of the GNU General Public License see the GPL.txt file
*/

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

int main()
{


+ 3
- 3
source/tests/RtList.cpp View File

@@ -15,10 +15,10 @@
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#include "rt_list.hpp"
#include "RtList.hpp"

#include "carla_string.hpp"
#include "carla_mutex.hpp"
#include "CarlaString.hpp"
#include "CarlaMutex.hpp"

const unsigned short MIN_RT_EVENTS = 152;
const unsigned short MAX_RT_EVENTS = 512;


+ 1
- 1
source/tests/Thread.cpp View File

@@ -15,7 +15,7 @@
* For a full copy of the GNU General Public License see the GPL.txt file
*/

#include "carla_thread.hpp"
#include "CarlaThread.hpp"

class MyThread : public CarlaThread
{


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

@@ -18,8 +18,8 @@
#ifndef __CARLA_BACKEND_UTILS_HPP__
#define __CARLA_BACKEND_UTILS_HPP__

#include "carla_backend.hpp"
#include "CarlaUtils.hpp"
#include "CarlaBackend.hpp"
#include "CarlaString.hpp"

CARLA_BACKEND_START_NAMESPACE



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

@@ -19,7 +19,7 @@
#ifndef __CARLA_JUCE_UTILS_HPP__
#define __CARLA_JUCE_UTILS_HPP__

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

#include <algorithm>



+ 6
- 7
source/utils/CarlaLadspaUtils.hpp View File

@@ -18,13 +18,12 @@
#ifndef __CARLA_LADSPA_UTILS_HPP__
#define __CARLA_LADSPA_UTILS_HPP__

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

#include "ladspa/ladspa.h"
#include "ladspa_rdf.hpp"

#include <cmath>
#include <cstring>

// -------------------------------------------------
// Copy RDF object
@@ -32,9 +31,9 @@
static inline
const LADSPA_RDF_Descriptor* ladspa_rdf_dup(const LADSPA_RDF_Descriptor* const oldDescriptor)
{
CARLA_ASSERT(oldDescriptor);
CARLA_ASSERT(oldDescriptor != nullptr);

if (! oldDescriptor)
if (oldDescriptor == nullptr)
return nullptr;

LADSPA_RDF_Descriptor* const newDescriptor = new LADSPA_RDF_Descriptor;
@@ -116,13 +115,13 @@ bool is_ladspa_rdf_descriptor_valid(const LADSPA_RDF_Descriptor* const rdfDescri

if (rdfDescriptor->UniqueID != descriptor->UniqueID)
{
qWarning("WARNING - Plugin has wrong UniqueID: %li != %li", rdfDescriptor->UniqueID, descriptor->UniqueID);
carla_stderr("WARNING - Plugin has wrong UniqueID: %li != %li", rdfDescriptor->UniqueID, descriptor->UniqueID);
return false;
}

if (rdfDescriptor->PortCount > descriptor->PortCount)
{
qWarning("WARNING - Plugin has RDF data, but invalid PortCount: %li > %li", rdfDescriptor->PortCount, descriptor->PortCount);
carla_stderr("WARNING - Plugin has RDF data, but invalid PortCount: %li > %li", rdfDescriptor->PortCount, descriptor->PortCount);
return false;
}

@@ -130,7 +129,7 @@ bool is_ladspa_rdf_descriptor_valid(const LADSPA_RDF_Descriptor* const rdfDescri
{
if (! is_ladspa_port_good(rdfDescriptor->Ports[i].Type, descriptor->PortDescriptors[i]))
{
qWarning("WARNING - Plugin has RDF data, but invalid PortTypes: %i != %i", rdfDescriptor->Ports[i].Type, descriptor->PortDescriptors[i]);
carla_stderr("WARNING - Plugin has RDF data, but invalid PortTypes: %i != %i", rdfDescriptor->Ports[i].Type, descriptor->PortDescriptors[i]);
return false;
}
}


+ 9
- 7
source/utils/CarlaLibUtils.hpp View File

@@ -18,9 +18,9 @@
#ifndef __CARLA_LIB_UTILS_HPP__
#define __CARLA_LIB_UTILS_HPP__

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

#ifndef Q_OS_WIN
#ifndef CARLA_OS_WIN
# include <dlfcn.h>
#endif

@@ -32,7 +32,7 @@ void* lib_open(const char* const filename)
{
CARLA_ASSERT(filename);

#ifdef Q_OS_WIN
#ifdef CARLA_OS_WIN
return (void*)LoadLibraryA(filename);
#else
return dlopen(filename, RTLD_NOW|RTLD_LOCAL);
@@ -47,7 +47,7 @@ bool lib_close(void* const lib)
if (! lib)
return false;

#ifdef Q_OS_WIN
#ifdef CARLA_OS_WIN
return FreeLibrary((HMODULE)lib);
#else
return (dlclose(lib) == 0);
@@ -63,7 +63,7 @@ void* lib_symbol(void* const lib, const char* const symbol)
if (! (lib && symbol))
return nullptr;

#ifdef Q_OS_WIN
#ifdef CARLA_OS_WIN
return (void*)GetProcAddress((HMODULE)lib, symbol);
#else
return dlsym(lib, symbol);
@@ -75,7 +75,7 @@ const char* lib_error(const char* const filename)
{
CARLA_ASSERT(filename);

#ifdef Q_OS_WIN
#ifdef CARLA_OS_WIN
static char libError[2048];
std::memset(libError, 0, sizeof(char)*2048);

@@ -89,7 +89,9 @@ const char* lib_error(const char* const filename)
return libError;
#else
return dlerror();
Q_UNUSED(filename);

// unused
(void)filename;
#endif
}



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

@@ -18,7 +18,7 @@
#ifndef __CARLA_LV2_UTILS_HPP__
#define __CARLA_LV2_UTILS_HPP__

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

#include "lv2/lv2.h"
#include "lv2/atom.h"


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

@@ -18,7 +18,7 @@
#ifndef __CARLA_MUTEX_HPP__
#define __CARLA_MUTEX_HPP__

#include "carla_juce_utils.hpp"
#include "CarlaJuceUtils.hpp"

// #define CPP11_MUTEX



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

@@ -18,7 +18,7 @@
#ifndef __CARLA_OSC_UTILS_HPP__
#define __CARLA_OSC_UTILS_HPP__

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

#include <cstdint>
#include <lo/lo.h>
@@ -70,7 +70,7 @@ void osc_send_configure(const CarlaOscData* const oscData, const char* const key
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(key != nullptr);
CARLA_ASSERT(value != nullptr);
qDebug("osc_send_configure(path:\"%s\", \"%s\", \"%s\")", oscData->path, key, value);
carla_debug("osc_send_configure(path:\"%s\", \"%s\", \"%s\")", oscData->path, key, value);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && key != nullptr && value != nullptr)
{
@@ -86,7 +86,7 @@ void osc_send_control(const CarlaOscData* const oscData, const int32_t index, co
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(index != -1); // -1 == PARAMETER_NULL
qDebug("osc_send_control(path:\"%s\", %i, %f)", oscData->path, index, value);
carla_debug("osc_send_control(path:\"%s\", %i, %f)", oscData->path, index, value);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && index != -1)
{
@@ -102,7 +102,7 @@ void osc_send_program(const CarlaOscData* const oscData, const int32_t index)
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(index >= 0);
qDebug("osc_send_program(path:\"%s\", %i)", oscData->path, index);
carla_debug("osc_send_program(path:\"%s\", %i)", oscData->path, index);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && index >= 0)
{
@@ -119,7 +119,7 @@ void osc_send_program(const CarlaOscData* const oscData, const int32_t bank, con
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(program >= 0);
CARLA_ASSERT(bank >= 0);
qDebug("osc_send_program(path:\"%s\", %i, %i)", oscData->path, bank, program);
carla_debug("osc_send_program(path:\"%s\", %i, %i)", oscData->path, bank, program);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && bank >= 0 && program >= 0)
{
@@ -135,7 +135,7 @@ void osc_send_midi_program(const CarlaOscData* const oscData, const int32_t inde
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(index >= 0);
qDebug("osc_send_midi_program(path:\"%s\", %i)", oscData->path, index);
carla_debug("osc_send_midi_program(path:\"%s\", %i)", oscData->path, index);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && index >= 0)
{
@@ -152,7 +152,7 @@ void osc_send_midi_program(const CarlaOscData* const oscData, const int32_t bank
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(program >= 0);
CARLA_ASSERT(bank >= 0);
qDebug("osc_send_midi_program(path:\"%s\", %i, %i)", oscData->path, bank, program);
carla_debug("osc_send_midi_program(path:\"%s\", %i, %i)", oscData->path, bank, program);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && bank >= 0 && program >= 0)
{
@@ -169,7 +169,7 @@ void osc_send_midi(const CarlaOscData* const oscData, const uint8_t buf[4])
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(buf[0] == 0);
CARLA_ASSERT(buf[1] != 0);
qDebug("osc_send_midi(path:\"%s\", 0x%X, %03u, %03u)", oscData->path, buf[1], buf[2], buf[3]);
carla_debug("osc_send_midi(path:\"%s\", 0x%X, %03u, %03u)", oscData->path, buf[1], buf[2], buf[3]);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && buf[0] == 0 && buf[1] != 0)
{
@@ -185,7 +185,7 @@ void osc_send_sample_rate(const CarlaOscData* const oscData, const float sampleR
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(sampleRate > 0.0f);
qDebug("osc_send_sample_rate(path:\"%s\", %f)", oscData->path, sampleRate);
carla_debug("osc_send_sample_rate(path:\"%s\", %f)", oscData->path, sampleRate);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && sampleRate > 0.0f)
{
@@ -202,7 +202,7 @@ void osc_send_update(const CarlaOscData* const oscData, const char* const url)
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(url != nullptr);
qDebug("osc_send_update(path:\"%s\", \"%s\")", oscData->path, url);
carla_debug("osc_send_update(path:\"%s\", \"%s\")", oscData->path, url);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && url != nullptr)
{
@@ -217,7 +217,7 @@ static inline
void osc_send_exiting(const CarlaOscData* const oscData)
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
qDebug("osc_send_exiting(path:\"%s\")", oscData->path);
carla_debug("osc_send_exiting(path:\"%s\")", oscData->path);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr)
{
@@ -233,7 +233,7 @@ static inline
void osc_send_show(const CarlaOscData* const oscData)
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
qDebug("osc_send_show(path:\"%s\")", oscData->path);
carla_debug("osc_send_show(path:\"%s\")", oscData->path);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr)
{
@@ -248,7 +248,7 @@ static inline
void osc_send_hide(const CarlaOscData* const oscData)
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
qDebug("osc_send_hide(path:\"%s\")", oscData->path);
carla_debug("osc_send_hide(path:\"%s\")", oscData->path);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr)
{
@@ -263,7 +263,7 @@ static inline
void osc_send_quit(const CarlaOscData* const oscData)
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
qDebug("osc_send_quit(path:\"%s\")", oscData->path);
carla_debug("osc_send_quit(path:\"%s\")", oscData->path);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr)
{
@@ -282,7 +282,7 @@ void osc_send_bridge_update(const CarlaOscData* const oscData, const char* const
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(url != nullptr);
qDebug("osc_send_bridge_update(path:\"%s\", \"%s\")", oscData->path, url);
carla_debug("osc_send_bridge_update(path:\"%s\", \"%s\")", oscData->path, url);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && url != nullptr)
{
@@ -298,7 +298,7 @@ void osc_send_bridge_error(const CarlaOscData* const oscData, const char* const
{
CARLA_ASSERT(oscData != nullptr && oscData->path != nullptr);
CARLA_ASSERT(error != nullptr);
qDebug("osc_send_bridge_error(path:\"%s\", \"%s\")", oscData->path, error);
carla_debug("osc_send_bridge_error(path:\"%s\", \"%s\")", oscData->path, error);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && error != nullptr)
{
@@ -318,7 +318,7 @@ void osc_send_lv2_transfer_atom(const CarlaOscData* const oscData, const int32_t
CARLA_ASSERT(portIndex >= 0);
CARLA_ASSERT(typeStr != nullptr);
CARLA_ASSERT(atomBuf != nullptr);
qDebug("osc_send_lv2_transfer_atom(path:\"%s\", %i, \"%s\", <atomBuf:%p>)", oscData->path, portIndex, typeStr, atomBuf);
carla_debug("osc_send_lv2_transfer_atom(path:\"%s\", %i, \"%s\", <atomBuf:%p>)", oscData->path, portIndex, typeStr, atomBuf);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && portIndex >= 0 && typeStr != nullptr && atomBuf != nullptr)
{
@@ -336,7 +336,7 @@ void osc_send_lv2_transfer_event(const CarlaOscData* const oscData, const int32_
CARLA_ASSERT(portIndex >= 0);
CARLA_ASSERT(typeStr != nullptr);
CARLA_ASSERT(atomBuf != nullptr);
qDebug("osc_send_lv2_transfer_event(path:\"%s\", %i, \"%s\", <atomBuf:%p>)", oscData->path, portIndex, typeStr, atomBuf);
carla_debug("osc_send_lv2_transfer_event(path:\"%s\", %i, \"%s\", <atomBuf:%p>)", oscData->path, portIndex, typeStr, atomBuf);

if (oscData != nullptr && oscData->path != nullptr && oscData->target != nullptr && portIndex >= 0 && typeStr != nullptr && atomBuf != nullptr)
{


+ 3
- 3
source/utils/CarlaStateUtils.hpp View File

@@ -18,8 +18,8 @@
#ifndef __CARLA_STATE_UTILS_HPP__
#define __CARLA_STATE_UTILS_HPP__

#include "carla_backend.hpp"
#include "carla_utils.hpp"
#include "CarlaBackend.hpp"
#include "CarlaUtils.hpp"

#include <QtXml/QDomNode>

@@ -422,7 +422,7 @@ QString getXMLFromSaveState(const SaveState& saveState)
return "";

// TODO
Q_UNUSED(saveState);
(void)saveState;
}

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


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

@@ -18,7 +18,7 @@
#ifndef __CARLA_STRING_HPP__
#define __CARLA_STRING_HPP__

#include "carla_juce_utils.hpp"
#include "CarlaJuceUtils.hpp"

// -------------------------------------------------
// CarlaString class


+ 11
- 11
source/utils/CarlaThread.hpp View File

@@ -18,9 +18,9 @@
#ifndef __CARLA_THREAD_HPP__
#define __CARLA_THREAD_HPP__

#include "carla_juce_utils.hpp"
#include "CarlaJuceUtils.hpp"

// #define CPP11_MUTEX
// #define CPP11_THREAD

#ifdef CPP11_THREAD
# include <thread>
@@ -38,7 +38,7 @@ public:
: fStarted(false),
fFinished(false)
{
#ifdef CPP11_MUTEX
#ifdef CPP11_THREAD
cthread = nullptr;
#else
_zero();
@@ -54,7 +54,7 @@ public:
if (isRunning())
terminate();

#ifdef CPP11_MUTEX
#ifdef CPP11_THREAD
if (cthread != nullptr)
{
cthread->join();
@@ -78,7 +78,7 @@ public:
fStarted = false;
fFinished = false;

#ifdef CPP11_MUTEX
#ifdef CPP11_THREAD
CARLA_ASSERT(cthread == nullptr);

if (cthread != nullptr)
@@ -105,7 +105,7 @@ public:
if (! isRunning())
return true;

#ifdef CPP11_MUTEX
#ifdef CPP11_THREAD
if (cthread == nullptr)
return true;
#else
@@ -115,7 +115,7 @@ public:

if (timeout == 0)
{
#ifdef CPP11_MUTEX
#ifdef CPP11_THREAD
cthread->join();
#else
pthread_join(pthreadId, nullptr);
@@ -130,7 +130,7 @@ public:
if (! fFinished)
return false;

#ifdef CPP11_MUTEX
#ifdef CPP11_THREAD
delete cthread;
cthread = nullptr;
#else
@@ -147,7 +147,7 @@ public:
if (fFinished)
return;

#ifdef CPP11_MUTEX
#ifdef CPP11_THREAD
if (cthread == nullptr)
return;
#else
@@ -155,7 +155,7 @@ public:
return;
#endif

#ifdef CPP11_MUTEX
#ifdef CPP11_THREAD
cthread->detach();
//cthread->join();
delete cthread;
@@ -211,7 +211,7 @@ private:
fFinished = true;
}

#ifdef CPP11_MUTEX
#ifdef CPP11_THREAD
std::thread* cthread;

static void _cthreadRoutine(CarlaThread* const _this_)


+ 4
- 2
source/utils/CarlaUtils.hpp View File

@@ -194,6 +194,8 @@ void carla_setprocname(const char* const name)
static inline
const char* carla_strdup(const char* const strBuf)
{
CARLA_ASSERT(strBuf != nullptr);

const size_t bufferLen = (strBuf != nullptr) ? std::strlen(strBuf) : 0;
char* const buffer = new char [bufferLen+1];

@@ -205,10 +207,10 @@ const char* carla_strdup(const char* const strBuf)
}

static inline
const char* carla_strdup_free(const char* const strBuf)
const char* carla_strdup_free(char* const strBuf)
{
const char* const buffer = carla_strdup(strBuf);
std::free((void*)strBuf);
std::free(strBuf);
return buffer;
}



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

@@ -18,7 +18,7 @@
#ifndef __CARLA_VST_UTILS_HPP__
#define __CARLA_VST_UTILS_HPP__

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

#include <cstdint>

@@ -128,7 +128,7 @@ typedef AEffect* (*VST_Function)(audioMasterCallback);
// Check if feature is supported by the plugin

static inline
bool vstPluginCanDo(AEffect* const effect, const char* const feature)
bool vstPluginCanDo(AEffect* const effect, char* const feature)
{
return (effect->dispatcher(effect, effCanDo, 0, 0, (void*)feature, 0.0f) == 1);
}


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

@@ -18,10 +18,10 @@
#ifndef __LV2_ATOM_QUEUE_HPP__
#define __LV2_ATOM_QUEUE_HPP__

#include "carla_utils.hpp"
#include "lv2/atom.h"
#include "CarlaUtils.hpp"

#include <cstring> // memcpy, memset
#include "lv2/atom.h"

class Lv2AtomQueue
{


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

@@ -18,7 +18,7 @@
#ifndef __RT_LIST_HPP__
#define __RT_LIST_HPP__

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

extern "C" {
#include "rtmempool/list.h"


Loading…
Cancel
Save