Browse Source

Add NATIVE_ prefix to all internal API enums; Rework some tests

tags/1.9.6
falkTX 11 years ago
parent
commit
d6e2714b11
12 changed files with 366 additions and 168 deletions
  1. +81
    -81
      source/includes/CarlaMIDI.h
  2. +49
    -49
      source/modules/CarlaNative.h
  3. +2
    -2
      source/tests/CarlaUtils2.cpp
  4. +1
    -0
      source/tests/CarlaUtils3.cpp
  5. +19
    -15
      source/tests/Exceptions.cpp
  6. +25
    -15
      source/tests/Makefile
  7. +16
    -0
      source/tests/Print.cpp
  8. +21
    -0
      source/tests/RDF.cpp
  9. +9
    -6
      source/tests/ansi-pedantic-test.c
  10. +25
    -0
      source/tests/jack-enum-test/Makefile
  11. +82
    -0
      source/tests/jack-enum-test/jack-enum-test-func.cpp
  12. +36
    -0
      source/tests/jack-enum-test/jack-enum-test-main.cpp

+ 81
- 81
source/includes/CarlaMIDI.h View File

@@ -21,26 +21,26 @@
#define MAX_MIDI_CHANNELS 16
#define MAX_MIDI_NOTE 128
#define MAX_MIDI_VALUE 128
#define MAX_MIDI_CONTROL 120 // 0x77
#define MAX_MIDI_CONTROL 120 /* 0x77 */

#define MIDI_STATUS_BIT 0xF0
#define MIDI_CHANNEL_BIT 0x0F

// 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_CHANNEL_PRESSURE 0xD0 // pressure (0-127), none
#define MIDI_STATUS_PITCH_WHEEL_CONTROL 0xE0 // LSB (0-127), MSB (0-127)
/** 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_CHANNEL_PRESSURE 0xD0 /* pressure (0-127), none */
#define MIDI_STATUS_PITCH_WHEEL_CONTROL 0xE0 /* LSB (0-127), MSB (0-127) */

// MIDI Message type
/** MIDI Message type */
#define MIDI_IS_CHANNEL_MESSAGE(status) ((status) >= MIDI_STATUS_NOTE_OFF && (status) < MIDI_STATUS_BIT)
#define MIDI_IS_SYSTEM_MESSAGE(status) ((status) >= MIDI_STATUS_BIT && (status) <= 0xFF)
#define MIDI_IS_OSC_MESSAGE(status) ((status) == '/' || (status) == '#')

// MIDI Channel message type
/** MIDI Channel message type */
#define MIDI_IS_STATUS_NOTE_OFF(status) (MIDI_IS_CHANNEL_MESSAGE(status) && ((status) & MIDI_STATUS_BIT) == MIDI_STATUS_NOTE_OFF)
#define MIDI_IS_STATUS_NOTE_ON(status) (MIDI_IS_CHANNEL_MESSAGE(status) && ((status) & MIDI_STATUS_BIT) == MIDI_STATUS_NOTE_ON)
#define MIDI_IS_STATUS_POLYPHONIC_AFTERTOUCH(status) (MIDI_IS_CHANNEL_MESSAGE(status) && ((status) & MIDI_STATUS_BIT) == MIDI_STATUS_POLYPHONIC_AFTERTOUCH)
@@ -49,79 +49,79 @@
#define MIDI_IS_STATUS_CHANNEL_PRESSURE(status) (MIDI_IS_CHANNEL_MESSAGE(status) && ((status) & MIDI_STATUS_BIT) == MIDI_STATUS_CHANNEL_PRESSURE)
#define MIDI_IS_STATUS_PITCH_WHEEL_CONTROL(status) (MIDI_IS_CHANNEL_MESSAGE(status) && ((status) & MIDI_STATUS_BIT) == MIDI_STATUS_PITCH_WHEEL_CONTROL)

