| @@ -34,7 +34,7 @@ CARLA_BACKEND_START_NAMESPACE | |||
| * @defgroup CarlaBackendAPI Carla Backend API | |||
| * | |||
| * The Carla Backend API.\n | |||
| * This is the base definitions for everything the Carla code. | |||
| * This is the base definitions for everything in the Carla code. | |||
| * | |||
| * @{ | |||
| */ | |||
| @@ -737,7 +737,7 @@ struct MidiProgramData { | |||
| }; | |||
| /*! | |||
| * Custom data, saving key:value 'dictionaries'. | |||
| * Custom data, saving key:value 'dictionaries'.\n | |||
| * \a type is an URI which defines the \a value type. | |||
| * | |||
| * \see CustomDataTypes | |||
| @@ -757,6 +757,7 @@ public: | |||
| */ | |||
| CarlaPlugin* getPluginUnchecked(const unsigned int id) const; | |||
| // FIXME - this one should not be public | |||
| /*! | |||
| * Get a unique plugin name within the engine.\n | |||
| * Returned variable must NOT be free'd. | |||
| @@ -769,18 +770,20 @@ public: | |||
| /*! | |||
| * Load \a filename of any type.\n | |||
| * This will try to load a generic file as a plugin, | |||
| * either by direct handling (GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI) | |||
| * either by direct handling (GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI). | |||
| */ | |||
| bool loadFilename(const char* const filename); | |||
| /*! | |||
| * Load \a filename session. | |||
| * Load \a filename project file.\n | |||
| * (project files have *.carxp extension) | |||
| * \note Already loaded plugins are not removed; call removeAllPlugins() first if needed. | |||
| */ | |||
| bool loadProject(const char* const filename); | |||
| /*! | |||
| * Save current session to \a filename. | |||
| * Save current project to \a filename.\n | |||
| * (project files have *.carxp extension) | |||
| */ | |||
| bool saveProject(const char* const filename); | |||
| @@ -853,6 +856,7 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| // Callback | |||
| // FIXME - this one should not be public | |||
| /*! | |||
| * TODO. | |||
| */ | |||
| @@ -867,17 +871,17 @@ public: | |||
| // Patchbay | |||
| /*! | |||
| * TODO. | |||
| * Connect patchbay ports \a portA and \a portB. | |||
| */ | |||
| virtual bool patchbayConnect(int portA, int portB); | |||
| /*! | |||
| * TODO. | |||
| * Disconnect patchbay connection \a connectionId. | |||
| */ | |||
| virtual bool patchbayDisconnect(int connectionId); | |||
| /*! | |||
| * TODO. | |||
| * Force the engine to resend all patchbay clients, ports and connections again. | |||
| */ | |||
| virtual void patchbayRefresh(); | |||
| @@ -885,17 +889,17 @@ public: | |||
| // Transport | |||
| /*! | |||
| * TODO. | |||
| * Start playback of the engine transport. | |||
| */ | |||
| virtual void transportPlay(); | |||
| /*! | |||
| * TODO. | |||
| * Pause the engine transport. | |||
| */ | |||
| virtual void transportPause(); | |||
| /*! | |||
| * TODO. | |||
| * Relocate the engine transport to \a frames. | |||
| */ | |||
| virtual void transportRelocate(const uint32_t frame); | |||
| @@ -907,6 +911,7 @@ public: | |||
| */ | |||
| const char* getLastError() const; | |||
| // FIXME - this one should not be public | |||
| /*! | |||
| * Set last error. | |||
| */ | |||
| @@ -944,6 +949,7 @@ public: | |||
| bool isOscControlRegistered() const; | |||
| #endif | |||
| // FIXME - this one should not be public | |||
| /*! | |||
| * Idle OSC. | |||
| */ | |||
| @@ -997,6 +1003,11 @@ protected: | |||
| */ | |||
| void proccessPendingEvents(); | |||
| /*! | |||
| * TODO. | |||
| */ | |||
| void setPeaks(const unsigned int pluginId, float const inPeaks[MAX_PEAKS], float const outPeaks[MAX_PEAKS]); | |||
| #ifndef BUILD_BRIDGE | |||
| // Rack mode data | |||
| EngineEvent* getRackEventBuffer(const bool isInput); | |||
| @@ -195,7 +195,7 @@ typedef struct _PluginDescriptor { | |||
| char* (*get_state)(PluginHandle handle); | |||
| void (*set_state)(PluginHandle handle, const char* data); | |||
| intptr_t (*dispatcher)(PluginHandle handle, int32_t code, int32_t index, intptr_t value, void* ptr); | |||
| intptr_t (*dispatcher)(PluginHandle handle, int32_t opcode, int32_t index, intptr_t value, void* ptr); | |||
| } PluginDescriptor; | |||
| @@ -298,6 +298,20 @@ protected: | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // Dispatcher | |||
| virtual intptr_t dispatcher(int32_t opcode, int32_t index, intptr_t value, void* ptr) | |||
| { | |||
| return 0; | |||
| // unused | |||
| (void)opcode; | |||
| (void)index; | |||
| (void)value; | |||
| (void)ptr; | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| private: | |||
| const HostDescriptor* const kHost; | |||
| @@ -403,6 +417,11 @@ public: | |||
| handlePtr->setState(data); | |||
| } | |||
| static intptr_t _dispatcher(PluginHandle handle, int32_t opcode, int32_t index, intptr_t value, void* ptr) | |||
| { | |||
| return handlePtr->dispatcher(opcode, index, value, ptr); | |||
| } | |||
| #undef handlePtr | |||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginDescriptorClass) | |||
| @@ -445,6 +464,7 @@ public: | |||
| className::_deactivate, \ | |||
| className::_process, \ | |||
| className::_get_state, \ | |||
| className::_set_state | |||
| className::_set_state, \ | |||
| className::_dispatcher | |||
| #endif // __CARLA_NATIVE_HPP__ | |||
| @@ -308,67 +308,76 @@ CARLA_EXPORT bool carla_is_engine_running(); | |||
| CARLA_EXPORT void carla_set_engine_about_to_close(); | |||
| /*! | |||
| * TODO | |||
| * Set the engine callback function to \a func. | |||
| * Use \a ptr to pass a custom pointer to the callback. | |||
| */ | |||
| CARLA_EXPORT void carla_set_engine_callback(CarlaCallbackFunc func, void* ptr); | |||
| /*! | |||
| * TODO | |||
| * Set the engine option \a option.\n | |||
| * With the exception of OPTION_PROCESS_NAME, OPTION_TRANSPORT_MODE and OPTION_PATH_*, | |||
| * this function should not be called when the engine is running. | |||
| */ | |||
| CARLA_EXPORT void carla_set_engine_option(CarlaOptionsType option, int value, const char* valueStr); | |||
| /*! | |||
| * TODO | |||
| * Load \a filename of any type.\n | |||
| * This will try to load a generic file as a plugin, | |||
| * either by direct handling (GIG, SF2 and SFZ) or by using an internal plugin (like Audio and MIDI). | |||
| * \see carla_get_supported_file_types() | |||
| */ | |||
| CARLA_EXPORT bool carla_load_filename(const char* filename); | |||
| /*! | |||
| * TODO | |||
| * Load \a filename project file.\n | |||
| * (project files have *.carxp extension) | |||
| * \note Already loaded plugins are not removed; call carla_remove_all_plugins() first if needed. | |||
| */ | |||
| CARLA_EXPORT bool carla_load_project(const char* filename); | |||
| /*! | |||
| * TODO | |||
| * Save current project to \a filename.\n | |||
| * (project files have *.carxp extension) | |||
| */ | |||
| CARLA_EXPORT bool carla_save_project(const char* filename); | |||
| /*! | |||
| * TODO | |||
| * Connect patchbay ports \a portA and \a portB. | |||
| */ | |||
| CARLA_EXPORT bool carla_patchbay_connect(int portA, int portB); | |||
| /*! | |||
| * TODO | |||
| * Disconnect patchbay connection \a connectionId. | |||
| */ | |||
| CARLA_EXPORT bool carla_patchbay_disconnect(int connectionId); | |||
| /*! | |||
| * TODO | |||
| * Force the engine to resend all patchbay clients, ports and connections again. | |||
| */ | |||
| CARLA_EXPORT void carla_patchbay_refresh(); | |||
| /*! | |||
| * TODO | |||
| * Start playback of the engine transport. | |||
| */ | |||
| CARLA_EXPORT void carla_transport_play(); | |||
| /*! | |||
| * TODO | |||
| * Pause the engine transport. | |||
| */ | |||
| CARLA_EXPORT void carla_transport_pause(); | |||
| /*! | |||
| * TODO | |||
| * Relocate the engine transport to \a frames. | |||
| */ | |||
| CARLA_EXPORT void carla_transport_relocate(uint32_t frames); | |||
| /*! | |||
| * TODO | |||
| * Get the current transport frame. | |||
| */ | |||
| CARLA_EXPORT uint32_t carla_get_current_transport_frame(); | |||
| /*! | |||
| * TODO | |||
| * Get the engine transport information. | |||
| */ | |||
| CARLA_EXPORT const CarlaTransportInfo* carla_get_transport_info(); | |||
| @@ -481,197 +490,208 @@ CARLA_EXPORT const CarlaCustomData* carla_get_custom_data(unsigned int pluginId, | |||
| CARLA_EXPORT const char* carla_get_chunk_data(unsigned int pluginId); | |||
| /*! | |||
| * TODO | |||
| * Get how many parameters a plugin has. | |||
| */ | |||
| CARLA_EXPORT uint32_t carla_get_parameter_count(unsigned int pluginId); | |||
| /*! | |||
| * TODO | |||
| * Get how many programs a plugin has. | |||
| */ | |||
| CARLA_EXPORT uint32_t carla_get_program_count(unsigned int pluginId); | |||
| /*! | |||
| * TODO | |||
| * Get how many midi programs a plugin has. | |||
| */ | |||
| CARLA_EXPORT uint32_t carla_get_midi_program_count(unsigned int pluginId); | |||
| /*! | |||
| * TODO | |||
| * Get how many custom data sets a plugin has. | |||
| * \see carla_prepare_for_save() | |||
| */ | |||
| CARLA_EXPORT uint32_t carla_get_custom_data_count(unsigned int pluginId); | |||
| /*! | |||
| * TODO | |||
| * Get a plugin's custom parameter text display. | |||
| * \see PARAMETER_USES_CUSTOM_TEXT | |||
| */ | |||
| CARLA_EXPORT const char* carla_get_parameter_text(unsigned int pluginId, uint32_t parameterId); | |||
| /*! | |||
| * TODO | |||
| * Get a plugin's program name. | |||
| */ | |||
| CARLA_EXPORT const char* carla_get_program_name(unsigned int pluginId, uint32_t programId); | |||
| /*! | |||
| * TODO | |||
| * Get a plugin's midi program name. | |||
| */ | |||
| CARLA_EXPORT const char* carla_get_midi_program_name(unsigned int pluginId, uint32_t midiProgramId); | |||
| /*! | |||
| * TODO | |||
| * Get the plugin's real name.\n | |||
| * This is the name the plugin uses to identify itself; may not be unique. | |||
| */ | |||
| CARLA_EXPORT const char* carla_get_real_plugin_name(unsigned int pluginId); | |||
| /*! | |||
| * TODO | |||
| * Get the current plugin's program index. | |||
| */ | |||
| CARLA_EXPORT int32_t carla_get_current_program_index(unsigned int pluginId); | |||
| /*! | |||
| * TODO | |||
| * Get the current plugin's midi program index. | |||
| */ | |||
| CARLA_EXPORT int32_t carla_get_current_midi_program_index(unsigned int pluginId); | |||
| /*! | |||
| * TODO | |||
| * Get a plugin's default parameter value. | |||
| */ | |||
| CARLA_EXPORT float carla_get_default_parameter_value(unsigned int pluginId, uint32_t parameterId); | |||
| /*! | |||
| * TODO | |||
| * Get a plugin's current parameter value. | |||
| */ | |||
| CARLA_EXPORT float carla_get_current_parameter_value(unsigned int pluginId, uint32_t parameterId); | |||
| /*! | |||
| * TODO | |||
| * Get a plugin's input peak value.\n | |||
| * \a portId must only be either 1 or 2 | |||
| */ | |||
| CARLA_EXPORT float carla_get_input_peak_value(unsigned int pluginId, unsigned short portId); | |||
| /*! | |||
| * TODO | |||
| * Get a plugin's output peak value.\n | |||
| * \a portId must only be either 1 or 2 | |||
| */ | |||
| CARLA_EXPORT float carla_get_output_peak_value(unsigned int pluginId, unsigned short portId); | |||
| /*! | |||
| * TODO | |||
| * Enable a plugin's option. | |||
| * \see PluginOptions | |||
| */ | |||
| CARLA_EXPORT void carla_set_option(unsigned int pluginId, unsigned int option, bool yesNo); | |||
| /*! | |||
| * TODO | |||
| * Enable or disable a plugin according to \a onOff. | |||
| */ | |||
| CARLA_EXPORT void carla_set_active(unsigned int pluginId, bool onOff); | |||
| /*! | |||
| * TODO | |||
| * Change a plugin's internal drywet value to \a value. | |||
| */ | |||
| CARLA_EXPORT void carla_set_drywet(unsigned int pluginId, float value); | |||
| /*! | |||
| * TODO | |||
| * Change a plugin's internal volume value to \a value. | |||
| */ | |||
| CARLA_EXPORT void carla_set_volume(unsigned int pluginId, float value); | |||
| /*! | |||
| * TODO | |||
| * Change a plugin's internal balance-left value to \a value. | |||
| */ | |||
| CARLA_EXPORT void carla_set_balance_left(unsigned int pluginId, float value); | |||
| /*! | |||
| * TODO | |||
| * Change a plugin's internal balance-right value to \a value. | |||
| */ | |||
| CARLA_EXPORT void carla_set_balance_right(unsigned int pluginId, float value); | |||
| /*! | |||
| * TODO | |||
| * Change a plugin's internal panning value to \a value. | |||
| */ | |||
| CARLA_EXPORT void carla_set_panning(unsigned int pluginId, float value); | |||
| /*! | |||
| * TODO | |||
| * Change a plugin's internal control channel to \a channel. | |||
| */ | |||
| CARLA_EXPORT void carla_set_ctrl_channel(unsigned int pluginId, int8_t channel); | |||
| /*! | |||
| * TODO | |||
| * Set the plugin's parameter \a parameterId to \a value. | |||
| */ | |||
| CARLA_EXPORT void carla_set_parameter_value(unsigned int pluginId, uint32_t parameterId, float value); | |||
| /*! | |||
| * TODO | |||
| * Set the plugin's parameter \a parameterId midi channel to \a channel. | |||
| */ | |||
| CARLA_EXPORT void carla_set_parameter_midi_channel(unsigned int pluginId, uint32_t parameterId, uint8_t channel); | |||
| /*! | |||
| * TODO | |||
| * Set the plugin's parameter \a parameterId midi cc to \a cc. | |||
| */ | |||
| CARLA_EXPORT void carla_set_parameter_midi_cc(unsigned int pluginId, uint32_t parameterId, int16_t cc); | |||
| /*! | |||
| * TODO | |||
| * Change a plugin's program to \a programId. | |||
| */ | |||
| CARLA_EXPORT void carla_set_program(unsigned int pluginId, uint32_t programId); | |||
| /*! | |||
| * TODO | |||
| * Change a plugin's midi program to \a midiProgramId. | |||
| */ | |||
| CARLA_EXPORT void carla_set_midi_program(unsigned int pluginId, uint32_t midiProgramId); | |||
| /*! | |||
| * TODO | |||
| * Set a plugin's custom data set. | |||
| */ | |||
| CARLA_EXPORT void carla_set_custom_data(unsigned int pluginId, const char* type, const char* key, const char* value); | |||
| /*! | |||
| * TODO | |||
| * Set a plugin's chunk data. | |||
| */ | |||
| CARLA_EXPORT void carla_set_chunk_data(unsigned int pluginId, const char* chunkData); | |||
| /*! | |||
| * TODO | |||
| * Tell a plugin to prepare for save.\n | |||
| * This should be called before carla_get_custom_data_count(). | |||
| */ | |||
| CARLA_EXPORT void carla_prepare_for_save(unsigned int pluginId); | |||
| /*! | |||
| * TODO | |||
| * Send a single note of a plugin.\n | |||
| * If \a note if 0, note-off is sent; note-on otherwise. | |||
| */ | |||
| CARLA_EXPORT void carla_send_midi_note(unsigned int pluginId, uint8_t channel, uint8_t note, uint8_t velocity); | |||
| /*! | |||
| * TODO | |||
| * Tell a plugin to show its own custom UI. | |||
| * \see PLUGIN_HAS_GUI | |||
| */ | |||
| CARLA_EXPORT void carla_show_gui(unsigned int pluginId, bool yesNo); | |||
| /*! | |||
| * TODO | |||
| * Get the current engine buffer size. | |||
| */ | |||
| CARLA_EXPORT uint32_t carla_get_buffer_size(); | |||
| /*! | |||
| * TODO | |||
| * Get the current engine sample rate. | |||
| */ | |||
| CARLA_EXPORT double carla_get_sample_rate(); | |||
| CARLA_EXPORT double carla_get_sample_rate(); | |||
| /*! | |||
| * TODO | |||
| * Get the last error. | |||
| */ | |||
| CARLA_EXPORT const char* carla_get_last_error(); | |||
| /*! | |||
| * TODO | |||
| * Get the current engine OSC URL. | |||
| */ | |||
| CARLA_EXPORT const char* carla_get_host_osc_url(); | |||
| /*! | |||
| * TODO | |||
| * Send NSM announce message. | |||
| */ | |||
| CARLA_EXPORT void carla_nsm_announce(const char* url, int pid); | |||
| /*! | |||
| * TODO | |||
| * Reply to NSM open message. | |||
| * \see CALLBACK_NSM_OPEN | |||
| */ | |||
| CARLA_EXPORT void carla_nsm_reply_open(); | |||
| /*! | |||
| * TODO | |||
| * Reply to NSM save message. | |||
| * \see CALLBACK_NSM_SAVE | |||
| */ | |||
| CARLA_EXPORT void carla_nsm_reply_save(); | |||
| @@ -882,6 +882,30 @@ void CarlaEngine::removeAllPlugins() | |||
| carla_debug("CarlaEngine::removeAllPlugins() - END"); | |||
| } | |||
| const char* CarlaEngine::renamePlugin(const unsigned int id, const char* const newName) | |||
| { | |||
| setLastError("Not implemented yet"); | |||
| return nullptr; | |||
| } | |||
| bool CarlaEngine::clonePlugin(const unsigned int id) | |||
| { | |||
| setLastError("Not implemented yet"); | |||
| return false; | |||
| } | |||
| bool CarlaEngine::replacePlugin(const unsigned int id) | |||
| { | |||
| setLastError("Not implemented yet"); | |||
| return false; | |||
| } | |||
| bool CarlaEngine::switchPlugins(const unsigned int idA, const unsigned int idB) | |||
| { | |||
| setLastError("Not implemented yet"); | |||
| return false; | |||
| } | |||
| CarlaPlugin* CarlaEngine::getPlugin(const unsigned int id) const | |||
| { | |||
| carla_debug("CarlaEngine::getPlugin(%i) [count:%i]", id, kData->curPluginCount); | |||
| @@ -1148,14 +1172,16 @@ void CarlaEngine::setCallback(const CallbackFunc func, void* const ptr) | |||
| // ----------------------------------------------------------------------- | |||
| // Patchbay | |||
| void CarlaEngine::patchbayConnect(int, int) | |||
| bool CarlaEngine::patchbayConnect(int, int) | |||
| { | |||
| // nothing | |||
| setLastError("Unsupported operation"); | |||
| return false; | |||
| } | |||
| void CarlaEngine::patchbayDisconnect(int) | |||
| bool CarlaEngine::patchbayDisconnect(int) | |||
| { | |||
| // nothing | |||
| setLastError("Unsupported operation"); | |||
| return false; | |||
| } | |||
| void CarlaEngine::patchbayRefresh() | |||
| @@ -744,25 +744,37 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| // Patchbay | |||
| void patchbayConnect(int portA, int portB) | |||
| bool patchbayConnect(int portA, int portB) | |||
| { | |||
| CARLA_ASSERT(fClient != nullptr); | |||
| if (fClient == nullptr) | |||
| return; | |||
| { | |||
| setLastError("Invalid JACK client"); | |||
| return false; | |||
| } | |||
| const char* const portNameA = getFullPortName(portA).toUtf8().constData(); | |||
| const char* const portNameB = getFullPortName(portB).toUtf8().constData(); | |||
| jack_connect(fClient, portNameA, portNameB); | |||
| if (jack_connect(fClient, portNameA, portNameB) != 0) | |||
| { | |||
| setLastError("JACK operation failed"); | |||
| return false; | |||
| } | |||
| return true; | |||
| } | |||
| void patchbayDisconnect(int connectionId) | |||
| bool patchbayDisconnect(int connectionId) | |||
| { | |||
| CARLA_ASSERT(fClient != nullptr); | |||
| if (fClient == nullptr) | |||
| return; | |||
| { | |||
| setLastError("Invalid JACK client"); | |||
| return false; | |||
| } | |||
| for (int i=0, count=fUsedConnections.count(); i < count; i++) | |||
| { | |||
| @@ -771,10 +783,18 @@ public: | |||
| const char* const portNameA = getFullPortName(fUsedConnections[i].portOut).toUtf8().constData(); | |||
| const char* const portNameB = getFullPortName(fUsedConnections[i].portIn).toUtf8().constData(); | |||
| jack_disconnect(fClient, portNameA, portNameB); | |||
| break; | |||
| if (jack_disconnect(fClient, portNameA, portNameB) != 0) | |||
| { | |||
| setLastError("JACK operation failed"); | |||
| return false; | |||
| } | |||
| return true; | |||
| } | |||
| } | |||
| setLastError("Failed to find the requested connection"); | |||
| return false; | |||
| } | |||
| void patchbayRefresh() | |||
| @@ -666,7 +666,9 @@ static const PluginDescriptor audiofileDesc = { | |||
| .process = audiofile_process, | |||
| .get_state = NULL, | |||
| .set_state = NULL | |||
| .set_state = NULL, | |||
| .dispatcher = NULL | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| @@ -86,7 +86,9 @@ static const PluginDescriptor bypassDesc = { | |||
| .process = bypass_process, | |||
| .get_state = NULL, | |||
| .set_state = NULL | |||
| .set_state = NULL, | |||
| .dispatcher = NULL | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| @@ -296,7 +296,9 @@ static const PluginDescriptor lfoDesc = { | |||
| .process = lfo_process, | |||
| .get_state = NULL, | |||
| .set_state = NULL | |||
| .set_state = NULL, | |||
| .dispatcher = NULL | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| @@ -122,7 +122,9 @@ static const PluginDescriptor midiSplitDesc = { | |||
| .process = midiSplit_process, | |||
| .get_state = NULL, | |||
| .set_state = NULL | |||
| .set_state = NULL, | |||
| .dispatcher = NULL | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| @@ -103,7 +103,9 @@ static const PluginDescriptor midiThroughDesc = { | |||
| .process = midiThrough_process, | |||
| .get_state = NULL, | |||
| .set_state = NULL | |||
| .set_state = NULL, | |||
| .dispatcher = NULL | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| @@ -185,7 +185,9 @@ static const PluginDescriptor midiTransposeDesc = { | |||
| .process = midiTranspose_process, | |||
| .get_state = NULL, | |||
| .set_state = NULL | |||
| .set_state = NULL, | |||
| .dispatcher = NULL | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| @@ -65,7 +65,9 @@ static const PluginDescriptor nekofilterDesc = { | |||
| .process = nekofilter_process, | |||
| .get_state = NULL, | |||
| .set_state = NULL | |||
| .set_state = NULL, | |||
| .dispatcher = NULL | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| @@ -37,6 +37,7 @@ using CarlaBackend::CarlaEngine; | |||
| using CarlaBackend::CarlaPlugin; | |||
| using CarlaBackend::CallbackFunc; | |||
| using CarlaBackend::EngineOptions; | |||
| using CarlaBackend::EngineTimeInfo; | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| // Single, standalone engine | |||
| @@ -467,7 +468,7 @@ void carla_set_engine_callback(CarlaCallbackFunc func, void* ptr) | |||
| standalone.engine->setCallback(func, ptr); | |||
| } | |||
| void carla_set_engine_option(CarlaBackend::OptionsType option, int value, const char* valueStr) | |||
| void carla_set_engine_option(CarlaOptionsType option, int value, const char* valueStr) | |||
| { | |||
| carla_debug("carla_set_engine_option(%s, %i, \"%s\")", CarlaBackend::OptionsType2Str(option), value, valueStr); | |||
| @@ -707,7 +708,7 @@ uint32_t carla_get_current_transport_frame() | |||
| if (standalone.engine != nullptr) | |||
| { | |||
| const CarlaBackend::EngineTimeInfo& timeInfo(standalone.engine->getTimeInfo()); | |||
| const EngineTimeInfo& timeInfo(standalone.engine->getTimeInfo()); | |||
| return timeInfo.frame; | |||
| } | |||
| @@ -722,7 +723,7 @@ const CarlaTransportInfo* carla_get_transport_info() | |||
| if (standalone.engine != nullptr) | |||
| { | |||
| const CarlaBackend::EngineTimeInfo& timeInfo(standalone.engine->getTimeInfo()); | |||
| const EngineTimeInfo& timeInfo(standalone.engine->getTimeInfo()); | |||
| info.playing = timeInfo.playing; | |||
| info.frame = timeInfo.frame; | |||
| @@ -757,7 +758,7 @@ const CarlaTransportInfo* carla_get_transport_info() | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| bool carla_add_plugin(CarlaBackend::BinaryType btype, CarlaBackend::PluginType ptype, const char* filename, const char* const name, const char* label, const void* extraStuff) | |||
| bool carla_add_plugin(CarlaBinaryType btype, CarlaPluginType ptype, const char* filename, const char* const name, const char* label, const void* extraStuff) | |||
| { | |||
| carla_debug("carla_add_plugin(%s, %s, \"%s\", \"%s\", \"%s\", %p)", CarlaBackend::BinaryType2Str(btype), CarlaBackend::PluginType2Str(ptype), filename, name, label, extraStuff); | |||
| CARLA_ASSERT(standalone.engine != nullptr); | |||
| @@ -845,8 +846,11 @@ bool carla_load_plugin_state(unsigned int pluginId, const char* filename) | |||
| carla_debug("carla_load_plugin_state(%i, \"%s\")", pluginId, filename); | |||
| CARLA_ASSERT(standalone.engine != nullptr); | |||
| if (standalone.engine == nullptr) | |||
| if (standalone.engine == nullptr || ! standalone.engine->isRunning()) | |||
| { | |||
| standalone.lastError = "Engine is not started"; | |||
| return false; | |||
| } | |||
| if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId)) | |||
| return plugin->loadStateFromFile(filename); | |||
| @@ -861,7 +865,10 @@ bool carla_save_plugin_state(unsigned int pluginId, const char* filename) | |||
| CARLA_ASSERT(standalone.engine != nullptr); | |||
| if (standalone.engine == nullptr) | |||
| { | |||
| standalone.lastError = "Engine is not started"; | |||
| return false; | |||
| } | |||
| if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId)) | |||
| return plugin->saveStateToFile(filename); | |||
| @@ -1372,7 +1379,6 @@ const char* carla_get_program_name(unsigned int pluginId, uint32_t programId) | |||
| if (programId < plugin->programCount()) | |||
| { | |||
| plugin->getProgramName(programId, programName); | |||
| return programName; | |||
| } | |||
| @@ -1400,7 +1406,6 @@ const char* carla_get_midi_program_name(unsigned int pluginId, uint32_t midiProg | |||
| if (midiProgramId < plugin->midiProgramCount()) | |||
| { | |||
| plugin->getMidiProgramName(midiProgramId, midiProgramName); | |||
| return midiProgramName; | |||
| } | |||
| @@ -1426,7 +1431,6 @@ const char* carla_get_real_plugin_name(unsigned int pluginId) | |||
| if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId)) | |||
| { | |||
| plugin->getRealName(realPluginName); | |||
| return realPluginName; | |||
| } | |||
| @@ -1520,17 +1524,7 @@ float carla_get_input_peak_value(unsigned int pluginId, unsigned short portId) | |||
| if (standalone.engine == nullptr) | |||
| return 0.0f; | |||
| if (pluginId >= standalone.engine->currentPluginCount()) | |||
| { | |||
| carla_stderr2("carla_get_input_peak_value(%i, %i) - invalid plugin value", pluginId, portId); | |||
| return 0.0f; | |||
| } | |||
| if (portId == 1 || portId == 2) | |||
| return standalone.engine->getInputPeak(pluginId, portId); | |||
| carla_stderr2("carla_get_input_peak_value(%i, %i) - invalid port value", pluginId, portId); | |||
| return 0.0f; | |||
| return standalone.engine->getInputPeak(pluginId, portId); | |||
| } | |||
| float carla_get_output_peak_value(unsigned int pluginId, unsigned short portId) | |||
| @@ -1541,17 +1535,7 @@ float carla_get_output_peak_value(unsigned int pluginId, unsigned short portId) | |||
| if (standalone.engine == nullptr) | |||
| return 0.0f; | |||
| if (pluginId >= standalone.engine->currentPluginCount()) | |||
| { | |||
| carla_stderr2("carla_get_input_peak_value(%i, %i) - invalid plugin value", pluginId, portId); | |||
| return 0.0f; | |||
| } | |||
| if (portId == 1 || portId == 2) | |||
| return standalone.engine->getOutputPeak(pluginId, portId); | |||
| carla_stderr2("carla_get_output_peak_value(%i, %i) - invalid port value", pluginId, portId); | |||
| return 0.0f; | |||
| return standalone.engine->getOutputPeak(pluginId, portId); | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| @@ -1748,6 +1732,8 @@ void carla_set_parameter_midi_cc(unsigned int pluginId, uint32_t parameterId, in | |||
| carla_stderr2("carla_set_parameter_midi_cc(%i, %i, %i) - could not find plugin", pluginId, parameterId, cc); | |||
| } | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| void carla_set_program(unsigned int pluginId, uint32_t programId) | |||
| { | |||
| carla_debug("carla_set_program(%i, %i)", pluginId, programId); | |||
| @@ -1910,7 +1896,10 @@ const char* carla_get_host_osc_url() | |||
| CARLA_ASSERT(standalone.engine != nullptr); | |||
| if (standalone.engine == nullptr) | |||
| { | |||
| standalone.lastError = "Engine is not started"; | |||
| return nullptr; | |||
| } | |||
| return standalone.engine->getOscServerPathTCP(); | |||
| } | |||