| @@ -26,106 +26,93 @@ extern "C" { | |||||
| #include <stddef.h> | #include <stddef.h> | ||||
| #include <stdint.h> | #include <stdint.h> | ||||
| // --------------------------------------------------------------------------------------- | |||||
| // Plugin Categories | |||||
| #define PLUGIN_CATEGORY_SYNTH ":synth" //!< A synthesizer or generator. | |||||
| #define PLUGIN_CATEGORY_DELAY ":delay" //!< A delay or reverberator. | |||||
| #define PLUGIN_CATEGORY_EQ ":eq" //!< An equalizer. | |||||
| #define PLUGIN_CATEGORY_FILTER ":filter" //!< A filter. | |||||
| #define PLUGIN_CATEGORY_DYNAMICS ":dynamics" //!< A 'dynamic' plugin (amplifier, compressor, gate, etc). | |||||
| #define PLUGIN_CATEGORY_MODULATOR ":modulator" //!< A 'modulator' plugin (chorus, flanger, phaser, etc). | |||||
| #define PLUGIN_CATEGORY_UTILITY ":utility" //!< An 'utility' plugin (analyzer, converter, mixer, etc). | |||||
| #define PLUGIN_CATEGORY_OTHER ":other" //!< Misc plugin (used to check if the plugin has a category). | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Plugin Features | |||||
| #define PLUGIN_FEATURE_RTSAFE ":rtsafe" | |||||
| #define PLUGIN_FEATURE_FIXED_BUFFERS ":fixedbuffers" | |||||
| #define PLUGIN_FEATURE_BUFFER_SIZE_CHANGES ":buffersizechanges" | |||||
| #define PLUGIN_FEATURE_SAMPLE_RATE_CHANGES ":sampleratechanges" | |||||
| #define PLUGIN_FEATURE_MONO_PANNING ":monopanning" | |||||
| #define PLUGIN_FEATURE_STEREO_BALANCE ":stereobalance" | |||||
| #define PLUGIN_FEATURE_STATE ":state" | |||||
| #define PLUGIN_FEATURE_TIME ":time" | |||||
| #define PLUGIN_FEATURE_WRITE_EVENT ":writeevent" | |||||
| #define PLUGIN_FEATURE_OPEN_SAVE ":uiopensave" | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Plugin Supports | |||||
| #define PLUGIN_SUPPORTS_PROGRAM_CHANGES ":program" | |||||
| #define PLUGIN_SUPPORTS_CONTROL_CHANGES ":control" | |||||
| #define PLUGIN_SUPPORTS_CHANNEL_PRESSURE ":pressure" | |||||
| #define PLUGIN_SUPPORTS_NOTE_AFTERTOUCH ":aftertouch" | |||||
| #define PLUGIN_SUPPORTS_PITCHBEND ":pitchbend" | |||||
| #define PLUGIN_SUPPORTS_ALL_SOUND_OFF ":allsoundoff" | |||||
| #define PLUGIN_SUPPORTS_EVERYTHING ":control:pressure:aftertouch:pitchbend:allsoundoff:" | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Parameter Hints | |||||
| #define PARAMETER_IS_OUTPUT ":output" | |||||
| #define PARAMETER_IS_ENABLED ":enabled" | |||||
| #define PARAMETER_IS_AUTOMABLE ":rtsafe" | |||||
| #define PARAMETER_IS_BOOLEAN ":boolean" | |||||
| #define PARAMETER_IS_INTEGER ":integer" | |||||
| #define PARAMETER_IS_LOGARITHMIC ":logarithmic" | |||||
| #define PARAMETER_USES_SAMPLE_RATE ":samplerate" | |||||
| #define PARAMETER_USES_SCALEPOINTS ":scalepoints" | |||||
| #define PARAMETER_USES_CUSTOM_TEXT ":customtext" | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Default Parameter Ranges | |||||
| #define PARAMETER_RANGE_DEFAULT_STEP 0.01f | |||||
| #define PARAMETER_RANGE_DEFAULT_STEP_SMALL 0.0001f | |||||
| #define PARAMETER_RANGE_DEFAULT_STEP_LARGE 0.1f | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Event Types | |||||
| #define EVENT_TYPE_MIDI "midi" | |||||
| #define EVENT_TYPE_MIDI_PROGRAM "midiprogram" | |||||
| #define EVENT_TYPE_PARAMETER "parameter" | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Host Dispatcher Opcodes | |||||
| #define HOST_OPCODE_SET_VOLUME "setVolume" //!< Set host's volume, uses opt. | |||||
| #define HOST_OPCODE_SET_DRYWET "setDryWet" //!< Set host's dry-wet, uses opt. | |||||
| #define HOST_OPCODE_SET_BALANCE_LEFT "setBalanceLeft" //!< Set host's balance-left, uses opt. | |||||
| #define HOST_OPCODE_SET_BALANCE_RIGHT "setBalanceRight" //!< Set host's balance-right, uses opt. | |||||
| #define HOST_OPCODE_SET_PANNING "setPanning" //!< Set host's panning, uses opt. | |||||
| #define HOST_OPCODE_GET_PARAMETER_MIDI_CC "getParameterMidiCC" //!< Get the parameter @a index currently mapped MIDI control, uses index, return answer. | |||||
| #define HOST_OPCODE_SET_PARAMETER_MIDI_CC "setParameterMidiCC" //!< Set the parameter @a index mapped MIDI control, uses index and value. | |||||
| #define HOST_OPCODE_UPDATE_PARAMETER "updateParameter" //!< Tell the host to update parameter @a index, uses index with -1 for all. | |||||
| #define HOST_OPCODE_UPDATE_MIDI_PROGRAM "updateMidiProgram" //!< Tell the host to update midi-program @a index, uses index with -1 for all; may also use value for channel. | |||||
| #define HOST_OPCODE_RELOAD_PARAMETERS "reloadParameters" //!< Tell the host to reload all parameters data, uses nothing. | |||||
| #define HOST_OPCODE_RELOAD_MIDI_PROGRAMS "reloadMidiPrograms" //!< Tell the host to reload all midi-programs data, uses nothing. | |||||
| #define HOST_OPCODE_RELOAD_ALL "reloadAll" //!< Tell the host to reload everything all the plugin, uses nothing. | |||||
| #define HOST_OPCODE_UI_UNAVAILABLE "uiUnavailable" //!< Tell the host the UI can't be shown, uses nothing. | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Plugin Dispatcher Opcodes | |||||
| #define PLUGIN_OPCODE_BUFFER_SIZE_CHANGED "bufferSizeChanged" //!< Audio buffer size changed, uses value. | |||||
| #define PLUGIN_OPCODE_SAMPLE_RATE_CHANGED "sampleRateChanged" //!< Audio sample rate changed, uses opt. | |||||
| #define PLUGIN_OPCODE_OFFLINE_CHANGED "offlineChanged" //!< Offline mode changed, uses value (0=off, 1=on). | |||||
| #define PLUGIN_OPCODE_UI_TITLE_CHANGED "uiTitleChanged" //!< UI title changed, uses ptr. | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Base types | |||||
| typedef float audio_sample_t; | |||||
| typedef uint32_t mapped_value_t; | |||||
| /*! | |||||
| * @defgroup CarlaNativeAPI Carla Native API | |||||
| * | |||||
| * The Carla Native API | |||||
| * @{ | |||||
| */ | |||||
| typedef void* PluginHandle; | |||||
| typedef void* HostHandle; | typedef void* HostHandle; | ||||
| typedef void* PluginHandle; | |||||
| // ----------------------------------------------------------------------- | |||||
| // 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_DYNAMICS = 5, //!< A 'dynamic' plugin (amplifier, compressor, gate, etc). | |||||
| PLUGIN_CATEGORY_MODULATOR = 6, //!< A 'modulator' plugin (chorus, flanger, phaser, etc). | |||||
| PLUGIN_CATEGORY_UTILITY = 7, //!< An 'utility' plugin (analyzer, converter, mixer, etc). | |||||
| PLUGIN_CATEGORY_OTHER = 8 //!< Misc plugin (used to check if the plugin has a category). | |||||
| } PluginCategory; | |||||
| typedef enum { | |||||
| PLUGIN_IS_RTSAFE = 1 << 0, | |||||
| PLUGIN_IS_SYNTH = 1 << 1, | |||||
| PLUGIN_HAS_GUI = 1 << 2, | |||||
| PLUGIN_NEEDS_FIXED_BUFFERS = 1 << 3, | |||||
| PLUGIN_NEEDS_SINGLE_THREAD = 1 << 4, | |||||
| PLUGIN_NEEDS_UI_OPEN_SAVE = 1 << 5, | |||||
| PLUGIN_USES_PANNING = 1 << 6, // uses stereo balance if unset (default) | |||||
| PLUGIN_USES_STATE = 1 << 7, | |||||
| PLUGIN_USES_TIME = 1 << 8 | |||||
| } PluginHints; | |||||
| 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 | |||||
| } PluginSupports; | |||||
| 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 | |||||
| } ParameterHints; | |||||
| 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 | |||||
| } PluginDispatcherOpcode; | |||||
| typedef enum { | |||||
| HOST_OPCODE_NULL = 0, // nothing | |||||
| HOST_OPCODE_SET_VOLUME = 1, // uses opt | |||||
| HOST_OPCODE_SET_DRYWET = 2, // uses opt | |||||
| HOST_OPCODE_SET_BALANCE_LEFT = 3, // uses opt | |||||
| HOST_OPCODE_SET_BALANCE_RIGHT = 4, // uses opt | |||||
| HOST_OPCODE_SET_PANNING = 5, // uses opt | |||||
| HOST_OPCODE_GET_PARAMETER_MIDI_CC = 6, // uses index; return answer | |||||
| HOST_OPCODE_SET_PARAMETER_MIDI_CC = 7, // uses index and value | |||||
| HOST_OPCODE_SET_PROCESS_PRECISION = 8, // uses value | |||||
| HOST_OPCODE_UPDATE_PARAMETER = 9, // uses index, -1 for all | |||||
| HOST_OPCODE_UPDATE_MIDI_PROGRAM = 10, // uses index, -1 for all; may use value for channel | |||||
| HOST_OPCODE_RELOAD_PARAMETERS = 11, // nothing | |||||
| HOST_OPCODE_RELOAD_MIDI_PROGRAMS = 12, // nothing | |||||
| HOST_OPCODE_RELOAD_ALL = 13, // nothing | |||||
| HOST_OPCODE_UI_UNAVAILABLE = 14 // nothing | |||||
| } HostDispatcherOpcode; | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Base structs | |||||
| // ----------------------------------------------------------------------- | |||||
| // base structs | |||||
| typedef struct { | typedef struct { | ||||
| const char* label; | const char* label; | ||||
| @@ -141,8 +128,12 @@ typedef struct { | |||||
| float stepLarge; | float stepLarge; | ||||
| } ParameterRanges; | } ParameterRanges; | ||||
| #define PARAMETER_RANGES_DEFAULT_STEP 0.01f | |||||
| #define PARAMETER_RANGES_DEFAULT_STEP_SMALL 0.0001f | |||||
| #define PARAMETER_RANGES_DEFAULT_STEP_LARGE 0.1f | |||||
| typedef struct { | typedef struct { | ||||
| const char* hints; | |||||
| ParameterHints hints; | |||||
| const char* name; | const char* name; | ||||
| const char* unit; | const char* unit; | ||||
| ParameterRanges ranges; | ParameterRanges ranges; | ||||
| @@ -152,41 +143,17 @@ typedef struct { | |||||
| } Parameter; | } Parameter; | ||||
| typedef struct { | typedef struct { | ||||
| uint32_t bank; | |||||
| uint32_t program; | |||||
| const char* name; | |||||
| } MidiProgram; | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Events | |||||
| typedef struct { | |||||
| mapped_value_t type; | |||||
| uint32_t frame; | |||||
| } Event; | |||||
| typedef struct { | |||||
| Event e; | |||||
| uint32_t port; | |||||
| uint32_t size; | |||||
| uint8_t port; | |||||
| uint32_t time; | |||||
| uint8_t data[4]; | uint8_t data[4]; | ||||
| uint8_t size; | |||||
| } MidiEvent; | } MidiEvent; | ||||
| typedef struct { | typedef struct { | ||||
| Event e; | |||||
| uint32_t channel; // used only in synths | |||||
| uint32_t bank; | uint32_t bank; | ||||
| uint32_t program; | uint32_t program; | ||||
| } MidiProgramEvent; | |||||
| typedef struct { | |||||
| Event e; | |||||
| uint32_t index; | |||||
| float value; | |||||
| } ParameterEvent; | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // Time | |||||
| const char* name; | |||||
| } MidiProgram; | |||||
| typedef struct { | typedef struct { | ||||
| bool valid; | bool valid; | ||||
| @@ -210,57 +177,52 @@ typedef struct { | |||||
| TimeInfoBBT bbt; | TimeInfoBBT bbt; | ||||
| } TimeInfo; | } TimeInfo; | ||||
| // --------------------------------------------------------------------------------------- | |||||
| // PluginHostDescriptor | |||||
| // ----------------------------------------------------------------------- | |||||
| // HostDescriptor | |||||
| typedef struct { | typedef struct { | ||||
| HostHandle handle; | HostHandle handle; | ||||
| const char* resourceDir; | const char* resourceDir; | ||||
| const char* uiTitle; | |||||
| uint32_t bufferSize; | |||||
| uint32_t sampleRate; | |||||
| bool isOffline; | |||||
| const char* uiName; | |||||
| mapped_value_t (*map_value)(HostHandle handle, const char* valueStr); | |||||
| const char* (*unmap_value)(HostHandle handle, mapped_value_t value); | |||||
| uint32_t (*get_buffer_size)(HostHandle handle); | |||||
| double (*get_sample_rate)(HostHandle handle); | |||||
| bool (*is_offline)(HostHandle handle); | |||||
| const TimeInfo* (*get_time_info)(HostHandle handle); | const TimeInfo* (*get_time_info)(HostHandle handle); | ||||
| bool (*write_event)(HostHandle handle, const Event* event); | |||||
| bool (*write_midi_event)(HostHandle handle, const MidiEvent* event); | |||||
| void (*ui_parameter_changed)(HostHandle handle, uint32_t index, float value); | void (*ui_parameter_changed)(HostHandle handle, uint32_t index, float value); | ||||
| void (*ui_midi_program_changed)(HostHandle handle, uint8_t channel, uint32_t bank, uint32_t program); | void (*ui_midi_program_changed)(HostHandle handle, uint8_t channel, uint32_t bank, uint32_t program); | ||||
| void (*ui_custom_data_changed)(HostHandle handle, const char* key, const char* value); | |||||
| void (*ui_closed)(HostHandle handle); | void (*ui_closed)(HostHandle handle); | ||||
| // TODO: add some msgbox call | |||||
| const char* (*ui_open_file)(HostHandle handle, bool isDir, const char* title, const char* filter); | const char* (*ui_open_file)(HostHandle handle, bool isDir, const char* title, const char* filter); | ||||
| const char* (*ui_save_file)(HostHandle handle, bool isDir, const char* title, const char* filter); | const char* (*ui_save_file)(HostHandle handle, bool isDir, const char* title, const char* filter); | ||||
| intptr_t (*dispatcher)(HostHandle handle, mapped_value_t opcode, int32_t index, intptr_t value, void* ptr, float opt); | |||||
| intptr_t (*dispatcher)(HostHandle handle, HostDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt); | |||||
| } PluginHostDescriptor; | |||||
| } HostDescriptor; | |||||
| // --------------------------------------------------------------------------------------- | |||||
| // ----------------------------------------------------------------------- | |||||
| // PluginDescriptor | // PluginDescriptor | ||||
| typedef struct { | |||||
| const char* const categories; | |||||
| const char* const features; | |||||
| const char* const supports; | |||||
| typedef struct _PluginDescriptor { | |||||
| const PluginCategory category; | |||||
| const PluginHints hints; | |||||
| const PluginSupports supports; | |||||
| const uint32_t audioIns; | const uint32_t audioIns; | ||||
| const uint32_t audioOuts; | const uint32_t audioOuts; | ||||
| const uint32_t midiIns; | const uint32_t midiIns; | ||||
| const uint32_t midiOuts; | const uint32_t midiOuts; | ||||
| const uint32_t paramIns; | const uint32_t paramIns; | ||||
| const uint32_t paramOuts; | const uint32_t paramOuts; | ||||
| const char* const author; | |||||
| const char* const name; | const char* const name; | ||||
| const char* const label; | const char* const label; | ||||
| const char* const maker; | |||||
| const char* const copyright; | const char* const copyright; | ||||
| const char* const version; | |||||
| PluginHandle (*instantiate)(const PluginHostDescriptor* host); | |||||
| PluginHandle (*instantiate)(const HostDescriptor* host); | |||||
| void (*cleanup)(PluginHandle handle); | void (*cleanup)(PluginHandle handle); | ||||
| uint32_t (*get_parameter_count)(PluginHandle handle); | uint32_t (*get_parameter_count)(PluginHandle handle); | ||||
| @@ -271,20 +233,25 @@ typedef struct { | |||||
| uint32_t (*get_midi_program_count)(PluginHandle handle); | uint32_t (*get_midi_program_count)(PluginHandle handle); | ||||
| const MidiProgram* (*get_midi_program_info)(PluginHandle handle, uint32_t index); | const MidiProgram* (*get_midi_program_info)(PluginHandle handle, uint32_t index); | ||||
| char* (*get_state)(PluginHandle handle); | |||||
| void (*set_state)(PluginHandle handle, const char* data); | |||||
| void (*activate)(PluginHandle handle); | |||||
| void (*deactivate)(PluginHandle handle); | |||||
| void (*process)(PluginHandle handle, audio_sample_t** inBuffer, audio_sample_t** outBuffer, uint32_t frames, const Event* events, uint32_t eventCount); | |||||
| void (*set_parameter_value)(PluginHandle handle, uint32_t index, float value); | |||||
| void (*set_midi_program)(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program); | |||||
| void (*set_custom_data)(PluginHandle handle, const char* key, const char* value); | |||||
| void (*ui_show)(PluginHandle handle, bool show); | void (*ui_show)(PluginHandle handle, bool show); | ||||
| void (*ui_idle)(PluginHandle handle); | void (*ui_idle)(PluginHandle handle); | ||||
| void (*ui_set_parameter)(PluginHandle handle, uint32_t index, float value); | |||||
| void (*ui_set_parameter_value)(PluginHandle handle, uint32_t index, float value); | |||||
| void (*ui_set_midi_program)(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program); | void (*ui_set_midi_program)(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program); | ||||
| void (*ui_set_custom_data)(PluginHandle handle, const char* key, const char* value); | |||||
| intptr_t (*dispatcher)(PluginHandle handle, mapped_value_t opcode, int32_t index, intptr_t value, void* ptr, float opt); | |||||
| void (*activate)(PluginHandle handle); | |||||
| void (*deactivate)(PluginHandle handle); | |||||
| void (*process)(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount); | |||||
| char* (*get_state)(PluginHandle handle); | |||||
| void (*set_state)(PluginHandle handle, const char* data); | |||||
| intptr_t (*dispatcher)(PluginHandle handle, PluginDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt); | |||||
| } PluginDescriptor; | } PluginDescriptor; | ||||
| @@ -295,6 +262,8 @@ extern void carla_register_native_plugin(const PluginDescriptor* desc); | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| /**@}*/ | |||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| } // extern "C" | } // extern "C" | ||||
| #endif | #endif | ||||
| @@ -33,35 +33,10 @@ | |||||
| class PluginClass | class PluginClass | ||||
| { | { | ||||
| public: | public: | ||||
| struct MappedValues { | |||||
| // event types | |||||
| MappedValue midi; | |||||
| MappedValue parameter; | |||||
| // plugin opcodes | |||||
| MappedValue msgReceived; | |||||
| MappedValue bufferSizeChanged; | |||||
| MappedValue sampleRateChanged; | |||||
| MappedValue offlineChanged; | |||||
| // host opcodes | |||||
| MappedValue needsIdle; | |||||
| } fMap; | |||||
| PluginClass(const PluginHostDescriptor* const host) | |||||
| PluginClass(const HostDescriptor* const host) | |||||
| : pHost(host) | : pHost(host) | ||||
| { | { | ||||
| std::memset(&fMap, 0, sizeof(MappedValues)); | |||||
| CARLA_SAFE_ASSERT_RETURN(host != nullptr,); | |||||
| fMap.midi = pHost->map_value(pHost->handle, EVENT_TYPE_MIDI); | |||||
| fMap.parameter = pHost->map_value(pHost->handle, EVENT_TYPE_PARAMETER); | |||||
| fMap.msgReceived = pHost->map_value(pHost->handle, PLUGIN_OPCODE_MSG_RECEIVED); | |||||
| fMap.bufferSizeChanged = pHost->map_value(pHost->handle, PLUGIN_OPCODE_BUFFER_SIZE_CHANGED); | |||||
| fMap.sampleRateChanged = pHost->map_value(pHost->handle, PLUGIN_OPCODE_SAMPLE_RATE_CHANGED); | |||||
| fMap.offlineChanged = pHost->map_value(pHost->handle, PLUGIN_OPCODE_OFFLINE_CHANGED); | |||||
| fMap.needsIdle = pHost->map_value(pHost->handle, HOST_OPCODE_NEEDS_IDLE); | |||||
| CARLA_ASSERT(host != nullptr); | |||||
| } | } | ||||
| virtual ~PluginClass() | virtual ~PluginClass() | ||||
| @@ -72,30 +47,23 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Host calls | // Host calls | ||||
| const PluginHostDescriptor* getHostHandle() const noexcept | |||||
| const HostDescriptor* getHostHandle() const noexcept | |||||
| { | { | ||||
| return pHost; | return pHost; | ||||
| } | } | ||||
| int getPluginVersion() const noexcept | |||||
| { | |||||
| return pHost->pluginVersion; | |||||
| } | |||||
| MappedValue mapValue(const char* const valueStr) const | |||||
| const char* getResourceDir() const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, 0); | |||||
| CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr, 0); | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr); | |||||
| return pHost->map_value(pHost->handle, valueStr); | |||||
| return pHost->resourceDir; | |||||
| } | } | ||||
| const char* unmapValue(const MappedValue value) const | |||||
| const char* getUiName() const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr); | CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr); | ||||
| CARLA_SAFE_ASSERT_RETURN(value != 0, nullptr); | |||||
| return pHost->unmap_value(pHost->handle, value); | |||||
| return pHost->uiName; | |||||
| } | } | ||||
| uint32_t getBufferSize() const | uint32_t getBufferSize() const | ||||
| @@ -126,49 +94,58 @@ protected: | |||||
| return pHost->get_time_info(pHost->handle); | return pHost->get_time_info(pHost->handle); | ||||
| } | } | ||||
| bool sendUiMessage(const char* const msg) | |||||
| void writeMidiEvent(const MidiEvent* const event) const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, false); | |||||
| CARLA_SAFE_ASSERT_RETURN(msg != nullptr, false); | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| return pHost->send_ui_msg(pHost->handle, msg); | |||||
| pHost->write_midi_event(pHost->handle, event); | |||||
| } | } | ||||
| bool writeEvent(const Event* const event) const | |||||
| void uiParameterChanged(const uint32_t index, const float value) const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, false); | |||||
| CARLA_SAFE_ASSERT_RETURN(event != nullptr, false); | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| return pHost->write_event(pHost->handle, event); | |||||
| pHost->ui_parameter_changed(pHost->handle, index, value); | |||||
| } | } | ||||
| bool writeMidiEvent(const MidiEvent* const midiEvent) const | |||||
| void uiMidiProgramChanged(const uint8_t channel, const uint32_t bank, const uint32_t program) const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, false); | |||||
| CARLA_SAFE_ASSERT_RETURN(midiEvent != nullptr, false); | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| return pHost->write_event(pHost->handle, (const Event*)midiEvent); | |||||
| pHost->ui_midi_program_changed(pHost->handle, channel, bank, program); | |||||
| } | } | ||||
| bool writeParameterEvent(const ParameterEvent* const paramEvent) const | |||||
| void uiCustomDataChanged(const char* const key, const char* const value) const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, false); | |||||
| CARLA_SAFE_ASSERT_RETURN(paramEvent != nullptr, false); | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| return pHost->write_event(pHost->handle, (const Event*)paramEvent); | |||||
| pHost->ui_custom_data_changed(pHost->handle, key, value); | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Host dispatcher calls | |||||
| void hostNeedsIdle() const | |||||
| void uiClosed() const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | ||||
| pHost->dispatcher(pHost->handle, fMap.needsIdle, 0, 0, nullptr, 0.0f); | |||||
| pHost->ui_closed(pHost->handle); | |||||
| } | |||||
| const char* uiOpenFile(const bool isDir, const char* const title, const char* const filter) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr); | |||||
| return pHost->ui_open_file(pHost->handle, isDir, title, filter); | |||||
| } | } | ||||
| #if 0 | |||||
| const char* uiSaveFile(const bool isDir, const char* const title, const char* const filter) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr); | |||||
| return pHost->ui_save_file(pHost->handle, isDir, title, filter); | |||||
| } | |||||
| // ------------------------------------------------------------------- | |||||
| // Host dispatcher calls | |||||
| void hostSetVolume(const float value) const | void hostSetVolume(const float value) const | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | ||||
| @@ -218,6 +195,13 @@ protected: | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_PARAMETER_MIDI_CC, index, value, nullptr, 0.0f); | pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_PARAMETER_MIDI_CC, index, value, nullptr, 0.0f); | ||||
| } | } | ||||
| void hostSetProcessPrecision(const intptr_t value) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_PROCESS_PRECISION, 0, value, nullptr, 0.0f); | |||||
| } | |||||
| void hostUpdateParameter(const int32_t index) const | void hostUpdateParameter(const int32_t index) const | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | ||||
| @@ -266,7 +250,13 @@ protected: | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_RELOAD_ALL, 0, 0, nullptr, 0.0f); | pHost->dispatcher(pHost->handle, HOST_OPCODE_RELOAD_ALL, 0, 0, nullptr, 0.0f); | ||||
| } | } | ||||
| #endif | |||||
| void hostUiUnavailable() const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_UI_UNAVAILABLE, 0, 0, nullptr, 0.0f); | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| @@ -297,15 +287,6 @@ protected: | |||||
| (void)value; | (void)value; | ||||
| } | } | ||||
| virtual void setParameterValue(const uint32_t index, const float value) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(),); | |||||
| return; | |||||
| // unused | |||||
| (void)value; | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| @@ -320,6 +301,18 @@ protected: | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Plugin state calls | |||||
| virtual void setParameterValue(const uint32_t index, const float value) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(),); | |||||
| return; | |||||
| // unused | |||||
| (void)value; | |||||
| } | |||||
| virtual void setMidiProgram(const uint8_t channel, const uint32_t bank, const uint32_t program) | virtual void setMidiProgram(const uint8_t channel, const uint32_t bank, const uint32_t program) | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,); | CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,); | ||||
| @@ -330,50 +323,87 @@ protected: | |||||
| (void)program; | (void)program; | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Plugin idle | |||||
| virtual void idle() | |||||
| virtual void setCustomData(const char* const key, const char* const value) | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(key != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin state calls | |||||
| // Plugin process calls | |||||
| virtual char* getState() const | |||||
| virtual void activate() | |||||
| { | { | ||||
| return nullptr; | |||||
| } | } | ||||
| virtual void setState(const char* const data) | |||||
| virtual void deactivate() | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | |||||
| } | } | ||||
| virtual void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) = 0; | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin process calls | |||||
| // Plugin UI calls | |||||
| virtual void activate() | |||||
| virtual void uiShow(const bool show) | |||||
| { | { | ||||
| return; | |||||
| // unused | |||||
| (void)show; | |||||
| } | } | ||||
| virtual void deactivate() | |||||
| virtual void uiIdle() | |||||
| { | |||||
| } | |||||
| virtual void uiSetParameterValue(const uint32_t index, const float value) | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(),); | |||||
| return; | |||||
| // unused | |||||
| (void)value; | |||||
| } | } | ||||
| virtual void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const Event* const events, const uint32_t eventCount) = 0; | |||||
| virtual void uiSetMidiProgram(const uint8_t channel, const uint32_t bank, const uint32_t program) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,); | |||||
| return; | |||||
| // unused | |||||
| (void)bank; | |||||
| (void)program; | |||||
| } | |||||
| virtual void uiSetCustomData(const char* const key, const char* const value) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(key != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin dispatcher calls | |||||
| // Plugin state calls | |||||
| virtual char* getState() const | |||||
| { | |||||
| return nullptr; | |||||
| } | |||||
| virtual void messageReceived(const char* const msg) | |||||
| virtual void setState(const char* const data) | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(msg != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Plugin dispatcher calls | |||||
| virtual void bufferSizeChanged(const uint32_t bufferSize) | virtual void bufferSizeChanged(const uint32_t bufferSize) | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(bufferSize > 0,); | |||||
| return; | |||||
| // unused | |||||
| (void)bufferSize; | |||||
| } | } | ||||
| virtual void sampleRateChanged(const double sampleRate) | virtual void sampleRateChanged(const double sampleRate) | ||||
| @@ -381,7 +411,7 @@ protected: | |||||
| CARLA_SAFE_ASSERT_RETURN(sampleRate > 0.0,); | CARLA_SAFE_ASSERT_RETURN(sampleRate > 0.0,); | ||||
| } | } | ||||
| virtual void offlineModeChanged(const bool isOffline) | |||||
| virtual void offlineChanged(const bool isOffline) | |||||
| { | { | ||||
| return; | return; | ||||
| @@ -389,10 +419,15 @@ protected: | |||||
| (void)isOffline; | (void)isOffline; | ||||
| } | } | ||||
| virtual void uiNameChanged(const char* const uiName) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(uiName != nullptr,); | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| private: | private: | ||||
| const PluginHostDescriptor* const pHost; | |||||
| const HostDescriptor* const pHost; | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -420,11 +455,6 @@ public: | |||||
| return handlePtr->getParameterText(index, value); | return handlePtr->getParameterText(index, value); | ||||
| } | } | ||||
| static void _set_parameter_value(PluginHandle handle, uint32_t index, float value) | |||||
| { | |||||
| handlePtr->setParameterValue(index, value); | |||||
| } | |||||
| static uint32_t _get_midi_program_count(PluginHandle handle) | static uint32_t _get_midi_program_count(PluginHandle handle) | ||||
| { | { | ||||
| return handlePtr->getMidiProgramCount(); | return handlePtr->getMidiProgramCount(); | ||||
| @@ -435,24 +465,44 @@ public: | |||||
| return handlePtr->getMidiProgramInfo(index); | return handlePtr->getMidiProgramInfo(index); | ||||
| } | } | ||||
| static void _set_parameter_value(PluginHandle handle, uint32_t index, float value) | |||||
| { | |||||
| handlePtr->setParameterValue(index, value); | |||||
| } | |||||
| static void _set_midi_program(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program) | static void _set_midi_program(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program) | ||||
| { | { | ||||
| handlePtr->setMidiProgram(channel, bank, program); | handlePtr->setMidiProgram(channel, bank, program); | ||||
| } | } | ||||
| static void _idle(PluginHandle handle) | |||||
| static void _set_custom_data(PluginHandle handle, const char* key, const char* value) | |||||
| { | { | ||||
| handlePtr->idle(); | |||||
| handlePtr->setCustomData(key, value); | |||||
| } | } | ||||
| static char* _get_state(PluginHandle handle) | |||||
| static void _ui_show(PluginHandle handle, bool show) | |||||
| { | { | ||||
| return handlePtr->getState(); | |||||
| handlePtr->uiShow(show); | |||||
| } | } | ||||
| static void _set_state(PluginHandle handle, const char* data) | |||||
| static void _ui_idle(PluginHandle handle) | |||||
| { | { | ||||
| handlePtr->setState(data); | |||||
| handlePtr->uiIdle(); | |||||
| } | |||||
| static void _ui_set_parameter_value(PluginHandle handle, uint32_t index, float value) | |||||
| { | |||||
| handlePtr->uiSetParameterValue(index, value); | |||||
| } | |||||
| static void _ui_set_midi_program(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program) | |||||
| { | |||||
| handlePtr->uiSetMidiProgram(channel, bank, program); | |||||
| } | |||||
| static void _ui_set_custom_data(PluginHandle handle, const char* key, const char* value) | |||||
| { | |||||
| handlePtr->uiSetCustomData(key, value); | |||||
| } | } | ||||
| static void _activate(PluginHandle handle) | static void _activate(PluginHandle handle) | ||||
| @@ -465,39 +515,46 @@ public: | |||||
| handlePtr->deactivate(); | handlePtr->deactivate(); | ||||
| } | } | ||||
| static void _process(PluginHandle handle, float** inBuffer, float** outBuffer, const uint32_t frames, const Event* events, uint32_t eventCount) | |||||
| static void _process(PluginHandle handle, float** inBuffer, float** outBuffer, const uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| handlePtr->process(inBuffer, outBuffer, frames, events, eventCount); | |||||
| handlePtr->process(inBuffer, outBuffer, frames, midiEvents, midiEventCount); | |||||
| } | } | ||||
| static intptr_t _dispatcher(PluginHandle handle, MappedValue opcode, int32_t /*index*/, intptr_t value, void* ptr, float opt) | |||||
| static char* _get_state(PluginHandle handle) | |||||
| { | { | ||||
| const MappedValues& map(handlePtr->fMap); | |||||
| return handlePtr->getState(); | |||||
| } | |||||
| if (opcode == 0) | |||||
| { | |||||
| } | |||||
| else if (opcode == map.msgReceived) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(ptr != nullptr, 0); | |||||
| handlePtr->messageReceived(static_cast<const char*>(ptr)); | |||||
| } | |||||
| else if (opcode == map.bufferSizeChanged) | |||||
| static void _set_state(PluginHandle handle, const char* data) | |||||
| { | |||||
| handlePtr->setState(data); | |||||
| } | |||||
| static intptr_t _dispatcher(PluginHandle handle, PluginDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt) | |||||
| { | |||||
| switch(opcode) | |||||
| { | { | ||||
| case PLUGIN_OPCODE_NULL: | |||||
| return 0; | |||||
| case PLUGIN_OPCODE_BUFFER_SIZE_CHANGED: | |||||
| CARLA_SAFE_ASSERT_RETURN(value > 0, 0); | CARLA_SAFE_ASSERT_RETURN(value > 0, 0); | ||||
| handlePtr->bufferSizeChanged(static_cast<uint32_t>(value)); | handlePtr->bufferSizeChanged(static_cast<uint32_t>(value)); | ||||
| } | |||||
| else if (opcode == map.sampleRateChanged) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(opt > 0.0f, 0); | |||||
| return 0; | |||||
| case PLUGIN_OPCODE_SAMPLE_RATE_CHANGED: | |||||
| handlePtr->sampleRateChanged(static_cast<double>(opt)); | handlePtr->sampleRateChanged(static_cast<double>(opt)); | ||||
| } | |||||
| else if (opcode == map.offlineChanged) | |||||
| { | |||||
| handlePtr->offlineModeChanged(value != 0); | |||||
| return 0; | |||||
| case PLUGIN_OPCODE_OFFLINE_CHANGED: | |||||
| handlePtr->offlineChanged(value != 0); | |||||
| return 0; | |||||
| case PLUGIN_OPCODE_UI_NAME_CHANGED: | |||||
| handlePtr->uiNameChanged(static_cast<const char*>(ptr)); | |||||
| return 0; | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| // unused | |||||
| (void)index; | |||||
| } | } | ||||
| #undef handlePtr | #undef handlePtr | ||||
| @@ -510,15 +567,15 @@ public: | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| #define PluginClassEND(ClassName) \ | |||||
| public: \ | |||||
| static PluginHandle _instantiate(const PluginHostDescriptor* host) \ | |||||
| { \ | |||||
| return new ClassName(host); \ | |||||
| } \ | |||||
| static void _cleanup(PluginHandle handle) \ | |||||
| { \ | |||||
| delete (ClassName*)handle; \ | |||||
| #define PluginClassEND(ClassName) \ | |||||
| public: \ | |||||
| static PluginHandle _instantiate(const HostDescriptor* host) \ | |||||
| { \ | |||||
| return new ClassName(host); \ | |||||
| } \ | |||||
| static void _cleanup(PluginHandle handle) \ | |||||
| { \ | |||||
| delete (ClassName*)handle; \ | |||||
| } | } | ||||
| #define PluginDescriptorFILL(ClassName) \ | #define PluginDescriptorFILL(ClassName) \ | ||||
| @@ -528,16 +585,21 @@ public: \ | |||||
| ClassName::_get_parameter_info, \ | ClassName::_get_parameter_info, \ | ||||
| ClassName::_get_parameter_value, \ | ClassName::_get_parameter_value, \ | ||||
| ClassName::_get_parameter_text, \ | ClassName::_get_parameter_text, \ | ||||
| ClassName::_set_parameter_value, \ | |||||
| ClassName::_get_midi_program_count, \ | ClassName::_get_midi_program_count, \ | ||||
| ClassName::_get_midi_program_info, \ | ClassName::_get_midi_program_info, \ | ||||
| ClassName::_set_parameter_value, \ | |||||
| ClassName::_set_midi_program, \ | ClassName::_set_midi_program, \ | ||||
| ClassName::_idle, \ | |||||
| ClassName::_get_state, \ | |||||
| ClassName::_set_state, \ | |||||
| ClassName::_set_custom_data, \ | |||||
| ClassName::_ui_show, \ | |||||
| ClassName::_ui_idle, \ | |||||
| ClassName::_ui_set_parameter_value, \ | |||||
| ClassName::_ui_set_midi_program, \ | |||||
| ClassName::_ui_set_custom_data, \ | |||||
| ClassName::_activate, \ | ClassName::_activate, \ | ||||
| ClassName::_deactivate, \ | ClassName::_deactivate, \ | ||||
| ClassName::_process, \ | ClassName::_process, \ | ||||
| ClassName::_get_state, \ | |||||
| ClassName::_set_state, \ | |||||
| ClassName::_dispatcher | ClassName::_dispatcher | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -1,97 +0,0 @@ | |||||
| # QtCreator project file | |||||
| TARGET = CarlaNative | |||||
| TEMPLATE = lib | |||||
| VERSION = 1.0 | |||||
| # ------------------------------------------------------- | |||||
| QT = core gui | |||||
| CONFIG = debug | |||||
| CONFIG += link_pkgconfig qt shared warn_on | |||||
| DEFINES = DEBUG | |||||
| DEFINES += HAVE_CPP11_SUPPORT | |||||
| DEFINES += QTCREATOR_TEST MOC_PARSING | |||||
| # Shared | |||||
| DEFINES += WANT_NATIVE | |||||
| DEFINES += WANT_LADSPA | |||||
| DEFINES += WANT_DSSI | |||||
| DEFINES += WANT_LV2 | |||||
| DEFINES += WANT_VST | |||||
| DEFINES += WANT_PLUGIN | |||||
| DEFINES += WANT_FLUIDSYNTH | |||||
| DEFINES += WANT_LINUXSAMPLER | |||||
| DEFINES += WANT_OPENGL | |||||
| DEFINES += WANT_AUDIOFILE | |||||
| DEFINES += WANT_MIDIFILE | |||||
| DEFINES += WANT_ZYNADDSUBFX | |||||
| DEFINES += WANT_ZYNADDSUBFX_UI | |||||
| # Audio file | |||||
| DEFINES += HAVE_FFMPEG | |||||
| PKGCONFIG += sndfile libavcodec libavformat libavutil | |||||
| # MIDI file | |||||
| PKGCONFIG += smf | |||||
| # DISTRHO | |||||
| PKGCONFIG += gl | |||||
| # ZynAddSubFX | |||||
| DEFINES += NTK_GUI | |||||
| PKGCONFIG += fftw3 mxml zlib ntk ntk_images | |||||
| # ------------------------------------------------------- | |||||
| SOURCES = \ | |||||
| bypass.c \ | |||||
| lfo.c \ | |||||
| midi-split.c \ | |||||
| midi-through.c \ | |||||
| midi-transpose.c \ | |||||
| nekofilter.c | |||||
| SOURCES += \ | |||||
| audio-file.cpp \ | |||||
| midi-file.cpp \ | |||||
| midi-sequencer.cpp \ | |||||
| sunvox-file.cpp \ | |||||
| zynaddsubfx.cpp \ | |||||
| zynaddsubfx-src.cpp \ | |||||
| zynaddsubfx-ui.cpp | |||||
| SOURCES += \ | |||||
| distrho-3bandeq.cpp | |||||
| HEADERS = \ | |||||
| audio-base.hpp \ | |||||
| midi-base.hpp | |||||
| HEADERS += \ | |||||
| ../CarlaNative.h \ | |||||
| ../CarlaNative.hpp | |||||
| HEADERS += \ | |||||
| distrho/DistrhoPluginCarla.cpp | |||||
| HEADERS += \ | |||||
| ../../utils/CarlaUtils.hpp \ | |||||
| ../../utils/CarlaJuceUtils.hpp \ | |||||
| ../../utils/CarlaLibUtils.hpp \ | |||||
| ../../utils/CarlaOscUtils.hpp \ | |||||
| ../../utils/CarlaStateUtils.hpp \ | |||||
| ../../utils/CarlaMutex.hpp \ | |||||
| ../../utils/CarlaString.hpp | |||||
| INCLUDEPATH = . .. \ | |||||
| 3bandeq distrho \ | |||||
| ../../includes \ | |||||
| ../../libs/distrho \ | |||||
| ../../utils \ | |||||
| ../../widgets | |||||
| QMAKE_CFLAGS *= -std=c99 | |||||
| QMAKE_CXXFLAGS *= -std=c++0x | |||||
| @@ -154,17 +154,6 @@ all: ../carla_native.a | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| %.c.o: %.c | |||||
| $(CC) $< $(BUILD_C_FLAGS) -c -o $@ | |||||
| %.cpp.o: %.cpp | |||||
| $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||||
| moc_%.cpp: %.hpp | |||||
| $(MOC) $< -DMOC_PARSING -o $@ | |||||
| # -------------------------------------------------------------- | |||||
| CDEPS = ../CarlaNative.h | CDEPS = ../CarlaNative.h | ||||
| CXXDEPS = ../CarlaNative.h ../CarlaNative.hpp | CXXDEPS = ../CarlaNative.h ../CarlaNative.hpp | ||||
| @@ -218,6 +207,17 @@ zynaddsubfx/UI/%.h: zynaddsubfx/UI/%.fl | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| %.c.o: %.c | |||||
| $(CC) $< $(BUILD_C_FLAGS) -c -o $@ | |||||
| %.cpp.o: %.cpp | |||||
| $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||||
| moc_%.cpp: %.hpp | |||||
| $(MOC) $< -DMOC_PARSING -o $@ | |||||
| # -------------------------------------------------------------- | |||||
| clean: | clean: | ||||
| rm -f $(OBJS) ../carla_native*.a | rm -f $(OBJS) ../carla_native*.a | ||||
| rm -f $(ZYN_UI_FILES_H) $(ZYN_UI_FILES_CPP) | rm -f $(ZYN_UI_FILES_H) $(ZYN_UI_FILES_CPP) | ||||
| @@ -26,7 +26,7 @@ class AudioFilePlugin : public PluginClass, | |||||
| public AbstractAudioPlayer | public AbstractAudioPlayer | ||||
| { | { | ||||
| public: | public: | ||||
| AudioFilePlugin(const PluginHostDescriptor* const host) | |||||
| AudioFilePlugin(const HostDescriptor* const host) | |||||
| : PluginClass(host), | : PluginClass(host), | ||||
| AbstractAudioPlayer(), | AbstractAudioPlayer(), | ||||
| fLoopMode(false), | fLoopMode(false), | ||||
| @@ -65,17 +65,17 @@ protected: | |||||
| static Parameter param; | static Parameter param; | ||||
| param.hints = PARAMETER_IS_ENABLED ":" PARAMETER_IS_BOOLEAN; | |||||
| param.name = "Loop Mode"; | param.name = "Loop Mode"; | ||||
| param.unit = nullptr; | param.unit = nullptr; | ||||
| param.ranges.def = 1.0f; | |||||
| param.ranges.min = 0.0f; | |||||
| param.ranges.max = 1.0f; | |||||
| param.hints = static_cast<ParameterHints>(PARAMETER_IS_ENABLED|PARAMETER_IS_BOOLEAN); | |||||
| param.ranges.def = 1.0f; | |||||
| param.ranges.min = 0.0f; | |||||
| param.ranges.max = 1.0f; | |||||
| param.ranges.step = 1.0f; | param.ranges.step = 1.0f; | ||||
| param.ranges.stepSmall = 1.0f; | param.ranges.stepSmall = 1.0f; | ||||
| param.ranges.stepLarge = 1.0f; | param.ranges.stepLarge = 1.0f; | ||||
| param.scalePointCount = 0; | |||||
| param.scalePoints = nullptr; | |||||
| param.scalePointCount = 0; | |||||
| param.scalePoints = nullptr; | |||||
| return ¶m; | return ¶m; | ||||
| } | } | ||||
| @@ -88,6 +88,9 @@ protected: | |||||
| return fLoopMode ? 1.0f : 0.0f; | return fLoopMode ? 1.0f : 0.0f; | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Plugin state calls | |||||
| void setParameterValue(const uint32_t index, const float value) override | void setParameterValue(const uint32_t index, const float value) override | ||||
| { | { | ||||
| if (index != 0) | if (index != 0) | ||||
| @@ -102,21 +105,18 @@ protected: | |||||
| fThread.setNeedsRead(); | fThread.setNeedsRead(); | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Plugin state calls | |||||
| void setCustomData(const char* const key, const char* const value) override | |||||
| { | |||||
| if (std::strcmp(key, "file") != 0) | |||||
| return; | |||||
| // void setCustomData(const char* const key, const char* const value) override | |||||
| // { | |||||
| // if (std::strcmp(key, "file") != 0) | |||||
| // return; | |||||
| // | |||||
| // loadFilename(value); | |||||
| // } | |||||
| loadFilename(value); | |||||
| } | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin process calls | // Plugin process calls | ||||
| void process(float**, float** const outBuffer, const uint32_t frames, const Event* const, const uint32_t) override | |||||
| void process(float**, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override | |||||
| { | { | ||||
| const TimeInfo* const timePos(getTimeInfo()); | const TimeInfo* const timePos(getTimeInfo()); | ||||
| @@ -189,16 +189,16 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin UI calls | // Plugin UI calls | ||||
| // void uiShow(const bool show) override | |||||
| // { | |||||
| // if (! show) | |||||
| // return; | |||||
| // | |||||
| // if (const char* const filename = uiOpenFile(false, "Open Audio File", "")) | |||||
| // uiCustomDataChanged("file", filename); | |||||
| // | |||||
| // uiClosed(); | |||||
| // } | |||||
| void uiShow(const bool show) override | |||||
| { | |||||
| if (! show) | |||||
| return; | |||||
| if (const char* const filename = uiOpenFile(false, "Open Audio File", "")) | |||||
| uiCustomDataChanged("file", filename); | |||||
| uiClosed(); | |||||
| } | |||||
| private: | private: | ||||
| bool fLoopMode; | bool fLoopMode; | ||||
| @@ -244,22 +244,19 @@ private: | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static const PluginDescriptor audiofileDesc = { | static const PluginDescriptor audiofileDesc = { | ||||
| /* api */ CARLA_NATIVE_API_VERSION, | |||||
| /* categories */ PLUGIN_CATEGORY_UTILITY, | |||||
| /* features */ PLUGIN_FEATURE_RTSAFE, | |||||
| /* supports */ nullptr, | |||||
| /* metadata */ nullptr, | |||||
| /* audioIns */ 0, | |||||
| /* audioOuts */ 2, | |||||
| /* midiIns */ 0, | |||||
| /* midiOuts */ 0, | |||||
| /* paramIns */ 0, // TODO - loopMode | |||||
| /* paramOuts */ 0, | |||||
| /* author */ "falkTX", | |||||
| /* name */ "Audio File", | |||||
| /* label */ "audiofile", | |||||
| /* copyright */ "GNU GPL v2+", | |||||
| /* version */ 0x1000, | |||||
| /* category */ PLUGIN_CATEGORY_UTILITY, | |||||
| /* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI|PLUGIN_NEEDS_UI_OPEN_SAVE), | |||||
| /* supports */ static_cast<PluginSupports>(0x0), | |||||
| /* audioIns */ 0, | |||||
| /* audioOuts */ 2, | |||||
| /* midiIns */ 0, | |||||
| /* midiOuts */ 0, | |||||
| /* paramIns */ 0, // TODO - loopMode | |||||
| /* paramOuts */ 0, | |||||
| /* name */ "Audio File", | |||||
| /* label */ "audiofile", | |||||
| /* maker */ "falkTX", | |||||
| /* copyright */ "GNU GPL v2+", | |||||
| PluginDescriptorFILL(AudioFilePlugin) | PluginDescriptorFILL(AudioFilePlugin) | ||||
| }; | }; | ||||
| @@ -21,42 +21,39 @@ | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static PluginHandle bypass_instantiate(const PluginHostDescriptor* host) | |||||
| static PluginHandle bypass_instantiate(const HostDescriptor* host) | |||||
| { | { | ||||
| // dummy, return non-NULL | // dummy, return non-NULL | ||||
| return (PluginHandle)host; | return (PluginHandle)host; | ||||
| } | } | ||||
| static void bypass_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const Event* events, uint32_t eventCount) | |||||
| static void bypass_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| memcpy(outBuffer[0], inBuffer[0], sizeof(float)*frames); | memcpy(outBuffer[0], inBuffer[0], sizeof(float)*frames); | ||||
| return; | return; | ||||
| // unused | // unused | ||||
| (void)handle; | (void)handle; | ||||
| (void)events; | |||||
| (void)eventCount; | |||||
| (void)midiEvents; | |||||
| (void)midiEventCount; | |||||
| } | } | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static const PluginDescriptor bypassDesc = { | static const PluginDescriptor bypassDesc = { | ||||
| .api = CARLA_NATIVE_API_VERSION, | |||||
| .categories = NULL, | |||||
| .features = "rtsafe", | |||||
| .supports = NULL, | |||||
| .metadata = NULL, | |||||
| .audioIns = 1, | |||||
| .audioOuts = 1, | |||||
| .midiIns = 0, | |||||
| .midiOuts = 0, | |||||
| .paramIns = 0, | |||||
| .paramOuts = 0, | |||||
| .author = "falkTX", | |||||
| .name = "ByPass", | |||||
| .label = "bypass", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .version = 0x1000, | |||||
| .category = PLUGIN_CATEGORY_NONE, | |||||
| .hints = PLUGIN_IS_RTSAFE, | |||||
| .supports = 0x0, | |||||
| .audioIns = 1, | |||||
| .audioOuts = 1, | |||||
| .midiIns = 0, | |||||
| .midiOuts = 0, | |||||
| .paramIns = 0, | |||||
| .paramOuts = 0, | |||||
| .name = "ByPass", | |||||
| .label = "bypass", | |||||
| .maker = "falkTX", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .instantiate = bypass_instantiate, | .instantiate = bypass_instantiate, | ||||
| .cleanup = NULL, | .cleanup = NULL, | ||||
| @@ -65,21 +62,28 @@ static const PluginDescriptor bypassDesc = { | |||||
| .get_parameter_info = NULL, | .get_parameter_info = NULL, | ||||
| .get_parameter_value = NULL, | .get_parameter_value = NULL, | ||||
| .get_parameter_text = NULL, | .get_parameter_text = NULL, | ||||
| .set_parameter_value = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| .set_midi_program = NULL, | |||||
| .idle = NULL, | |||||
| .set_parameter_value = NULL, | |||||
| .set_midi_program = NULL, | |||||
| .set_custom_data = NULL, | |||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .ui_show = NULL, | |||||
| .ui_idle = NULL, | |||||
| .ui_set_parameter_value = NULL, | |||||
| .ui_set_midi_program = NULL, | |||||
| .ui_set_custom_data = NULL, | |||||
| .activate = NULL, | .activate = NULL, | ||||
| .deactivate = NULL, | .deactivate = NULL, | ||||
| .process = bypass_process, | .process = bypass_process, | ||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .dispatcher = NULL | .dispatcher = NULL | ||||
| }; | }; | ||||
| @@ -268,14 +268,14 @@ static void lfo_process(PluginHandle handle, float** inBuffer, float** outBuffer | |||||
| static const PluginDescriptor lfoDesc = { | static const PluginDescriptor lfoDesc = { | ||||
| .category = PLUGIN_CATEGORY_UTILITY, | .category = PLUGIN_CATEGORY_UTILITY, | ||||
| .hints = PLUGIN_IS_RTSAFE|PLUGIN_USES_TIMEPOS, | |||||
| .hints = PLUGIN_IS_RTSAFE, | |||||
| .supports = 0x0, | .supports = 0x0, | ||||
| .audioIns = 0, | .audioIns = 0, | ||||
| .audioOuts = 0, | .audioOuts = 0, | ||||
| .midiIns = 0, | .midiIns = 0, | ||||
| .midiOuts = 0, | .midiOuts = 0, | ||||
| .parameterIns = PARAM_COUNT-1, | |||||
| .parameterOuts = 1, | |||||
| .paramIns = PARAM_COUNT-1, | |||||
| .paramOuts = 1, | |||||
| .name = "LFO", | .name = "LFO", | ||||
| .label = "lfo", | .label = "lfo", | ||||
| .maker = "falkTX", | .maker = "falkTX", | ||||
| @@ -220,7 +220,7 @@ private: | |||||
| static const PluginDescriptor midifileDesc = { | static const PluginDescriptor midifileDesc = { | ||||
| /* category */ PLUGIN_CATEGORY_UTILITY, | /* category */ PLUGIN_CATEGORY_UTILITY, | ||||
| /* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI|PLUGIN_NEEDS_OPENSAVE), | |||||
| /* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_GUI|PLUGIN_NEEDS_UI_OPEN_SAVE), | |||||
| /* supports */ static_cast<PluginSupports>(0x0), | /* supports */ static_cast<PluginSupports>(0x0), | ||||
| /* audioIns */ 0, | /* audioIns */ 0, | ||||
| /* audioOuts */ 0, | /* audioOuts */ 0, | ||||
| @@ -32,8 +32,7 @@ typedef enum { | |||||
| } MidiGainParams; | } MidiGainParams; | ||||
| typedef struct { | typedef struct { | ||||
| const PluginHostDescriptor* host; | |||||
| MappedValue map_midi; | |||||
| const HostDescriptor* host; | |||||
| float gain; | float gain; | ||||
| bool applyNotes; | bool applyNotes; | ||||
| bool applyAftertouch; | bool applyAftertouch; | ||||
| @@ -42,19 +41,18 @@ typedef struct { | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static PluginHandle midiGain_instantiate(const PluginHostDescriptor* host) | |||||
| static PluginHandle midiGain_instantiate(const HostDescriptor* host) | |||||
| { | { | ||||
| MidiGainHandle* const handle = (MidiGainHandle*)malloc(sizeof(MidiGainHandle)); | MidiGainHandle* const handle = (MidiGainHandle*)malloc(sizeof(MidiGainHandle)); | ||||
| if (handle == NULL) | if (handle == NULL) | ||||
| return NULL; | return NULL; | ||||
| handle->host = host; | |||||
| handle->map_midi = host->map_value(host->handle, EVENT_TYPE_MIDI); | |||||
| handle->gain = 1.0f; | |||||
| handle->applyNotes = true; | |||||
| handle->host = host; | |||||
| handle->gain = 1.0f; | |||||
| handle->applyNotes = true; | |||||
| handle->applyAftertouch = true; | handle->applyAftertouch = true; | ||||
| handle->applyCC = false; | |||||
| handle->applyCC = false; | |||||
| return handle; | return handle; | ||||
| } | } | ||||
| @@ -80,7 +78,7 @@ const Parameter* midiGain_get_parameter_info(PluginHandle handle, uint32_t index | |||||
| static Parameter param; | static Parameter param; | ||||
| param.hints = PARAMETER_IS_ENABLED ":" PARAMETER_IS_AUTOMABLE; | |||||
| param.hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE; | |||||
| param.unit = NULL; | param.unit = NULL; | ||||
| param.scalePointCount = 0; | param.scalePointCount = 0; | ||||
| param.scalePoints = NULL; | param.scalePoints = NULL; | ||||
| @@ -89,16 +87,16 @@ const Parameter* midiGain_get_parameter_info(PluginHandle handle, uint32_t index | |||||
| { | { | ||||
| case PARAM_GAIN: | case PARAM_GAIN: | ||||
| param.name = "Gain"; | param.name = "Gain"; | ||||
| param.ranges.def = 1.0f; | |||||
| param.ranges.min = 0.001f; | |||||
| param.ranges.max = 4.0f; | |||||
| param.ranges.step = PARAMETER_RANGE_DEFAULT_STEP; | |||||
| param.ranges.stepSmall = PARAMETER_RANGE_DEFAULT_STEP_SMALL; | |||||
| param.ranges.stepLarge = PARAMETER_RANGE_DEFAULT_STEP_LARGE; | |||||
| param.ranges.def = 1.0f; | |||||
| param.ranges.min = 0.001f; | |||||
| param.ranges.max = 4.0f; | |||||
| param.ranges.step = PARAMETER_RANGES_DEFAULT_STEP; | |||||
| param.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL; | |||||
| param.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE; | |||||
| break; | break; | ||||
| case PARAM_APPLY_NOTES: | case PARAM_APPLY_NOTES: | ||||
| param.name = "Apply Notes"; | |||||
| param.hints = PARAMETER_IS_ENABLED ":" PARAMETER_IS_AUTOMABLE ":" PARAMETER_IS_BOOLEAN; | |||||
| param.name = "Apply Notes"; | |||||
| param.hints |= PARAMETER_IS_BOOLEAN; | |||||
| param.ranges.def = 1.0f; | param.ranges.def = 1.0f; | ||||
| param.ranges.min = 0.0f; | param.ranges.min = 0.0f; | ||||
| param.ranges.max = 1.0f; | param.ranges.max = 1.0f; | ||||
| @@ -107,8 +105,8 @@ const Parameter* midiGain_get_parameter_info(PluginHandle handle, uint32_t index | |||||
| param.ranges.stepLarge = 1.0f; | param.ranges.stepLarge = 1.0f; | ||||
| break; | break; | ||||
| case PARAM_APPLY_AFTERTOUCH: | case PARAM_APPLY_AFTERTOUCH: | ||||
| param.name = "Apply Aftertouch"; | |||||
| param.hints = PARAMETER_IS_ENABLED ":" PARAMETER_IS_AUTOMABLE ":" PARAMETER_IS_BOOLEAN; | |||||
| param.name = "Apply Aftertouch"; | |||||
| param.hints |= PARAMETER_IS_BOOLEAN; | |||||
| param.ranges.def = 1.0f; | param.ranges.def = 1.0f; | ||||
| param.ranges.min = 0.0f; | param.ranges.min = 0.0f; | ||||
| param.ranges.max = 1.0f; | param.ranges.max = 1.0f; | ||||
| @@ -117,8 +115,8 @@ const Parameter* midiGain_get_parameter_info(PluginHandle handle, uint32_t index | |||||
| param.ranges.stepLarge = 1.0f; | param.ranges.stepLarge = 1.0f; | ||||
| break; | break; | ||||
| case PARAM_APPLY_CC: | case PARAM_APPLY_CC: | ||||
| param.name = "Apply CC"; | |||||
| param.hints = PARAMETER_IS_ENABLED ":" PARAMETER_IS_AUTOMABLE ":" PARAMETER_IS_BOOLEAN; | |||||
| param.name = "Apply CC"; | |||||
| param.hints |= PARAMETER_IS_BOOLEAN; | |||||
| param.ranges.def = 0.0f; | param.ranges.def = 0.0f; | ||||
| param.ranges.min = 0.0f; | param.ranges.min = 0.0f; | ||||
| param.ranges.max = 1.0f; | param.ranges.max = 1.0f; | ||||
| @@ -170,24 +168,18 @@ static void midiGain_set_parameter_value(PluginHandle handle, uint32_t index, fl | |||||
| } | } | ||||
| } | } | ||||
| static void midiGain_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const Event* events, uint32_t eventCount) | |||||
| static void midiGain_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| const PluginHostDescriptor* const host = handlePtr->host; | |||||
| const MappedValue map_midi = handlePtr->map_midi; | |||||
| const HostDescriptor* const host = handlePtr->host; | |||||
| const float gain = handlePtr->gain; | const float gain = handlePtr->gain; | ||||
| const bool applyNotes = handlePtr->applyNotes; | const bool applyNotes = handlePtr->applyNotes; | ||||
| const bool applyAftertouch = handlePtr->applyAftertouch; | const bool applyAftertouch = handlePtr->applyAftertouch; | ||||
| const bool applyCC = handlePtr->applyCC; | const bool applyCC = handlePtr->applyCC; | ||||
| MidiEvent tmpEvent; | MidiEvent tmpEvent; | ||||
| tmpEvent.e.type = map_midi; | |||||
| for (uint32_t i=0; i < eventCount; ++i) | |||||
| for (uint32_t i=0; i < midiEventCount; ++i) | |||||
| { | { | ||||
| if (events[i].type != map_midi) | |||||
| continue; | |||||
| const MidiEvent* const midiEvent = (const MidiEvent*)&events[i]; | |||||
| const MidiEvent* const midiEvent = &midiEvents[i]; | |||||
| const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data); | const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data); | ||||
| @@ -201,15 +193,15 @@ static void midiGain_process(PluginHandle handle, float** inBuffer, float** outB | |||||
| if (value <= 0.0f) | if (value <= 0.0f) | ||||
| tmpEvent.data[2] = 0; | tmpEvent.data[2] = 0; | ||||
| else if (value >= 127.0f) | |||||
| else if (value >= 1.27f) | |||||
| tmpEvent.data[2] = 127; | tmpEvent.data[2] = 127; | ||||
| else | else | ||||
| tmpEvent.data[2] = (uint8_t)value; | tmpEvent.data[2] = (uint8_t)value; | ||||
| host->write_event(host->handle, (const Event*)&tmpEvent); | |||||
| host->write_midi_event(host->handle, &tmpEvent); | |||||
| } | } | ||||
| else | else | ||||
| host->write_event(host->handle, &events[i]); | |||||
| host->write_midi_event(host->handle, midiEvent); | |||||
| } | } | ||||
| return; | return; | ||||
| @@ -223,21 +215,19 @@ static void midiGain_process(PluginHandle handle, float** inBuffer, float** outB | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static const PluginDescriptor midiGainDesc = { | static const PluginDescriptor midiGainDesc = { | ||||
| .api = CARLA_NATIVE_API_VERSION, | |||||
| .categories = PLUGIN_CATEGORY_UTILITY ":midi", | |||||
| .features = "rtsafe", | |||||
| .supports = PLUGIN_SUPPORTS_EVERYTHING, | |||||
| .metadata = NULL, | |||||
| .audioIns = 0, | |||||
| .audioOuts = 0, | |||||
| .midiIns = 1, | |||||
| .midiOuts = 1, | |||||
| .paramIns = 0, | |||||
| .paramOuts = 0, | |||||
| .author = "falkTX", | |||||
| .name = "MIDI Gain", | |||||
| .label = "midiGain", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .category = PLUGIN_CATEGORY_UTILITY, | |||||
| .hints = PLUGIN_IS_RTSAFE, | |||||
| .supports = PLUGIN_SUPPORTS_EVERYTHING, | |||||
| .audioIns = 0, | |||||
| .audioOuts = 0, | |||||
| .midiIns = 1, | |||||
| .midiOuts = 1, | |||||
| .paramIns = 0, | |||||
| .paramOuts = 0, | |||||
| .name = "MIDI Gain", | |||||
| .label = "midiGain", | |||||
| .maker = "falkTX", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .instantiate = midiGain_instantiate, | .instantiate = midiGain_instantiate, | ||||
| .cleanup = midiGain_cleanup, | .cleanup = midiGain_cleanup, | ||||
| @@ -246,21 +236,28 @@ static const PluginDescriptor midiGainDesc = { | |||||
| .get_parameter_info = midiGain_get_parameter_info, | .get_parameter_info = midiGain_get_parameter_info, | ||||
| .get_parameter_value = midiGain_get_parameter_value, | .get_parameter_value = midiGain_get_parameter_value, | ||||
| .get_parameter_text = NULL, | .get_parameter_text = NULL, | ||||
| .set_parameter_value = midiGain_set_parameter_value, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| .set_parameter_value = midiGain_set_parameter_value, | |||||
| .set_midi_program = NULL, | .set_midi_program = NULL, | ||||
| .set_custom_data = NULL, | |||||
| .idle = NULL, | |||||
| .ui_show = NULL, | |||||
| .ui_idle = NULL, | |||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .ui_set_parameter_value = NULL, | |||||
| .ui_set_midi_program = NULL, | |||||
| .ui_set_custom_data = NULL, | |||||
| .activate = NULL, | .activate = NULL, | ||||
| .deactivate = NULL, | .deactivate = NULL, | ||||
| .process = midiGain_process, | .process = midiGain_process, | ||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .dispatcher = NULL | .dispatcher = NULL | ||||
| }; | }; | ||||
| @@ -18,50 +18,22 @@ | |||||
| #include "CarlaNative.h" | #include "CarlaNative.h" | ||||
| #include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
| #include <stdlib.h> | |||||
| // ----------------------------------------------------------------------- | |||||
| typedef struct { | |||||
| const PluginHostDescriptor* host; | |||||
| MappedValue map_midi; | |||||
| } MidiSplitHandle; | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static PluginHandle midiSplit_instantiate(const PluginHostDescriptor* host) | |||||
| static PluginHandle midiSplit_instantiate(const HostDescriptor* host) | |||||
| { | { | ||||
| MidiSplitHandle* const handle = (MidiSplitHandle*)malloc(sizeof(MidiSplitHandle)); | |||||
| if (handle == NULL) | |||||
| return NULL; | |||||
| handle->host = host; | |||||
| handle->map_midi = host->map_value(host->handle, EVENT_TYPE_MIDI); | |||||
| return handle; | |||||
| // use HostDescriptor as PluginHandle | |||||
| return (PluginHandle)host; | |||||
| } | } | ||||
| #define handlePtr ((MidiSplitHandle*)handle) | |||||
| static void midiSplit_cleanup(PluginHandle handle) | |||||
| static void midiSplit_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| free(handlePtr); | |||||
| } | |||||
| static void midiSplit_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const Event* events, uint32_t eventCount) | |||||
| { | |||||
| const PluginHostDescriptor* const host = handlePtr->host; | |||||
| const MappedValue map_midi = handlePtr->map_midi; | |||||
| const HostDescriptor* const host = (const HostDescriptor*)handle; | |||||
| MidiEvent tmpEvent; | MidiEvent tmpEvent; | ||||
| tmpEvent.e.type = map_midi; | |||||
| for (uint32_t i=0; i < eventCount; ++i) | |||||
| for (uint32_t i=0; i < midiEventCount; ++i) | |||||
| { | { | ||||
| if (events[i].type != map_midi) | |||||
| continue; | |||||
| const MidiEvent* const midiEvent = (const MidiEvent*)&events[i]; | |||||
| const MidiEvent* const midiEvent = &midiEvents[i]; | |||||
| const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data); | const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data); | ||||
| const uint8_t channel = MIDI_GET_CHANNEL_FROM_DATA(midiEvent->data); | const uint8_t channel = MIDI_GET_CHANNEL_FROM_DATA(midiEvent->data); | ||||
| @@ -69,15 +41,15 @@ static void midiSplit_process(PluginHandle handle, float** inBuffer, float** out | |||||
| if (channel >= MAX_MIDI_CHANNELS) | if (channel >= MAX_MIDI_CHANNELS) | ||||
| continue; | continue; | ||||
| tmpEvent.e.frame = midiEvent->e.frame; | |||||
| tmpEvent.port = channel; | tmpEvent.port = channel; | ||||
| tmpEvent.time = midiEvent->time; | |||||
| tmpEvent.data[0] = status; | tmpEvent.data[0] = status; | ||||
| tmpEvent.data[1] = midiEvent->data[1]; | tmpEvent.data[1] = midiEvent->data[1]; | ||||
| tmpEvent.data[2] = midiEvent->data[2]; | tmpEvent.data[2] = midiEvent->data[2]; | ||||
| tmpEvent.data[3] = midiEvent->data[3]; | tmpEvent.data[3] = midiEvent->data[3]; | ||||
| tmpEvent.size = midiEvent->size; | tmpEvent.size = midiEvent->size; | ||||
| host->write_event(host->handle, (const Event*)&tmpEvent); | |||||
| host->write_midi_event(host->handle, &tmpEvent); | |||||
| } | } | ||||
| return; | return; | ||||
| @@ -88,49 +60,52 @@ static void midiSplit_process(PluginHandle handle, float** inBuffer, float** out | |||||
| (void)frames; | (void)frames; | ||||
| } | } | ||||
| #undef handlePtr | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static const PluginDescriptor midiSplitDesc = { | static const PluginDescriptor midiSplitDesc = { | ||||
| .api = CARLA_NATIVE_API_VERSION, | |||||
| .categories = PLUGIN_CATEGORY_UTILITY ":midi", | |||||
| .features = "rtsafe", | |||||
| .supports = PLUGIN_SUPPORTS_EVERYTHING, | |||||
| .metadata = NULL, | |||||
| .audioIns = 0, | |||||
| .audioOuts = 0, | |||||
| .midiIns = 1, | |||||
| .midiOuts = 16, | |||||
| .paramIns = 0, | |||||
| .paramOuts = 0, | |||||
| .author = "falkTX", | |||||
| .name = "MIDI Split", | |||||
| .label = "midiSplit", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .category = PLUGIN_CATEGORY_UTILITY, | |||||
| .hints = PLUGIN_IS_RTSAFE, | |||||
| .supports = PLUGIN_SUPPORTS_EVERYTHING, | |||||
| .audioIns = 0, | |||||
| .audioOuts = 0, | |||||
| .midiIns = 1, | |||||
| .midiOuts = 16, | |||||
| .paramIns = 0, | |||||
| .paramOuts = 0, | |||||
| .name = "MIDI Split", | |||||
| .label = "midiSplit", | |||||
| .maker = "falkTX", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .instantiate = midiSplit_instantiate, | .instantiate = midiSplit_instantiate, | ||||
| .cleanup = midiSplit_cleanup, | |||||
| .cleanup = NULL, | |||||
| .get_parameter_count = NULL, | .get_parameter_count = NULL, | ||||
| .get_parameter_info = NULL, | .get_parameter_info = NULL, | ||||
| .get_parameter_value = NULL, | .get_parameter_value = NULL, | ||||
| .get_parameter_text = NULL, | .get_parameter_text = NULL, | ||||
| .set_parameter_value = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| .set_midi_program = NULL, | |||||
| .idle = NULL, | |||||
| .set_parameter_value = NULL, | |||||
| .set_midi_program = NULL, | |||||
| .set_custom_data = NULL, | |||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .ui_show = NULL, | |||||
| .ui_idle = NULL, | |||||
| .ui_set_parameter_value = NULL, | |||||
| .ui_set_midi_program = NULL, | |||||
| .ui_set_custom_data = NULL, | |||||
| .activate = NULL, | .activate = NULL, | ||||
| .deactivate = NULL, | .deactivate = NULL, | ||||
| .process = midiSplit_process, | .process = midiSplit_process, | ||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .dispatcher = NULL | .dispatcher = NULL | ||||
| }; | }; | ||||
| @@ -18,46 +18,20 @@ | |||||
| #include "CarlaNative.h" | #include "CarlaNative.h" | ||||
| #include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
| #include <stdlib.h> | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| typedef struct { | |||||
| const PluginHostDescriptor* host; | |||||
| MappedValue map_midi; | |||||
| } MidiThroughHandle; | |||||
| // ----------------------------------------------------------------------- | |||||
| static PluginHandle midiThrough_instantiate(const PluginHostDescriptor* host) | |||||
| { | |||||
| MidiThroughHandle* const handle = (MidiThroughHandle*)malloc(sizeof(MidiThroughHandle)); | |||||
| if (handle == NULL) | |||||
| return NULL; | |||||
| handle->host = host; | |||||
| handle->map_midi = host->map_value(host->handle, EVENT_TYPE_MIDI); | |||||
| return handle; | |||||
| } | |||||
| #define handlePtr ((MidiThroughHandle*)handle) | |||||
| static void midiThrough_cleanup(PluginHandle handle) | |||||
| static PluginHandle midiThrough_instantiate(const HostDescriptor* host) | |||||
| { | { | ||||
| free(handlePtr); | |||||
| // use HostDescriptor as PluginHandle | |||||
| return (PluginHandle)host; | |||||
| } | } | ||||
| static void midiThrough_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const Event* events, uint32_t eventCount) | |||||
| static void midiThrough_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| const PluginHostDescriptor* const host = handlePtr->host; | |||||
| const MappedValue map_midi = handlePtr->map_midi; | |||||
| const HostDescriptor* const host = (const HostDescriptor*)handle; | |||||
| for (uint32_t i=0; i < eventCount; ++i) | |||||
| { | |||||
| if (events[i].type == map_midi) | |||||
| host->write_event(host->handle, &events[i]); | |||||
| } | |||||
| for (uint32_t i=0; i < midiEventCount; ++i) | |||||
| host->write_midi_event(host->handle, &midiEvents[i]); | |||||
| return; | return; | ||||
| @@ -67,50 +41,52 @@ static void midiThrough_process(PluginHandle handle, float** inBuffer, float** o | |||||
| (void)frames; | (void)frames; | ||||
| } | } | ||||
| #undef handlePtr | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static const PluginDescriptor midiThroughDesc = { | static const PluginDescriptor midiThroughDesc = { | ||||
| .api = CARLA_NATIVE_API_VERSION, | |||||
| .categories = PLUGIN_CATEGORY_UTILITY ":midi", | |||||
| .features = "rtsafe", | |||||
| .supports = PLUGIN_SUPPORTS_EVERYTHING, | |||||
| .metadata = NULL, | |||||
| .audioIns = 0, | |||||
| .audioOuts = 0, | |||||
| .midiIns = 1, | |||||
| .midiOuts = 1, | |||||
| .paramIns = 0, | |||||
| .paramOuts = 0, | |||||
| .author = "falkTX", | |||||
| .name = "MIDI Through", | |||||
| .label = "midiThrough", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .version = 0x1000, | |||||
| .category = PLUGIN_CATEGORY_UTILITY, | |||||
| .hints = PLUGIN_IS_RTSAFE, | |||||
| .supports = PLUGIN_SUPPORTS_EVERYTHING, | |||||
| .audioIns = 0, | |||||
| .audioOuts = 0, | |||||
| .midiIns = 1, | |||||
| .midiOuts = 1, | |||||
| .paramIns = 0, | |||||
| .paramOuts = 0, | |||||
| .name = "MIDI Through", | |||||
| .label = "midiThrough", | |||||
| .maker = "falkTX", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .instantiate = midiThrough_instantiate, | .instantiate = midiThrough_instantiate, | ||||
| .cleanup = midiThrough_cleanup, | |||||
| .cleanup = NULL, | |||||
| .get_parameter_count = NULL, | .get_parameter_count = NULL, | ||||
| .get_parameter_info = NULL, | .get_parameter_info = NULL, | ||||
| .get_parameter_value = NULL, | .get_parameter_value = NULL, | ||||
| .get_parameter_text = NULL, | .get_parameter_text = NULL, | ||||
| .set_parameter_value = NULL, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| .set_midi_program = NULL, | |||||
| .idle = NULL, | |||||
| .set_parameter_value = NULL, | |||||
| .set_midi_program = NULL, | |||||
| .set_custom_data = NULL, | |||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .ui_show = NULL, | |||||
| .ui_idle = NULL, | |||||
| .ui_set_parameter_value = NULL, | |||||
| .ui_set_midi_program = NULL, | |||||
| .ui_set_custom_data = NULL, | |||||
| .activate = NULL, | .activate = NULL, | ||||
| .deactivate = NULL, | .deactivate = NULL, | ||||
| .process = midiThrough_process, | .process = midiThrough_process, | ||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .dispatcher = NULL | .dispatcher = NULL | ||||
| }; | }; | ||||
| @@ -23,23 +23,21 @@ | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| typedef struct { | typedef struct { | ||||
| const PluginHostDescriptor* host; | |||||
| MappedValue map_midi; | |||||
| const HostDescriptor* host; | |||||
| int octaves; | int octaves; | ||||
| } MidiTransposeHandle; | } MidiTransposeHandle; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static PluginHandle midiTranspose_instantiate(const PluginHostDescriptor* host) | |||||
| static PluginHandle midiTranspose_instantiate(const HostDescriptor* host) | |||||
| { | { | ||||
| MidiTransposeHandle* const handle = (MidiTransposeHandle*)malloc(sizeof(MidiTransposeHandle)); | MidiTransposeHandle* const handle = (MidiTransposeHandle*)malloc(sizeof(MidiTransposeHandle)); | ||||
| if (handle == NULL) | if (handle == NULL) | ||||
| return NULL; | return NULL; | ||||
| handle->host = host; | |||||
| handle->map_midi = host->map_value(host->handle, EVENT_TYPE_MIDI); | |||||
| handle->octaves = 0; | |||||
| handle->host = host; | |||||
| handle->octaves = 0; | |||||
| return handle; | return handle; | ||||
| } | } | ||||
| @@ -65,17 +63,17 @@ const Parameter* midiTranspose_get_parameter_info(PluginHandle handle, uint32_t | |||||
| static Parameter param; | static Parameter param; | ||||
| param.hints = PARAMETER_IS_ENABLED ":" PARAMETER_IS_AUTOMABLE ":" PARAMETER_IS_INTEGER; | |||||
| param.name = "Octaves"; | param.name = "Octaves"; | ||||
| param.unit = NULL; | param.unit = NULL; | ||||
| param.ranges.def = 0.0f; | |||||
| param.ranges.min = -8.0f; | |||||
| param.ranges.max = 8.0f; | |||||
| param.hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE|PARAMETER_IS_INTEGER; | |||||
| param.ranges.def = 0.0f; | |||||
| param.ranges.min = -8.0f; | |||||
| param.ranges.max = 8.0f; | |||||
| param.ranges.step = 1.0f; | param.ranges.step = 1.0f; | ||||
| param.ranges.stepSmall = 1.0f; | param.ranges.stepSmall = 1.0f; | ||||
| param.ranges.stepLarge = 1.0f; | param.ranges.stepLarge = 1.0f; | ||||
| param.scalePointCount = 0; | |||||
| param.scalePoints = NULL; | |||||
| param.scalePointCount = 0; | |||||
| param.scalePoints = NULL; | |||||
| return ¶m; | return ¶m; | ||||
| @@ -99,21 +97,15 @@ static void midiTranspose_set_parameter_value(PluginHandle handle, uint32_t inde | |||||
| handlePtr->octaves = (int)value; | handlePtr->octaves = (int)value; | ||||
| } | } | ||||
| static void midiTranspose_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const Event* events, uint32_t eventCount) | |||||
| static void midiTranspose_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| const PluginHostDescriptor* const host = handlePtr->host; | |||||
| const MappedValue map_midi = handlePtr->map_midi; | |||||
| const HostDescriptor* const host = handlePtr->host; | |||||
| const int octaves = handlePtr->octaves; | const int octaves = handlePtr->octaves; | ||||
| MidiEvent tmpEvent; | MidiEvent tmpEvent; | ||||
| tmpEvent.e.type = map_midi; | |||||
| for (uint32_t i=0; i < eventCount; ++i) | |||||
| for (uint32_t i=0; i < midiEventCount; ++i) | |||||
| { | { | ||||
| if (events[i].type != map_midi) | |||||
| continue; | |||||
| const MidiEvent* const midiEvent = (const MidiEvent*)&events[i]; | |||||
| const MidiEvent* const midiEvent = &midiEvents[i]; | |||||
| const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data); | const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data); | ||||
| @@ -125,18 +117,18 @@ static void midiTranspose_process(PluginHandle handle, float** inBuffer, float** | |||||
| if (newnote < 0 || newnote >= MAX_MIDI_NOTE) | if (newnote < 0 || newnote >= MAX_MIDI_NOTE) | ||||
| continue; | continue; | ||||
| tmpEvent.e.frame = midiEvent->e.frame; | |||||
| tmpEvent.port = midiEvent->port; | tmpEvent.port = midiEvent->port; | ||||
| tmpEvent.time = midiEvent->time; | |||||
| tmpEvent.data[0] = midiEvent->data[0]; | tmpEvent.data[0] = midiEvent->data[0]; | ||||
| tmpEvent.data[1] = newnote; | tmpEvent.data[1] = newnote; | ||||
| tmpEvent.data[2] = midiEvent->data[2]; | tmpEvent.data[2] = midiEvent->data[2]; | ||||
| tmpEvent.data[3] = midiEvent->data[3]; | tmpEvent.data[3] = midiEvent->data[3]; | ||||
| tmpEvent.size = midiEvent->size; | tmpEvent.size = midiEvent->size; | ||||
| host->write_event(host->handle, (const Event*)&tmpEvent); | |||||
| host->write_midi_event(host->handle, &tmpEvent); | |||||
| } | } | ||||
| else | else | ||||
| host->write_event(host->handle, &events[i]); | |||||
| host->write_midi_event(host->handle, midiEvent); | |||||
| } | } | ||||
| return; | return; | ||||
| @@ -152,22 +144,19 @@ static void midiTranspose_process(PluginHandle handle, float** inBuffer, float** | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static const PluginDescriptor midiTransposeDesc = { | static const PluginDescriptor midiTransposeDesc = { | ||||
| .api = CARLA_NATIVE_API_VERSION, | |||||
| .categories = PLUGIN_CATEGORY_UTILITY ":midi", | |||||
| .features = "rtsafe", | |||||
| .supports = PLUGIN_SUPPORTS_EVERYTHING, | |||||
| .metadata = NULL, | |||||
| .audioIns = 0, | |||||
| .audioOuts = 0, | |||||
| .midiIns = 1, | |||||
| .midiOuts = 1, | |||||
| .paramIns = 1, | |||||
| .paramOuts = 0, | |||||
| .author = "falkTX", | |||||
| .name = "MIDI Transpose", | |||||
| .label = "midiTranspose", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .version = 0x1000, | |||||
| .category = PLUGIN_CATEGORY_UTILITY, | |||||
| .hints = PLUGIN_IS_RTSAFE, | |||||
| .supports = PLUGIN_SUPPORTS_EVERYTHING, | |||||
| .audioIns = 0, | |||||
| .audioOuts = 0, | |||||
| .midiIns = 1, | |||||
| .midiOuts = 1, | |||||
| .paramIns = 1, | |||||
| .paramOuts = 0, | |||||
| .name = "MIDI Transpose", | |||||
| .label = "midiTranspose", | |||||
| .maker = "falkTX", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .instantiate = midiTranspose_instantiate, | .instantiate = midiTranspose_instantiate, | ||||
| .cleanup = midiTranspose_cleanup, | .cleanup = midiTranspose_cleanup, | ||||
| @@ -176,21 +165,28 @@ static const PluginDescriptor midiTransposeDesc = { | |||||
| .get_parameter_info = midiTranspose_get_parameter_info, | .get_parameter_info = midiTranspose_get_parameter_info, | ||||
| .get_parameter_value = midiTranspose_get_parameter_value, | .get_parameter_value = midiTranspose_get_parameter_value, | ||||
| .get_parameter_text = NULL, | .get_parameter_text = NULL, | ||||
| .set_parameter_value = midiTranspose_set_parameter_value, | |||||
| .get_midi_program_count = NULL, | .get_midi_program_count = NULL, | ||||
| .get_midi_program_info = NULL, | .get_midi_program_info = NULL, | ||||
| .set_midi_program = NULL, | |||||
| .idle = NULL, | |||||
| .set_parameter_value = midiTranspose_set_parameter_value, | |||||
| .set_midi_program = NULL, | |||||
| .set_custom_data = NULL, | |||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .ui_show = NULL, | |||||
| .ui_idle = NULL, | |||||
| .ui_set_parameter_value = NULL, | |||||
| .ui_set_midi_program = NULL, | |||||
| .ui_set_custom_data = NULL, | |||||
| .activate = NULL, | .activate = NULL, | ||||
| .deactivate = NULL, | .deactivate = NULL, | ||||
| .process = midiTranspose_process, | .process = midiTranspose_process, | ||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .dispatcher = NULL | .dispatcher = NULL | ||||
| }; | }; | ||||
| @@ -38,8 +38,8 @@ static const PluginDescriptor nekofilterDesc = { | |||||
| .audioOuts = 1, | .audioOuts = 1, | ||||
| .midiIns = 0, | .midiIns = 0, | ||||
| .midiOuts = 0, | .midiOuts = 0, | ||||
| .parameterIns = GLOBAL_PARAMETERS_COUNT + BAND_PARAMETERS_COUNT*BANDS_COUNT, | |||||
| .parameterOuts = 0, | |||||
| .paramIns = GLOBAL_PARAMETERS_COUNT + BAND_PARAMETERS_COUNT*BANDS_COUNT, | |||||
| .paramOuts = 0, | |||||
| .name = "NekoFilter", | .name = "NekoFilter", | ||||
| .label = "nekofilter", | .label = "nekofilter", | ||||
| .maker = "falkTX, Nedko, Fons Adriaensen", | .maker = "falkTX, Nedko, Fons Adriaensen", | ||||
| @@ -17,6 +17,8 @@ | |||||
| #include "CarlaNative.hpp" | #include "CarlaNative.hpp" | ||||
| #include "juce_core.h" | |||||
| using namespace juce; | using namespace juce; | ||||
| #include "vex/cArp.h" | #include "vex/cArp.h" | ||||
| @@ -813,7 +815,7 @@ private: | |||||
| static const PluginDescriptor vexArpDesc = { | static const PluginDescriptor vexArpDesc = { | ||||
| /* category */ PLUGIN_CATEGORY_UTILITY, | /* category */ PLUGIN_CATEGORY_UTILITY, | ||||
| /* hints */ static_cast<PluginHints>(PLUGIN_USES_TIMEPOS), | |||||
| /* hints */ static_cast<PluginHints>(PLUGIN_USES_TIME), | |||||
| /* supports */ static_cast<PluginSupports>(PLUGIN_SUPPORTS_EVERYTHING), | /* supports */ static_cast<PluginSupports>(PLUGIN_SUPPORTS_EVERYTHING), | ||||
| /* audioIns */ 0, | /* audioIns */ 0, | ||||
| /* audioOuts */ 0, | /* audioOuts */ 0, | ||||
| @@ -847,7 +849,7 @@ static const PluginDescriptor vexChorusDesc = { | |||||
| static const PluginDescriptor vexDelayDesc = { | static const PluginDescriptor vexDelayDesc = { | ||||
| /* category */ PLUGIN_CATEGORY_DELAY, | /* category */ PLUGIN_CATEGORY_DELAY, | ||||
| /* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_TIMEPOS), | |||||
| /* hints */ static_cast<PluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_USES_TIME), | |||||
| /* supports */ static_cast<PluginSupports>(0x0), | /* supports */ static_cast<PluginSupports>(0x0), | ||||
| /* audioIns */ 2, | /* audioIns */ 2, | ||||
| /* audioOuts */ 2, | /* audioOuts */ 2, | ||||
| @@ -58,6 +58,8 @@ | |||||
| #include <set> | #include <set> | ||||
| #include <string> | #include <string> | ||||
| #include "juce_core.h" | |||||
| // Dummy variables and functions for linking purposes | // Dummy variables and functions for linking purposes | ||||
| const char* instance_name = nullptr; | const char* instance_name = nullptr; | ||||
| class WavFile; | class WavFile; | ||||
| @@ -243,7 +245,7 @@ private: | |||||
| MidiProgram fRetProgram; | MidiProgram fRetProgram; | ||||
| NonRtList<const ProgramInfo*> fPrograms; | NonRtList<const ProgramInfo*> fPrograms; | ||||
| CARLA_DECLARE_NON_COPYABLE(ZynAddSubFxPrograms) | |||||
| CARLA_DECLARE_NON_COPY_CLASS(ZynAddSubFxPrograms) | |||||
| }; | }; | ||||
| static ZynAddSubFxPrograms sPrograms; | static ZynAddSubFxPrograms sPrograms; | ||||
| @@ -347,7 +349,7 @@ public: | |||||
| private: | private: | ||||
| int fCount; | int fCount; | ||||
| CARLA_DECLARE_NON_COPYABLE(ZynAddSubFxInstanceCount) | |||||
| CARLA_DECLARE_NON_COPY_CLASS(ZynAddSubFxInstanceCount) | |||||
| }; | }; | ||||
| static ZynAddSubFxInstanceCount sInstanceCount; | static ZynAddSubFxInstanceCount sInstanceCount; | ||||
| @@ -110,7 +110,7 @@ endif | |||||
| all: $(TARGETS) | all: $(TARGETS) | ||||
| clean: | clean: | ||||
| rm -f *.o | |||||
| rm -f $(TARGETS) *.o | |||||
| rm -f carla-native.lv2/*.* | rm -f carla-native.lv2/*.* | ||||
| debug: | debug: | ||||
| @@ -134,7 +134,7 @@ void carla_register_native_plugin(const PluginDescriptor* desc) | |||||
| { | { | ||||
| #ifdef CARLA_NATIVE_PLUGIN_LV2 | #ifdef CARLA_NATIVE_PLUGIN_LV2 | ||||
| // LV2 MIDI Out and Open/Save are not implemented yet | // LV2 MIDI Out and Open/Save are not implemented yet | ||||
| if (desc->midiOuts > 0 || (desc->hints & PLUGIN_NEEDS_OPENSAVE) != 0) | |||||
| if (desc->midiOuts > 0 || (desc->hints & PLUGIN_NEEDS_UI_OPEN_SAVE) != 0) | |||||
| return; | return; | ||||
| #endif | #endif | ||||
| sPluginDescsMgr.descs.append(desc); | sPluginDescsMgr.descs.append(desc); | ||||
| @@ -297,13 +297,13 @@ void writePluginFile(const PluginDescriptor* const pluginDesc) | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // First MIDI/Time port | // First MIDI/Time port | ||||
| if (pluginDesc->midiIns > 0 || (pluginDesc->hints & PLUGIN_USES_TIMEPOS) != 0) | |||||
| if (pluginDesc->midiIns > 0 || (pluginDesc->hints & PLUGIN_USES_TIME) != 0) | |||||
| { | { | ||||
| text += " lv2:port [\n"; | text += " lv2:port [\n"; | ||||
| text += " a lv2:InputPort, atom:AtomPort ;\n"; | text += " a lv2:InputPort, atom:AtomPort ;\n"; | ||||
| text += " atom:bufferType atom:Sequence ;\n"; | text += " atom:bufferType atom:Sequence ;\n"; | ||||
| if (pluginDesc->midiIns > 0 && (pluginDesc->hints & PLUGIN_USES_TIMEPOS) != 0) | |||||
| if (pluginDesc->midiIns > 0 && (pluginDesc->hints & PLUGIN_USES_TIME) != 0) | |||||
| { | { | ||||
| text += " atom:supports <" LV2_MIDI__MidiEvent "> ,\n"; | text += " atom:supports <" LV2_MIDI__MidiEvent "> ,\n"; | ||||
| text += " <" LV2_TIME__Position "> ;\n"; | text += " <" LV2_TIME__Position "> ;\n"; | ||||
| @@ -130,7 +130,7 @@ public: | |||||
| if (fDescriptor->midiIns > 0) | if (fDescriptor->midiIns > 0) | ||||
| fUI.portOffset += desc->midiIns; | fUI.portOffset += desc->midiIns; | ||||
| else if (fDescriptor->hints & PLUGIN_USES_TIMEPOS) | |||||
| else if (fDescriptor->hints & PLUGIN_USES_TIME) | |||||
| fUI.portOffset += 1; | fUI.portOffset += 1; | ||||
| fUI.portOffset += desc->midiOuts; | fUI.portOffset += desc->midiOuts; | ||||
| @@ -232,7 +232,7 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| if (fDescriptor->midiIns > 0 || (fDescriptor->hints & PLUGIN_USES_TIMEPOS) != 0) | |||||
| if (fDescriptor->midiIns > 0 || (fDescriptor->hints & PLUGIN_USES_TIME) != 0) | |||||
| { | { | ||||
| fMidiEventCount = 0; | fMidiEventCount = 0; | ||||
| carla_zeroStruct<MidiEvent>(fMidiEvents, kMaxMidiEvents*2); | carla_zeroStruct<MidiEvent>(fMidiEvents, kMaxMidiEvents*2); | ||||
| @@ -883,7 +883,7 @@ private: | |||||
| for (uint32_t i=0; i < desc->midiIns; ++i) | for (uint32_t i=0; i < desc->midiIns; ++i) | ||||
| eventsIn[i] = nullptr; | eventsIn[i] = nullptr; | ||||
| } | } | ||||
| else if (desc->hints & PLUGIN_USES_TIMEPOS) | |||||
| else if (desc->hints & PLUGIN_USES_TIME) | |||||
| { | { | ||||
| eventsIn = new LV2_Atom_Sequence*[1]; | eventsIn = new LV2_Atom_Sequence*[1]; | ||||
| eventsIn[0] = nullptr; | eventsIn[0] = nullptr; | ||||
| @@ -935,7 +935,7 @@ private: | |||||
| { | { | ||||
| uint32_t index = 0; | uint32_t index = 0; | ||||
| if (desc->midiIns > 0 || (desc->hints & PLUGIN_USES_TIMEPOS) != 0) | |||||
| if (desc->midiIns > 0 || (desc->hints & PLUGIN_USES_TIME) != 0) | |||||
| { | { | ||||
| if (port == index++) | if (port == index++) | ||||
| { | { | ||||
| @@ -43,9 +43,9 @@ | |||||
| \endcode | \endcode | ||||
| */ | */ | ||||
| #define CARLA_LEAK_DETECTOR(ClassName) \ | #define CARLA_LEAK_DETECTOR(ClassName) \ | ||||
| friend class LeakedObjectDetector<ClassName>; \ | |||||
| friend class ::LeakedObjectDetector<ClassName>; \ | |||||
| static const char* getLeakedObjectClassName() noexcept { return #ClassName; } \ | static const char* getLeakedObjectClassName() noexcept { return #ClassName; } \ | ||||
| LeakedObjectDetector<ClassName> CARLA_JOIN_MACRO(leakDetector, __LINE__); | |||||
| ::LeakedObjectDetector<ClassName> CARLA_JOIN_MACRO(leakDetector, __LINE__); | |||||
| #define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \ | #define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \ | ||||
| CARLA_DECLARE_NON_COPY_CLASS(ClassName) \ | CARLA_DECLARE_NON_COPY_CLASS(ClassName) \ | ||||
| @@ -26,6 +26,9 @@ | |||||
| #include "CarlaUtils.hpp" | #include "CarlaUtils.hpp" | ||||
| #include "CarlaString.hpp" | #include "CarlaString.hpp" | ||||
| #include <cerrno> | |||||
| #include <clocale> | |||||
| #include <fcntl.h> | #include <fcntl.h> | ||||
| #include <sys/wait.h> | #include <sys/wait.h> | ||||