// MIDI Utils
/** MIDI Utils */
#define MIDI_GET_STATUS_FROM_DATA(data) (MIDI_IS_CHANNEL_MESSAGE(data[0]) ? data[0] & MIDI_STATUS_BIT : data[0])
#define MIDI_GET_CHANNEL_FROM_DATA(data) (MIDI_IS_CHANNEL_MESSAGE(data[0]) ? data[0] & MIDI_CHANNEL_BIT : 0)

// 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
/** 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_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
@@ -151,4 +151,4 @@
#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_INCLUDED
#endif /* CARLA_MIDI_H_INCLUDED */

+ 49
- 49
source/modules/CarlaNative.h View File

@@ -40,70 +40,70 @@ typedef void* NativePluginHandle;
// enums

typedef enum {
PLUGIN_CATEGORY_NONE = 0, //!< Null plugin category.
PLUGIN_CATEGORY_SYNTH = 1, //!< A synthesizer or generator.
PLUGIN_CATEGORY_DELAY = 2, //!< A delay or reverberator.
PLUGIN_CATEGORY_EQ = 3, //!< An equalizer.
PLUGIN_CATEGORY_FILTER = 4, //!< A filter.
PLUGIN_CATEGORY_DISTORTION = 5, //!< A distortion plugin.
PLUGIN_CATEGORY_DYNAMICS = 6, //!< A 'dynamic' plugin (amplifier, compressor, gate, etc).
PLUGIN_CATEGORY_MODULATOR = 7, //!< A 'modulator' plugin (chorus, flanger, phaser, etc).
PLUGIN_CATEGORY_UTILITY = 8, //!< An 'utility' plugin (analyzer, converter, mixer, etc).
PLUGIN_CATEGORY_OTHER = 9 //!< Misc plugin (used to check if the plugin has a category).
NATIVE_PLUGIN_CATEGORY_NONE = 0, //!< Null plugin category.
NATIVE_PLUGIN_CATEGORY_SYNTH = 1, //!< A synthesizer or generator.
NATIVE_PLUGIN_CATEGORY_DELAY = 2, //!< A delay or reverberator.
NATIVE_PLUGIN_CATEGORY_EQ = 3, //!< An equalizer.
NATIVE_PLUGIN_CATEGORY_FILTER = 4, //!< A filter.
NATIVE_PLUGIN_CATEGORY_DISTORTION = 5, //!< A distortion plugin.
NATIVE_PLUGIN_CATEGORY_DYNAMICS = 6, //!< A 'dynamic' plugin (amplifier, compressor, gate, etc).
NATIVE_PLUGIN_CATEGORY_MODULATOR = 7, //!< A 'modulator' plugin (chorus, flanger, phaser, etc).
NATIVE_PLUGIN_CATEGORY_UTILITY = 8, //!< An 'utility' plugin (analyzer, converter, mixer, etc).
NATIVE_PLUGIN_CATEGORY_OTHER = 9 //!< Misc plugin (used to check if the plugin has a category).
} NativePluginCategory;

typedef enum {
PLUGIN_IS_RTSAFE = 1 << 0,
PLUGIN_IS_SYNTH = 1 << 1,
PLUGIN_HAS_UI = 1 << 2,
PLUGIN_NEEDS_FIXED_BUFFERS = 1 << 3,
PLUGIN_NEEDS_SINGLE_THREAD = 1 << 4,
PLUGIN_NEEDS_UI_OPEN_SAVE = 1 << 5,
PLUGIN_USES_MULTI_PROGS = 1 << 6, // has 1 patch per midi channel
PLUGIN_USES_PANNING = 1 << 7, // uses stereo balance if unset (default)
PLUGIN_USES_STATE = 1 << 8,
PLUGIN_USES_TIME = 1 << 9,
PLUGIN_USES_PARENT_ID = 1 << 10 // can set transient hint to parent
NATIVE_PLUGIN_IS_RTSAFE = 1 << 0,
NATIVE_PLUGIN_IS_SYNTH = 1 << 1,
NATIVE_PLUGIN_HAS_UI = 1 << 2,
NATIVE_PLUGIN_NEEDS_FIXED_BUFFERS = 1 << 3,
NATIVE_PLUGIN_NEEDS_SINGLE_THREAD = 1 << 4,
NATIVE_PLUGIN_NEEDS_UI_OPEN_SAVE = 1 << 5,
NATIVE_PLUGIN_USES_MULTI_PROGS = 1 << 6, // has 1 patch per midi channel
NATIVE_PLUGIN_USES_PANNING = 1 << 7, // uses stereo balance if unset (default)
NATIVE_PLUGIN_USES_STATE = 1 << 8,
NATIVE_PLUGIN_USES_TIME = 1 << 9,
NATIVE_PLUGIN_USES_PARENT_ID = 1 << 10 // can set transient hint to parent
} NativePluginHints;

