@@ -73,7 +73,7 @@ def create_stream(baseurl): | |||
return stream | |||
# --------------------------------------------------------------------------------------------------------------------- | |||
# Carla Host object for connecting to the REST API | |||
# Carla Host object for connecting to the REST API backend | |||
class CarlaHostQtWeb(CarlaHostQtNull): | |||
def __init__(self): | |||
@@ -126,10 +126,11 @@ class CarlaHostQtWeb(CarlaHostQtNull): | |||
self.fEngineCallback(None, action, pluginId, value1, value2, value3, valueStr) | |||
elif line == "Connection: close": | |||
closed = True | |||
if not closed: | |||
self.stream = create_stream(self.baseurl) | |||
closed = True | |||
if closed: | |||
self.stream = create_stream(self.baseurl) | |||
stream.close() | |||
def is_engine_running(self): | |||
@@ -143,229 +144,229 @@ class CarlaHostQtWeb(CarlaHostQtNull): | |||
return requests.get("{}/set_engine_about_to_close".format(self.baseurl)).status_code == 200 | |||
def set_engine_option(self, option, value, valueStr): | |||
return | |||
requests.get("{}/set_engine_option/{}/{}/{}".format(self.baseurl, option, value, valueStr)) | |||
def load_file(self, filename): | |||
return False | |||
return requests.get("{}/load_file/{}".format(self.baseurl, filename)).status_code == 200 | |||
def load_project(self, filename): | |||
return False | |||
return requests.get("{}/load_project/{}".format(self.baseurl, filename)).status_code == 200 | |||
def save_project(self, filename): | |||
return False | |||
return requests.get("{}/save_project/{}".format(self.baseurl, filename)).status_code == 200 | |||
def patchbay_connect(self, groupIdA, portIdA, groupIdB, portIdB): | |||
return False | |||
return requests.get("{}/patchbay_connect/{}/{}/{}/{}".format(self.baseurl, groupIdA, portIdA, groupIdB, portIdB)).status_code == 200 | |||
def patchbay_disconnect(self, connectionId): | |||
return False | |||
return requests.get("{}/patchbay_disconnect/{}".format(self.baseurl, connectionId)).status_code == 200 | |||
def patchbay_refresh(self, external): | |||
return False | |||
return requests.get("{}/patchbay_refresh/{}".format(self.baseurl, external)).status_code == 200 | |||
def transport_play(self): | |||
return | |||
requests.get("{}/transport_play".format(self.baseurl)) | |||
def transport_pause(self): | |||
return | |||
requests.get("{}/transport_pause".format(self.baseurl)) | |||
def transport_bpm(self, bpm): | |||
return | |||
requests.get("{}/transport_bpm/{}".format(self.baseurl, bpm)) | |||
def transport_relocate(self, frame): | |||
return | |||
requests.get("{}/transport_relocate/{}".format(self.baseurl, frame)) | |||
def get_current_transport_frame(self): | |||
return 0 | |||
return int(requests.get("{}/get_current_transport_frame".format(self.baseurl)).text) | |||
def get_transport_info(self): | |||
return PyCarlaTransportInfo | |||
return requests.get("{}/get_transport_info".format(self.baseurl)).json() | |||
def get_current_plugin_count(self): | |||
return 0 | |||
return int(requests.get("{}/get_current_plugin_count".format(self.baseurl)).text) | |||
def get_max_plugin_number(self): | |||
return 0 | |||
return int(requests.get("{}/get_max_plugin_number".format(self.baseurl)).text) | |||
def add_plugin(self, btype, ptype, filename, name, label, uniqueId, extraPtr, options): | |||
return False | |||
return requests.get("{}/add_plugin/{}/{}/{}/{}/{}/{}/{}/{}".format(self.baseurl, btype, ptype, filename, name, label, uniqueId, extraPtr, options)).status_code == 200 | |||
def remove_plugin(self, pluginId): | |||
return False | |||
return requests.get("{}/remove_plugin/{}".format(self.baseurl, pluginId)).status_code == 200 | |||
def remove_all_plugins(self): | |||
return False | |||
return requests.get("{}/remove_all_plugins".format(self.baseurl)).status_code == 200 | |||
def rename_plugin(self, pluginId, newName): | |||
return "" | |||
return requests.get("{}/rename_plugin/{}/{}".format(self.baseurl, pluginId, newName)).text | |||
def clone_plugin(self, pluginId): | |||
return False | |||
return requests.get("{}/clone_plugin/{}".format(self.baseurl, pluginId)).status_code == 200 | |||
def replace_plugin(self, pluginId): | |||
return False | |||
return requests.get("{}/replace_plugin/{}".format(self.baseurl, pluginId)).status_code == 200 | |||
def switch_plugins(self, pluginIdA, pluginIdB): | |||
return False | |||
return requests.get("{}/switch_plugins/{}/{}".format(self.baseurl, pluginIdA, pluginIdB)).status_code == 200 | |||
def load_plugin_state(self, pluginId, filename): | |||
return False | |||
return requests.get("{}/load_plugin_state/{}/{}".format(self.baseurl, pluginId, filename)).status_code == 200 | |||
def save_plugin_state(self, pluginId, filename): | |||
return False | |||
return requests.get("{}/save_plugin_state/{}/{}".format(self.baseurl, pluginId, filename)).status_code == 200 | |||
def export_plugin_lv2(self, pluginId, lv2path): | |||
return False | |||
return requests.get("{}/export_plugin_lv2/{}/{}".format(self.baseurl, pluginId, lv2path)).status_code == 200 | |||
def get_plugin_info(self, pluginId): | |||
return PyCarlaPluginInfo | |||
return requests.get("{}/get_plugin_info/{}".format(self.baseurl, pluginId)).json() | |||
def get_audio_port_count_info(self, pluginId): | |||
return PyCarlaPortCountInfo | |||
return requests.get("{}/get_audio_port_count_info/{}".format(self.baseurl, pluginId)).json() | |||
def get_midi_port_count_info(self, pluginId): | |||
return PyCarlaPortCountInfo | |||
return requests.get("{}/get_midi_port_count_info/{}".format(self.baseurl, pluginId)).json() | |||
def get_parameter_count_info(self, pluginId): | |||
return PyCarlaPortCountInfo | |||
return requests.get("{}/get_parameter_count_info/{}".format(self.baseurl, pluginId)).json() | |||
def get_parameter_info(self, pluginId, parameterId): | |||
return PyCarlaParameterInfo | |||
return requests.get("{}/get_parameter_info/{}/{}".format(self.baseurl, pluginId, parameterId)).json() | |||
def get_parameter_scalepoint_info(self, pluginId, parameterId, scalePointId): | |||
return PyCarlaScalePointInfo | |||
return requests.get("{}/get_parameter_scalepoint_info/{}/{}/{}".format(self.baseurl, pluginId, parameterId, scalePointId)).json() | |||
def get_parameter_data(self, pluginId, parameterId): | |||
return PyParameterData | |||
return requests.get("{}/get_parameter_data/{}/{}".format(self.baseurl, pluginId, parameterId)).json() | |||
def get_parameter_ranges(self, pluginId, parameterId): | |||
return PyParameterRanges | |||
return requests.get("{}/get_parameter_ranges/{}/{}".format(self.baseurl, pluginId, parameterId)).json() | |||
def get_midi_program_data(self, pluginId, midiProgramId): | |||
return PyMidiProgramData | |||
return requests.get("{}/get_midi_program_data/{}/{}".format(self.baseurl, pluginId, midiProgramId)).json() | |||
def get_custom_data(self, pluginId, customDataId): | |||
return PyCustomData | |||
return requests.get("{}/get_custom_data/{}/{}".format(self.baseurl, pluginId, customDataId)).json() | |||
def get_chunk_data(self, pluginId): | |||
return "" | |||
return requests.get("{}/get_chunk_data/{}".format(self.baseurl, pluginId)).text | |||
def get_parameter_count(self, pluginId): | |||
return 0 | |||
return int(requests.get("{}/get_parameter_count/{}".format(self.baseurl, pluginId)).text) | |||
def get_program_count(self, pluginId): | |||
return 0 | |||
return int(requests.get("{}/get_program_count/{}".format(self.baseurl, pluginId)).text) | |||
def get_midi_program_count(self, pluginId): | |||
return 0 | |||
return int(requests.get("{}/get_midi_program_count/{}".format(self.baseurl, pluginId)).text) | |||
def get_custom_data_count(self, pluginId): | |||
return 0 | |||
return int(requests.get("{}/get_custom_data_count/{}".format(self.baseurl, pluginId)).text) | |||
def get_parameter_text(self, pluginId, parameterId): | |||
return "" | |||
return requests.get("{}/get_parameter_text/{}/{}".format(self.baseurl, pluginId, parameterId)).text | |||
def get_program_name(self, pluginId, programId): | |||
return "" | |||
return requests.get("{}/get_program_name/{}/{}".format(self.baseurl, pluginId, programId)).text | |||
def get_midi_program_name(self, pluginId, midiProgramId): | |||
return "" | |||
return requests.get("{}/get_midi_program_name/{}/{}".format(self.baseurl, pluginId, midiProgramId)).text | |||
def get_real_plugin_name(self, pluginId): | |||
return "" | |||
return requests.get("{}/get_real_plugin_name/{}".format(self.baseurl, pluginId)).text | |||
def get_current_program_index(self, pluginId): | |||
return 0 | |||
return int(requests.get("{}/get_custom_data_count/{}".format(self.baseurl, pluginId)).text) | |||
def get_current_midi_program_index(self, pluginId): | |||
return 0 | |||
return int(requests.get("{}/get_custom_data_count/{}".format(self.baseurl, pluginId)).text) | |||
def get_default_parameter_value(self, pluginId, parameterId): | |||
return 0.0 | |||
return float(requests.get("{}/get_default_parameter_value/{}/{}".format(self.baseurl, pluginId, parameterId)).text) | |||
def get_current_parameter_value(self, pluginId, parameterId): | |||
return 0.0 | |||
return float(requests.get("{}/get_current_parameter_value/{}/{}".format(self.baseurl, pluginId, parameterId)).text) | |||
def get_internal_parameter_value(self, pluginId, parameterId): | |||
return 0.0 | |||
return float(requests.get("{}/get_internal_parameter_value/{}/{}".format(self.baseurl, pluginId, parameterId)).text) | |||
def get_input_peak_value(self, pluginId, isLeft): | |||
return 0.0 | |||
return float(requests.get("{}/get_input_peak_value/{}/{}".format(self.baseurl, pluginId, isLeft)).text) | |||
def get_output_peak_value(self, pluginId, isLeft): | |||
return 0.0 | |||
return float(requests.get("{}/get_output_peak_value/{}/{}".format(self.baseurl, pluginId, isLeft)).text) | |||
def set_option(self, pluginId, option, yesNo): | |||
return | |||
requests.get("{}/set_option/{}/{}/{}".format(self.baseurl, pluginId, option, yesNo)) | |||
def set_active(self, pluginId, onOff): | |||
return | |||
requests.get("{}/set_active/{}/{}".format(self.baseurl, pluginId, onOff)) | |||
def set_drywet(self, pluginId, value): | |||
return | |||
requests.get("{}/set_drywet/{}/{}".format(self.baseurl, pluginId, value)) | |||
def set_volume(self, pluginId, value): | |||
return | |||
requests.get("{}/set_volume/{}/{}".format(self.baseurl, pluginId, value)) | |||
def set_balance_left(self, pluginId, value): | |||
return | |||
requests.get("{}/set_balance_left/{}/{}".format(self.baseurl, pluginId, value)) | |||
def set_balance_right(self, pluginId, value): | |||
return | |||
requests.get("{}/set_balance_right/{}/{}".format(self.baseurl, pluginId, value)) | |||
def set_panning(self, pluginId, value): | |||
return | |||
requests.get("{}/set_panning/{}/{}".format(self.baseurl, pluginId, value)) | |||
def set_ctrl_channel(self, pluginId, channel): | |||
return | |||
requests.get("{}/set_ctrl_channel/{}/{}".format(self.baseurl, pluginId, channel)) | |||
def set_parameter_value(self, pluginId, parameterId, value): | |||
return | |||
requests.get("{}/set_parameter_value/{}/{}/{}".format(self.baseurl, pluginId, parameterId, value)) | |||
def set_parameter_midi_channel(self, pluginId, parameterId, channel): | |||
return | |||
requests.get("{}/set_parameter_midi_channel/{}/{}/{}".format(self.baseurl, pluginId, parameterId, channel)) | |||
def set_parameter_midi_cc(self, pluginId, parameterId, cc): | |||
return | |||
requests.get("{}/set_parameter_midi_cc/{}/{}/{}".format(self.baseurl, pluginId, parameterId, cc)) | |||
def set_program(self, pluginId, programId): | |||
return | |||
requests.get("{}/set_program/{}/{}".format(self.baseurl, pluginId, programId)) | |||
def set_midi_program(self, pluginId, midiProgramId): | |||
return | |||
requests.get("{}/set_midi_program/{}/{}".format(self.baseurl, pluginId, midiProgramId)) | |||
def set_custom_data(self, pluginId, type_, key, value): | |||
return | |||
requests.get("{}/set_custom_data/{}/{}/{}/{}".format(self.baseurl, pluginId, type_, key, value)) | |||
def set_chunk_data(self, pluginId, chunkData): | |||
return | |||
requests.get("{}/set_chunk_data/{}/{}".format(self.baseurl, pluginId, chunkData)) | |||
def prepare_for_save(self, pluginId): | |||
return | |||
requests.get("{}/prepare_for_save/{}".format(self.baseurl, pluginId)) | |||
def reset_parameters(self, pluginId): | |||
return | |||
requests.get("{}/reset_parameters/{}".format(self.baseurl, pluginId)) | |||
def randomize_parameters(self, pluginId): | |||
return | |||
requests.get("{}/randomize_parameters/{}".format(self.baseurl, pluginId)) | |||
def send_midi_note(self, pluginId, channel, note, velocity): | |||
return | |||
requests.get("{}/send_midi_note/{}/{}/{}/{}".format(self.baseurl, pluginId, channel, note, velocity)) | |||
def get_buffer_size(self): | |||
return 0 | |||
return int(requests.get("{}/get_buffer_size".format(self.baseurl)).text) | |||
def get_sample_rate(self): | |||
return 0.0 | |||
return float(requests.get("{}/get_sample_rate".format(self.baseurl)).text) | |||
def get_last_error(self): | |||
return requests.get("{}/get_last_error".format(self.baseurl)).text | |||
def get_host_osc_url_tcp(self): | |||
return "" | |||
return requests.get("{}/get_host_osc_url_tcp".format(self.baseurl)).text | |||
def get_host_osc_url_udp(self): | |||
return "" | |||
return requests.get("{}/get_host_osc_url_udp".format(self.baseurl)).text | |||
# --------------------------------------------------------------------------------------------------------------------- | |||
# TESTING | |||
@@ -58,6 +58,8 @@ const char* str_buf_bool(const uint value) | |||
return strBuf; | |||
} | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
const char* str_buf_float(const double value) | |||
{ | |||
std::snprintf(strBuf, kStrBufSize, "%f", value); | |||
@@ -90,6 +92,8 @@ const char* str_buf_float_array(const double* const values, const char sep) | |||
return strBuf; | |||
} | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
const char* str_buf_string(const char* const string) | |||
{ | |||
std::strncpy(strBuf, string, kStrBufSize); | |||
@@ -118,6 +122,15 @@ const char* str_buf_string_array(const char* const* const array) | |||
return strBuf; | |||
} | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
const char* str_buf_int(const int value) | |||
{ | |||
std::snprintf(strBuf, kStrBufSize, "%i", value); | |||
strBuf[kStrBufSize] = '\0'; | |||
return strBuf; | |||
} | |||
const char* str_buf_uint(const uint value) | |||
{ | |||
std::snprintf(strBuf, kStrBufSize, "%u", value); | |||
@@ -125,6 +138,13 @@ const char* str_buf_uint(const uint value) | |||
return strBuf; | |||
} | |||
const char* str_buf_uint64(const uint64_t value) | |||
{ | |||
std::snprintf(strBuf, kStrBufSize, P_UINT64, value); | |||
strBuf[kStrBufSize] = '\0'; | |||
return strBuf; | |||
} | |||
const char* str_buf_uint_array(const uint* const values, const char sep) | |||
{ | |||
size_t bytesRead = 0; | |||
@@ -207,12 +227,12 @@ char* json_buf_add_array(char* jsonBufPtr, const char* const key, const T value, | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
// typedef const char* (*str_buf_bool_type)(const bool value); | |||
// | |||
// char* json_buf_add_bool(char* jsonBufPtr, const char* const key, const bool value) | |||
// { | |||
// return json_buf_add<bool, str_buf_bool_type>(jsonBufPtr, key, value, str_buf_bool); | |||
// } | |||
char* json_buf_add_bool(char* jsonBufPtr, const char* const key, const bool value) | |||
{ | |||
static const char* const kTrue = "true"; | |||
static const char* const kFalse = "false"; | |||
return json_buf_add(jsonBufPtr, key, value ? kTrue : kFalse, str_buf_string); | |||
} | |||
char* json_buf_add_float(char* jsonBufPtr, const char* const key, const double value) | |||
{ | |||
@@ -229,6 +249,11 @@ char* json_buf_add_string(char* jsonBufPtr, const char* const key, const char* c | |||
return json_buf_add(jsonBufPtr, key, value, str_buf_string); | |||
} | |||
char* json_buf_add_int(char* jsonBufPtr, const char* const key, const int value) | |||
{ | |||
return json_buf_add(jsonBufPtr, key, value, str_buf_int); | |||
} | |||
char* json_buf_add_uint(char* jsonBufPtr, const char* const key, const uint value) | |||
{ | |||
return json_buf_add(jsonBufPtr, key, value, str_buf_uint); | |||
@@ -239,6 +264,11 @@ char* json_buf_add_uint_array(char* jsonBufPtr, const char* const key, const uin | |||
return json_buf_add_array(jsonBufPtr, key, values, str_buf_uint_array); | |||
} | |||
char* json_buf_add_uint64(char* jsonBufPtr, const char* const key, const uint64_t value) | |||
{ | |||
return json_buf_add(jsonBufPtr, key, value, str_buf_uint64); | |||
} | |||
const char* json_buf_end(char* jsonBufPtr) | |||
{ | |||
*jsonBufPtr++ = '}'; | |||
@@ -20,6 +20,12 @@ | |||
#include "CarlaDefines.h" | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
# include <cstdint> | |||
#else | |||
# include <stdint.h> | |||
#endif | |||
// size buf | |||
const char* size_buf(const char* const buf); | |||
@@ -29,16 +35,20 @@ const char* str_buf_float(const double value); | |||
const char* str_buf_float_array(const double* const values, const char sep = '\n'); | |||
const char* str_buf_string(const char* const string); | |||
const char* str_buf_string_array(const char* const* const array); | |||
const char* str_buf_int(const int value); | |||
const char* str_buf_uint(const uint value); | |||
const char* str_buf_uint64(const uint64_t value); | |||
const char* str_buf_uint_array(const uint* const values, const char sep = '\n'); | |||
// json | |||
char* json_buf_start(); | |||
// char* json_buf_add_bool(char* jsonBufPtr, const char* const key, const bool value); | |||
char* json_buf_add_bool(char* jsonBufPtr, const char* const key, const bool value); | |||
char* json_buf_add_float(char* jsonBufPtr, const char* const key, const double value); | |||
char* json_buf_add_float_array(char* jsonBufPtr, const char* const key, const double* const values); | |||
char* json_buf_add_string(char* jsonBufPtr, const char* const key, const char* const value); | |||
char* json_buf_add_int(char* jsonBufPtr, const char* const key, const int value); | |||
char* json_buf_add_uint(char* jsonBufPtr, const char* const key, const uint value); | |||
char* json_buf_add_uint64(char* jsonBufPtr, const char* const key, const uint64_t value); | |||
char* json_buf_add_uint_array(char* jsonBufPtr, const char* const key, const uint* const values); | |||
const char* json_buf_end(char* jsonBufPtr); | |||
@@ -161,116 +161,169 @@ void handle_carla_set_engine_about_to_close(const std::shared_ptr<Session> sessi | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT void carla_set_engine_option(EngineOption option, int value, const char* valueStr); | |||
void carla_set_engine_option(EngineOption option, int value, const char* valueStr); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT bool carla_load_file(const char* filename); | |||
CARLA_EXPORT bool carla_load_project(const char* filename); | |||
CARLA_EXPORT bool carla_save_project(const char* filename); | |||
CARLA_EXPORT bool carla_patchbay_connect(uint groupIdA, uint portIdA, uint groupIdB, uint portIdB); | |||
CARLA_EXPORT bool carla_patchbay_disconnect(uint connectionId); | |||
CARLA_EXPORT bool carla_patchbay_refresh(bool external); | |||
bool carla_load_file(const char* filename); | |||
bool carla_load_project(const char* filename); | |||
bool carla_save_project(const char* filename); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT void carla_transport_play(); | |||
CARLA_EXPORT void carla_transport_pause(); | |||
CARLA_EXPORT void carla_transport_bpm(double bpm); | |||
CARLA_EXPORT void carla_transport_relocate(uint64_t frame); | |||
CARLA_EXPORT uint64_t carla_get_current_transport_frame(); | |||
CARLA_EXPORT const CarlaTransportInfo* carla_get_transport_info(); | |||
bool carla_patchbay_connect(uint groupIdA, uint portIdA, uint groupIdB, uint portIdB); | |||
bool carla_patchbay_disconnect(uint connectionId); | |||
bool carla_patchbay_refresh(bool external); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT uint32_t carla_get_current_plugin_count(); | |||
CARLA_EXPORT uint32_t carla_get_max_plugin_number(); | |||
CARLA_EXPORT bool carla_add_plugin(BinaryType btype, PluginType ptype, | |||
void handle_carla_transport_play(const std::shared_ptr<Session> session) | |||
{ | |||
carla_transport_play(); | |||
session->close(OK); | |||
} | |||
void handle_carla_transport_pause(const std::shared_ptr<Session> session) | |||
{ | |||
carla_transport_pause(); | |||
session->close(OK); | |||
} | |||
void handle_carla_transport_bpm(const std::shared_ptr<Session> session) | |||
{ | |||
const std::shared_ptr<const Request> request = session->get_request(); | |||
const double bpm = std::atof(request->get_path_parameter("bpm").c_str()); | |||
CARLA_SAFE_ASSERT_RETURN(bpm > 0.0,) // FIXME | |||
carla_transport_bpm(bpm); | |||
session->close(OK); | |||
} | |||
void handle_carla_transport_relocate(const std::shared_ptr<Session> session) | |||
{ | |||
const std::shared_ptr<const Request> request = session->get_request(); | |||
const long int frame = std::atol(request->get_path_parameter("frame").c_str()); | |||
CARLA_SAFE_ASSERT_RETURN(frame >= 0,) | |||
carla_transport_relocate(frame); | |||
session->close(OK); | |||
} | |||
void handle_carla_get_current_transport_frame(const std::shared_ptr<Session> session) | |||
{ | |||
const char* const buf = str_buf_uint64(carla_get_current_transport_frame()); | |||
session->close(OK, buf, { { "Content-Length", size_buf(buf) } } ); | |||
} | |||
void handle_carla_get_transport_info(const std::shared_ptr<Session> session) | |||
{ | |||
const CarlaTransportInfo* const info = carla_get_transport_info(); | |||
char* jsonBuf; | |||
jsonBuf = json_buf_start(); | |||
jsonBuf = json_buf_add_bool(jsonBuf, "playing", info->playing); | |||
jsonBuf = json_buf_add_uint64(jsonBuf, "frame", info->frame); | |||
jsonBuf = json_buf_add_int(jsonBuf, "bar", info->bar); | |||
jsonBuf = json_buf_add_int(jsonBuf, "beat", info->beat); | |||
jsonBuf = json_buf_add_int(jsonBuf, "tick", info->tick); | |||
jsonBuf = json_buf_add_float(jsonBuf, "bpm", info->bpm); | |||
const char* const buf = json_buf_end(jsonBuf); | |||
session->close(OK, buf, { { "Content-Length", size_buf(buf) } } ); | |||
} | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
uint32_t carla_get_current_plugin_count(); | |||
uint32_t carla_get_max_plugin_number(); | |||
bool carla_add_plugin(BinaryType btype, PluginType ptype, | |||
const char* filename, const char* name, const char* label, int64_t uniqueId, | |||
const void* extraPtr, uint options); | |||
CARLA_EXPORT bool carla_remove_plugin(uint pluginId); | |||
CARLA_EXPORT bool carla_remove_all_plugins(); | |||
bool carla_remove_plugin(uint pluginId); | |||
bool carla_remove_all_plugins(); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT const char* carla_rename_plugin(uint pluginId, const char* newName); | |||
CARLA_EXPORT bool carla_clone_plugin(uint pluginId); | |||
CARLA_EXPORT bool carla_replace_plugin(uint pluginId); | |||
CARLA_EXPORT bool carla_switch_plugins(uint pluginIdA, uint pluginIdB); | |||
const char* carla_rename_plugin(uint pluginId, const char* newName); | |||
bool carla_clone_plugin(uint pluginId); | |||
bool carla_replace_plugin(uint pluginId); | |||
bool carla_switch_plugins(uint pluginIdA, uint pluginIdB); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT bool carla_load_plugin_state(uint pluginId, const char* filename); | |||
CARLA_EXPORT bool carla_save_plugin_state(uint pluginId, const char* filename); | |||
CARLA_EXPORT bool carla_export_plugin_lv2(uint pluginId, const char* lv2path); | |||
bool carla_load_plugin_state(uint pluginId, const char* filename); | |||
bool carla_save_plugin_state(uint pluginId, const char* filename); | |||
bool carla_export_plugin_lv2(uint pluginId, const char* lv2path); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT const CarlaPluginInfo* carla_get_plugin_info(uint pluginId); | |||
CARLA_EXPORT const CarlaPortCountInfo* carla_get_audio_port_count_info(uint pluginId); | |||
CARLA_EXPORT const CarlaPortCountInfo* carla_get_midi_port_count_info(uint pluginId); | |||
CARLA_EXPORT const CarlaPortCountInfo* carla_get_parameter_count_info(uint pluginId); | |||
CARLA_EXPORT const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t parameterId); | |||
CARLA_EXPORT const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, uint32_t parameterId, uint32_t scalePointId); | |||
CARLA_EXPORT const ParameterData* carla_get_parameter_data(uint pluginId, uint32_t parameterId); | |||
CARLA_EXPORT const ParameterRanges* carla_get_parameter_ranges(uint pluginId, uint32_t parameterId); | |||
CARLA_EXPORT const MidiProgramData* carla_get_midi_program_data(uint pluginId, uint32_t midiProgramId); | |||
CARLA_EXPORT const CustomData* carla_get_custom_data(uint pluginId, uint32_t customDataId); | |||
CARLA_EXPORT const char* carla_get_chunk_data(uint pluginId); | |||
const CarlaPluginInfo* carla_get_plugin_info(uint pluginId); | |||
const CarlaPortCountInfo* carla_get_audio_port_count_info(uint pluginId); | |||
const CarlaPortCountInfo* carla_get_midi_port_count_info(uint pluginId); | |||
const CarlaPortCountInfo* carla_get_parameter_count_info(uint pluginId); | |||
const CarlaParameterInfo* carla_get_parameter_info(uint pluginId, uint32_t parameterId); | |||
const CarlaScalePointInfo* carla_get_parameter_scalepoint_info(uint pluginId, uint32_t parameterId, uint32_t scalePointId); | |||
const ParameterData* carla_get_parameter_data(uint pluginId, uint32_t parameterId); | |||
const ParameterRanges* carla_get_parameter_ranges(uint pluginId, uint32_t parameterId); | |||
const MidiProgramData* carla_get_midi_program_data(uint pluginId, uint32_t midiProgramId); | |||
const CustomData* carla_get_custom_data(uint pluginId, uint32_t customDataId); | |||
const char* carla_get_chunk_data(uint pluginId); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT uint32_t carla_get_parameter_count(uint pluginId); | |||
CARLA_EXPORT uint32_t carla_get_program_count(uint pluginId); | |||
CARLA_EXPORT uint32_t carla_get_midi_program_count(uint pluginId); | |||
CARLA_EXPORT uint32_t carla_get_custom_data_count(uint pluginId); | |||
CARLA_EXPORT const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId); | |||
CARLA_EXPORT const char* carla_get_program_name(uint pluginId, uint32_t programId); | |||
CARLA_EXPORT const char* carla_get_midi_program_name(uint pluginId, uint32_t midiProgramId); | |||
CARLA_EXPORT const char* carla_get_real_plugin_name(uint pluginId); | |||
CARLA_EXPORT int32_t carla_get_current_program_index(uint pluginId); | |||
CARLA_EXPORT int32_t carla_get_current_midi_program_index(uint pluginId); | |||
CARLA_EXPORT float carla_get_default_parameter_value(uint pluginId, uint32_t parameterId); | |||
CARLA_EXPORT float carla_get_current_parameter_value(uint pluginId, uint32_t parameterId); | |||
CARLA_EXPORT float carla_get_internal_parameter_value(uint pluginId, int32_t parameterId); | |||
CARLA_EXPORT float carla_get_input_peak_value(uint pluginId, bool isLeft); | |||
CARLA_EXPORT float carla_get_output_peak_value(uint pluginId, bool isLeft); | |||
uint32_t carla_get_parameter_count(uint pluginId); | |||
uint32_t carla_get_program_count(uint pluginId); | |||
uint32_t carla_get_midi_program_count(uint pluginId); | |||
uint32_t carla_get_custom_data_count(uint pluginId); | |||
const char* carla_get_parameter_text(uint pluginId, uint32_t parameterId); | |||
const char* carla_get_program_name(uint pluginId, uint32_t programId); | |||
const char* carla_get_midi_program_name(uint pluginId, uint32_t midiProgramId); | |||
const char* carla_get_real_plugin_name(uint pluginId); | |||
int32_t carla_get_current_program_index(uint pluginId); | |||
int32_t carla_get_current_midi_program_index(uint pluginId); | |||
float carla_get_default_parameter_value(uint pluginId, uint32_t parameterId); | |||
float carla_get_current_parameter_value(uint pluginId, uint32_t parameterId); | |||
float carla_get_internal_parameter_value(uint pluginId, int32_t parameterId); | |||
float carla_get_input_peak_value(uint pluginId, bool isLeft); | |||
float carla_get_output_peak_value(uint pluginId, bool isLeft); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT void carla_set_active(uint pluginId, bool onOff); | |||
CARLA_EXPORT void carla_set_drywet(uint pluginId, float value); | |||
CARLA_EXPORT void carla_set_volume(uint pluginId, float value); | |||
CARLA_EXPORT void carla_set_balance_left(uint pluginId, float value); | |||
CARLA_EXPORT void carla_set_balance_right(uint pluginId, float value); | |||
CARLA_EXPORT void carla_set_panning(uint pluginId, float value); | |||
CARLA_EXPORT void carla_set_ctrl_channel(uint pluginId, int8_t channel); | |||
CARLA_EXPORT void carla_set_option(uint pluginId, uint option, bool yesNo); | |||
void carla_set_active(uint pluginId, bool onOff); | |||
void carla_set_drywet(uint pluginId, float value); | |||
void carla_set_volume(uint pluginId, float value); | |||
void carla_set_balance_left(uint pluginId, float value); | |||
void carla_set_balance_right(uint pluginId, float value); | |||
void carla_set_panning(uint pluginId, float value); | |||
void carla_set_ctrl_channel(uint pluginId, int8_t channel); | |||
void carla_set_option(uint pluginId, uint option, bool yesNo); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT void carla_set_parameter_value(uint pluginId, uint32_t parameterId, float value); | |||
CARLA_EXPORT void carla_set_parameter_midi_channel(uint pluginId, uint32_t parameterId, uint8_t channel); | |||
CARLA_EXPORT void carla_set_parameter_midi_cc(uint pluginId, uint32_t parameterId, int16_t cc); | |||
CARLA_EXPORT void carla_set_program(uint pluginId, uint32_t programId); | |||
CARLA_EXPORT void carla_set_midi_program(uint pluginId, uint32_t midiProgramId); | |||
CARLA_EXPORT void carla_set_custom_data(uint pluginId, const char* type, const char* key, const char* value); | |||
CARLA_EXPORT void carla_set_chunk_data(uint pluginId, const char* chunkData); | |||
void carla_set_parameter_value(uint pluginId, uint32_t parameterId, float value); | |||
void carla_set_parameter_midi_channel(uint pluginId, uint32_t parameterId, uint8_t channel); | |||
void carla_set_parameter_midi_cc(uint pluginId, uint32_t parameterId, int16_t cc); | |||
void carla_set_program(uint pluginId, uint32_t programId); | |||
void carla_set_midi_program(uint pluginId, uint32_t midiProgramId); | |||
void carla_set_custom_data(uint pluginId, const char* type, const char* key, const char* value); | |||
void carla_set_chunk_data(uint pluginId, const char* chunkData); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT void carla_prepare_for_save(uint pluginId); | |||
CARLA_EXPORT void carla_reset_parameters(uint pluginId); | |||
CARLA_EXPORT void carla_randomize_parameters(uint pluginId); | |||
void carla_prepare_for_save(uint pluginId); | |||
void carla_reset_parameters(uint pluginId); | |||
void carla_randomize_parameters(uint pluginId); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT void carla_send_midi_note(uint pluginId, uint8_t channel, uint8_t note, uint8_t velocity); | |||
void carla_send_midi_note(uint pluginId, uint8_t channel, uint8_t note, uint8_t velocity); | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT uint32_t carla_get_buffer_size(); | |||
CARLA_EXPORT double carla_get_sample_rate(); | |||
uint32_t carla_get_buffer_size(); | |||
double carla_get_sample_rate(); | |||
void handle_carla_get_last_error(const std::shared_ptr<Session> session) | |||
{ | |||
@@ -278,7 +331,7 @@ void handle_carla_get_last_error(const std::shared_ptr<Session> session) | |||
session->close(OK, buf, { { "Content-Length", size_buf(buf) } } ); | |||
} | |||
CARLA_EXPORT const char* carla_get_host_osc_url_tcp(); | |||
CARLA_EXPORT const char* carla_get_host_osc_url_udp(); | |||
const char* carla_get_host_osc_url_tcp(); | |||
const char* carla_get_host_osc_url_udp(); | |||
// ------------------------------------------------------------------------------------------------------------------- |
@@ -63,9 +63,6 @@ void handle_carla_get_cached_plugin_info(const std::shared_ptr<Session> session) | |||
const int index = std::atoi(request->get_path_parameter("index").c_str()); | |||
CARLA_SAFE_ASSERT_RETURN(index >= 0 /*&& index < INT_MAX*/,) | |||
// REMOVE THIS | |||
carla_get_cached_plugin_count(static_cast<PluginType>(ptype), nullptr); | |||
const CarlaCachedPluginInfo* const info = carla_get_cached_plugin_info(static_cast<PluginType>(ptype), | |||
static_cast<uint>(index)); | |||
@@ -125,6 +125,17 @@ int main(int, const char**) | |||
make_resource(service, "/is_engine_running", handle_carla_is_engine_running); | |||
make_resource(service, "/set_engine_about_to_close", handle_carla_set_engine_about_to_close); | |||
// project | |||
// patchbay | |||
make_resource(service, "/transport_play", handle_carla_transport_play); | |||
make_resource(service, "/transport_pause", handle_carla_transport_pause); | |||
make_resource(service, "/transport_bpm/{bpm: .*}", handle_carla_transport_bpm); | |||
make_resource(service, "/transport_relocate/{frame: .*}", handle_carla_transport_relocate); | |||
make_resource(service, "/get_current_transport_frame", handle_carla_get_current_transport_frame); | |||
make_resource(service, "/get_transport_info", handle_carla_get_transport_info); | |||
// ... | |||
make_resource(service, "/get_last_error", handle_carla_get_last_error); | |||