typedef enum {
PLUGIN_SUPPORTS_PROGRAM_CHANGES = 1 << 0, // handles MIDI programs internally instead of host-exposed/exported
PLUGIN_SUPPORTS_CONTROL_CHANGES = 1 << 1,
PLUGIN_SUPPORTS_CHANNEL_PRESSURE = 1 << 2,
PLUGIN_SUPPORTS_NOTE_AFTERTOUCH = 1 << 3,
PLUGIN_SUPPORTS_PITCHBEND = 1 << 4,
PLUGIN_SUPPORTS_ALL_SOUND_OFF = 1 << 5,
PLUGIN_SUPPORTS_EVERYTHING = (1 << 6)-1
NATIVE_PLUGIN_SUPPORTS_PROGRAM_CHANGES = 1 << 0, // handles MIDI programs internally instead of host-exposed/exported
NATIVE_PLUGIN_SUPPORTS_CONTROL_CHANGES = 1 << 1,
NATIVE_PLUGIN_SUPPORTS_CHANNEL_PRESSURE = 1 << 2,
NATIVE_PLUGIN_SUPPORTS_NOTE_AFTERTOUCH = 1 << 3,
NATIVE_PLUGIN_SUPPORTS_PITCHBEND = 1 << 4,
NATIVE_PLUGIN_SUPPORTS_ALL_SOUND_OFF = 1 << 5,
NATIVE_PLUGIN_SUPPORTS_EVERYTHING = (1 << 6)-1
} NativePluginSupports;

typedef enum {
PARAMETER_IS_OUTPUT = 1 << 0,
PARAMETER_IS_ENABLED = 1 << 1,
PARAMETER_IS_AUTOMABLE = 1 << 2,
PARAMETER_IS_BOOLEAN = 1 << 3,
PARAMETER_IS_INTEGER = 1 << 4,
PARAMETER_IS_LOGARITHMIC = 1 << 5,
PARAMETER_USES_SAMPLE_RATE = 1 << 6,
PARAMETER_USES_SCALEPOINTS = 1 << 7,
PARAMETER_USES_CUSTOM_TEXT = 1 << 8
NATIVE_PARAMETER_IS_OUTPUT = 1 << 0,
NATIVE_PARAMETER_IS_ENABLED = 1 << 1,
NATIVE_PARAMETER_IS_AUTOMABLE = 1 << 2,
NATIVE_PARAMETER_IS_BOOLEAN = 1 << 3,
NATIVE_PARAMETER_IS_INTEGER = 1 << 4,
NATIVE_PARAMETER_IS_LOGARITHMIC = 1 << 5,
NATIVE_PARAMETER_USES_SAMPLE_RATE = 1 << 6,
NATIVE_PARAMETER_USES_SCALEPOINTS = 1 << 7,
NATIVE_PARAMETER_USES_CUSTOM_TEXT = 1 << 8
} NativeParameterHints;

typedef enum {
PLUGIN_OPCODE_NULL = 0, // nothing
PLUGIN_OPCODE_BUFFER_SIZE_CHANGED = 1, // uses value
PLUGIN_OPCODE_SAMPLE_RATE_CHANGED = 2, // uses opt
PLUGIN_OPCODE_OFFLINE_CHANGED = 3, // uses value (0=off, 1=on)
PLUGIN_OPCODE_UI_NAME_CHANGED = 4 // uses ptr
NATIVE_PLUGIN_OPCODE_NULL = 0, // nothing
NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED = 1, // uses value
NATIVE_PLUGIN_OPCODE_SAMPLE_RATE_CHANGED = 2, // uses opt
NATIVE_PLUGIN_OPCODE_OFFLINE_CHANGED = 3, // uses value (0=off, 1=on)
NATIVE_PLUGIN_OPCODE_UI_NAME_CHANGED = 4 // uses ptr
} NativePluginDispatcherOpcode;

typedef enum {
HOST_OPCODE_NULL = 0, // nothing
HOST_OPCODE_UPDATE_PARAMETER = 1, // uses index, -1 for all
HOST_OPCODE_UPDATE_MIDI_PROGRAM = 2, // uses index, -1 for all; may use value for channel
HOST_OPCODE_RELOAD_PARAMETERS = 3, // nothing
HOST_OPCODE_RELOAD_MIDI_PROGRAMS = 4, // nothing
HOST_OPCODE_RELOAD_ALL = 5, // nothing
HOST_OPCODE_UI_UNAVAILABLE = 6 // nothing
NATIVE_HOST_OPCODE_NULL = 0, // nothing
NATIVE_HOST_OPCODE_UPDATE_PARAMETER = 1, // uses index, -1 for all
NATIVE_HOST_OPCODE_UPDATE_MIDI_PROGRAM = 2, // uses index, -1 for all; may use value for channel
NATIVE_HOST_OPCODE_RELOAD_PARAMETERS = 3, // nothing
NATIVE_HOST_OPCODE_RELOAD_MIDI_PROGRAMS = 4, // nothing
NATIVE_HOST_OPCODE_RELOAD_ALL = 5, // nothing
NATIVE_HOST_OPCODE_UI_UNAVAILABLE = 6 // nothing
} NativeHostDispatcherOpcode;

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


+ 2
- 2
source/tests/CarlaUtils2.cpp View File

@@ -70,12 +70,12 @@ static void test_CarlaLv2Utils()
lv2World.initIfNeeded(std::getenv("LV2_PATH"));

// getPlugin
const LilvPlugin* const plugin(lv2World.getPlugin("urn:juced:DrumSynth"));
const LilvPlugin* const plugin(lv2World.getPluginFromURI("urn:juced:DrumSynth"));
CARLA_SAFE_ASSERT(plugin != nullptr);

// getState
LV2_URID_Map uridMap = { nullptr, test_lv2_uridMap };
LilvState* const state(lv2World.getState("http://arcticanaudio.com/plugins/thefunction#preset001", &uridMap));
LilvState* const state(lv2World.getStateFromURI("http://arcticanaudio.com/plugins/thefunction#preset001", &uridMap));
CARLA_SAFE_ASSERT(state != nullptr);
if (state != nullptr) lilv_state_free(state);



+ 1
- 0
source/tests/CarlaUtils3.cpp View File

@@ -116,6 +116,7 @@ static void test_CarlaLibUtils() noexcept

static void test_CarlaOscUtils() noexcept
{
// nothing for now
}

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


+ 19
- 15
source/tests/Exceptions.cpp View File

@@ -16,23 +16,27 @@
*/

#include "CarlaDefines.h"
#include "CarlaUtils.hpp"
#include "CarlaJuceUtils.hpp"

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

struct Struct1 {
Struct1() noexcept {}
Struct1() noexcept : leakDetector_Struct1() {}
~Struct1() noexcept {}

void throwHere()
{
throw 1;
}

CARLA_LEAK_DETECTOR(Struct1)
};

struct Struct2 {
Struct2() { throw 2; }
Struct2() : leakDetector_Struct2() { throw 2; }
~Struct2() noexcept {}

CARLA_LEAK_DETECTOR(Struct2)
};

// -----------------------------------------------------------------------
@@ -41,32 +45,32 @@ int main()
{
carla_safe_assert("test here", __FILE__, __LINE__);

Struct1 a;
Struct1* b;
Struct2* c = nullptr;
Struct1 a1;
Struct1* b1;
Struct2* c2 = nullptr;

try {
a.throwHere();
a1.throwHere();
} CARLA_SAFE_EXCEPTION("Struct1 a throw");

try {
b = new Struct1;
} CARLA_SAFE_EXCEPTION("Struct1 b throw constructor");
b1 = new Struct1;
} CARLA_SAFE_EXCEPTION("NOT POSSIBLE! Struct1 b throw constructor");

assert(b != nullptr);
assert(b1 != nullptr);

try {
b->throwHere();
b1->throwHere();
} CARLA_SAFE_EXCEPTION("Struct1 b throw runtime");

delete b;
b = nullptr;
delete b1;
b1 = nullptr;

try {
c = new Struct2;
c2 = new Struct2;
} CARLA_SAFE_EXCEPTION("Struct2 c throw");

assert(c == nullptr);
assert(c2 == nullptr);

return 0;
}


+ 25
- 15
source/tests/Makefile View File

@@ -44,29 +44,39 @@ endif

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

TARGETS = ansi-pedantic-test_c ansi-pedantic-test_c99
TARGETS += CarlaRingBuffer CarlaString
TARGETS += CarlaUtils1 CarlaUtils2 CarlaUtils3 CarlaUtils4
TARGETS += Exceptions Print RDF

# ansi-pedantic-test_cxx ansi-pedantic-test_cxx11
# TARGETS += EngineEvents PipeServer RtLinkedList RtLinkedListGnu
TARGETS = ansi-pedantic-test_c89
TARGETS += ansi-pedantic-test_c99
TARGETS += ansi-pedantic-test_c11
TARGETS += ansi-pedantic-test_cxx03
TARGETS += ansi-pedantic-test_cxx11
TARGETS += CarlaRingBuffer
TARGETS += CarlaString
TARGETS += CarlaUtils1
TARGETS += CarlaUtils2
TARGETS += CarlaUtils3
TARGETS += CarlaUtils4
TARGETS += Exceptions
TARGETS += Print
TARGETS += RDF

all: $(TARGETS)

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

ansi-pedantic-test_c: ansi-pedantic-test.c ../backend/Carla*.h
$(CC) $< $(ANSI_FLAGS) -Wc++-compat -o $@
ansi-pedantic-test_c89: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
$(CC) $< $(ANSI_FLAGS) -std=c89 -pedantic -pedantic-errors -Wc++-compat -L../../bin -lcarla_standalone2 -o $@

ansi-pedantic-test_c99: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
$(CC) $< $(ANSI_FLAGS) -std=c99 -pedantic -pedantic-errors -Wc++-compat -L../../bin -lcarla_standalone2 -o $@

ansi-pedantic-test_c99: ansi-pedantic-test.c ../backend/Carla*.h
$(CC) $< $(ANSI_FLAGS) -std=c99 -pedantic -pedantic-errors -Wc++-compat -o $@
ansi-pedantic-test_c11: ansi-pedantic-test.c ../backend/Carla*.h ../includes/*.h
$(CC) $< $(ANSI_FLAGS) -std=c11 -pedantic -pedantic-errors -Wc++-compat -L../../bin -lcarla_standalone2 -o $@

ansi-pedantic-test_cxx: ansi-pedantic-test.cpp ../backend/Carla*.h
$(CXX) $< $(ANSI_FLAGS) -o $@
ansi-pedantic-test_cxx03: ansi-pedantic-test.cpp ../backend/Carla*.h ../includes/*.h
$(CXX) $< $(ANSI_FLAGS) -std=c++11 -pedantic -pedantic-errors -L../../bin -lcarla_standalone2 -o $@

ansi-pedantic-test_cxx11: ansi-pedantic-test.cpp ../backend/Carla*.h
$(CXX) $< $(ANSI_FLAGS) -std=c++11 -pedantic -pedantic-errors -o $@
ansi-pedantic-test_cxx11: ansi-pedantic-test.cpp ../backend/Carla*.h ../includes/*.h
$(CXX) $< $(ANSI_FLAGS) -std=c++11 -pedantic -pedantic-errors -L../../bin -lcarla_standalone2 -o $@

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



+ 16
- 0
source/tests/Print.cpp View File

@@ -17,6 +17,8 @@

#include "CarlaUtils.hpp"

#include <cstdint>

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

int main()
@@ -25,6 +27,20 @@ int main()
carla_stdout("STDOUT");
carla_stderr("STDERR");
carla_stderr2("STDERR2");

carla_stdout("char %c", (char)'0');
carla_stdout("int %i", (int)0);
carla_stdout("uint %u", (uint)0);
carla_stdout("long %li", (long)0);
carla_stdout("ulong %lu", (ulong)0);
carla_stdout("float %.0f", 0.0f);
carla_stdout("double %g", 0.0);
carla_stdout("int64 " P_INT64, (int64_t)0);
carla_stdout("uint64 " P_UINT64, (uint64_t)0);
carla_stdout("intptr " P_INTPTR, (intptr_t)0);
carla_stdout("uintptr " P_UINTPTR, (uintptr_t)0);
carla_stdout("size " P_SIZE, (size_t)0);
carla_stdout("std::size " P_SIZE, (std::size_t)0);
return 0;
}



+ 21
- 0
source/tests/RDF.cpp View File

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

#ifdef NDEBUG
# error Build this file with debug ON please
#endif

#include "ladspa_rdf.hpp"
#include "lv2_rdf.hpp"

@@ -34,6 +38,7 @@ int main()
port2.Label = carla_strdup("");
port3.Label = carla_strdup("");
port3.ScalePoints = new LADSPA_RDF_ScalePoint[2];
assert(port3.ScalePoints[0].Label == nullptr);
port3.ScalePoints[0].Label = carla_strdup("");
port3.ScalePoints[1].Label = carla_strdup("");

@@ -43,6 +48,7 @@ int main()
desc2.Creator = carla_strdup("");
desc3.Creator = carla_strdup("");
desc3.Ports = new LADSPA_RDF_Port[1];
assert(desc3.Ports[0].Label == nullptr);
desc3.Ports[0].Label = carla_strdup("");
desc3.Ports[0].ScalePoints = new LADSPA_RDF_ScalePoint[1];
desc3.Ports[0].ScalePoints[0].Label = carla_strdup("");
@@ -54,14 +60,17 @@ int main()
LV2_RDF_PortPoints portPoints;

LV2_RDF_PortUnit portUnit1, portUnit2;
assert(portUnit1.Name == nullptr);
portUnit2.Name = carla_strdup("");
portUnit2.Render = carla_strdup("");
portUnit2.Symbol = carla_strdup("");

LV2_RDF_PortScalePoint portScalePoint1, portScalePoint2;
assert(portScalePoint1.Label == nullptr);
portScalePoint2.Label = carla_strdup("");

LV2_RDF_Port port1, port2, port3;
assert(port1.Name == nullptr);
port2.Name = carla_strdup("");
port3.Name = carla_strdup("");
port2.Symbol = carla_strdup("");
@@ -70,17 +79,21 @@ int main()
port3.Unit.Render = carla_strdup("");
port3.Unit.Symbol = carla_strdup("");
port3.ScalePoints = new LV2_RDF_PortScalePoint[2];
assert(port3.ScalePoints[0].Label == nullptr);
port3.ScalePoints[0].Label = carla_strdup("");
port3.ScalePoints[1].Label = carla_strdup("");

LV2_RDF_Preset preset1, preset2;
assert(preset1.Label == nullptr);
preset2.URI = carla_strdup("");
preset2.Label = carla_strdup("");

LV2_RDF_Feature feat1, feat2;
assert(feat1.URI == nullptr);
feat2.URI = carla_strdup("");

LV2_RDF_UI ui1, ui2, ui3;
assert(ui1.Binary == nullptr);
ui2.URI = carla_strdup("");
ui3.URI = carla_strdup("");
ui2.Binary = carla_strdup("");
@@ -88,6 +101,7 @@ int main()
ui2.Bundle = carla_strdup("");
ui3.Bundle = carla_strdup("");
ui3.Features = new LV2_RDF_Feature[1];
assert(ui3.Features[0].URI == nullptr);
ui3.Features[0].URI = carla_strdup("");
ui3.Extensions = new LV2_URI[3];
ui3.Extensions[0] = carla_strdup("");
@@ -96,6 +110,7 @@ int main()
ui3.ExtensionCount = 3;

LV2_RDF_Descriptor desc1, desc2, desc3;
assert(desc1.URI == nullptr);
desc2.URI = carla_strdup("");
desc3.URI = carla_strdup("");
desc2.Name = carla_strdup("");
@@ -109,17 +124,21 @@ int main()
desc2.Bundle = carla_strdup("");
desc3.Bundle = carla_strdup("");
desc3.Ports = new LV2_RDF_Port[1];
assert(desc3.Ports[0].Name == nullptr);
desc3.Ports[0].Name = carla_strdup("");
desc3.Ports[0].Symbol = carla_strdup("");
desc3.Ports[0].Unit.Name = carla_strdup("");
desc3.Ports[0].Unit.Render = carla_strdup("");
desc3.Ports[0].Unit.Symbol = carla_strdup("");
desc3.Ports[0].ScalePoints = new LV2_RDF_PortScalePoint[1];
assert(desc3.Ports[0].ScalePoints[0].Label == nullptr);
desc3.Ports[0].ScalePoints[0].Label = carla_strdup("");
desc3.Presets = new LV2_RDF_Preset[1];
assert(desc3.Presets[0].URI == nullptr);
desc3.Presets[0].URI = carla_strdup("");
desc3.Presets[0].Label = carla_strdup("");
desc3.Features = new LV2_RDF_Feature[1];
assert(desc3.Features[0].URI == nullptr);
desc3.Features[0].URI = carla_strdup("");
desc3.Extensions = new LV2_URI[3];
desc3.Extensions[0] = carla_strdup("");
@@ -127,10 +146,12 @@ int main()
desc3.Extensions[2] = carla_strdup("");
desc3.ExtensionCount = 3;
desc3.UIs = new LV2_RDF_UI[1];
assert(desc3.UIs[0].URI == nullptr);
desc3.UIs[0].URI = carla_strdup("");
desc3.UIs[0].Binary = carla_strdup("");
desc3.UIs[0].Bundle = carla_strdup("");
desc3.UIs[0].Features = new LV2_RDF_Feature[1];
assert(desc3.UIs[0].Features[0].URI == nullptr);
desc3.UIs[0].Features[0].URI = carla_strdup("");
desc3.UIs[0].Extensions = new LV2_URI[3];
desc3.UIs[0].Extensions[0] = carla_strdup("");


+ 9
- 6
source/tests/ansi-pedantic-test.c View File

@@ -17,15 +17,20 @@

#include "CarlaBackend.h"
#include "CarlaHost.h"
#include <stdio.h>
#include "CarlaNative.h"
#include "CarlaMIDI.h"

#ifdef __cplusplus
CARLA_BACKEND_USE_NAMESPACE
# include "CarlaEngine.hpp"
# include "CarlaPlugin.hpp"
# include <cstdio>
# ifdef CARLA_PROPER_CPP11_SUPPORT
# undef NULL
# define NULL nullptr
# endif
CARLA_BACKEND_USE_NAMESPACE
#else
# include <stdio.h>
#endif

int main(int argc, char* argv[])
@@ -37,13 +42,12 @@ int main(int argc, char* argv[])
EngineDriverDeviceInfo e;

CarlaPluginInfo f;
CarlaNativePluginInfo g;
CarlaCachedPluginInfo g;
CarlaPortCountInfo h;
CarlaParameterInfo i;
CarlaScalePointInfo j;
CarlaTransportInfo k;

#if 0
const char* licenseText;
const char* fileExtensions;

@@ -92,7 +96,6 @@ int main(int argc, char* argv[])

carla_engine_close();
}
#endif

return 0;



+ 25
- 0
source/tests/jack-enum-test/Makefile View File

@@ -0,0 +1,25 @@
#!/usr/bin/make -f
# Makefile for carla tests #
# ------------------------ #
# Created by falkTX
#

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

CXX ?= g++

BUILD_FLAGS = -Wall -Wextra -Werror -pipe -DDEBUG -O0 -g

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

all: test

test: jack-enum-test-func.cpp jack-enum-test-main.cpp
$(CXX) $^ $(BUILD_FLAGS) -o $@

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

clean:
rm -f test

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

+ 82
- 0
source/tests/jack-enum-test/jack-enum-test-func.cpp View File

@@ -0,0 +1,82 @@
/*
* Carla Tests
* Copyright (C) 2014 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.
*/

#include <stdint.h>

#define PRE_PACKED_STRUCTURE
#define POST_PACKED_STRUCTURE __attribute__((__packed__))

extern "C" {

enum JackTransportState {
JackTransportStopped = 0,
JackTransportRolling = 1,
JackTransportLooping = 2,
JackTransportStarting = 3
};

enum JackPositionBits {
JackPositionBBT = 0x010,
JackPositionTimecode = 0x020,
JackBBTFrameOffset = 0x040,
JackAudioVideoRatio = 0x080,
JackVideoFrameOffset = 0x100
};

typedef uint32_t jack_nframes_t;
typedef uint64_t jack_time_t;
typedef uint64_t jack_unique_t;

typedef enum JackTransportState jack_transport_state_t;
typedef enum JackPositionBits jack_position_bits_t;

PRE_PACKED_STRUCTURE
struct _jack_position {
jack_unique_t unique_1;
jack_time_t usecs;
jack_nframes_t frame_rate;
jack_nframes_t frame;
jack_position_bits_t valid;
int32_t bar;
int32_t beat;
int32_t tick;
double bar_start_tick;
float beats_per_bar;
float beat_type;
double ticks_per_beat;
double beats_per_minute;
double frame_time;
double next_time;
jack_nframes_t bbt_offset;
float audio_frames_per_video_frame;
jack_nframes_t video_offset;
int32_t padding[7];
jack_unique_t unique_2;
} POST_PACKED_STRUCTURE;

typedef struct _jack_client jack_client_t;
typedef struct _jack_position jack_position_t;

jack_transport_state_t jackbridge_transport_query(const jack_client_t*, jack_position_t*);

}

void testcall()
{
const jack_transport_state_t state = jackbridge_transport_query(0, 0);

return; // unused
(void)state;
}

+ 36
- 0
source/tests/jack-enum-test/jack-enum-test-main.cpp View File

@@ -0,0 +1,36 @@
/*
* Carla Tests
* Copyright (C) 2014 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.
*/

#include <jack/jack.h>
#include <jack/transport.h>

extern "C" {

jack_transport_state_t jackbridge_transport_query(const jack_client_t*, jack_position_t*);

}

jack_transport_state_t jackbridge_transport_query(const jack_client_t*, jack_position_t*)
{
return JackTransportStopped;
}

extern void testcall();

int main()
{
testcall();
return 0;
}

Loading…
Cancel
Save