diff --git a/components/bl00mbox/CMakeLists.txt b/components/bl00mbox/CMakeLists.txt index 997418c9d80dc95467e0f13d6bcdd5985d0745ed..826632d60540ab1505e085346dd3630c43353f67 100644 --- a/components/bl00mbox/CMakeLists.txt +++ b/components/bl00mbox/CMakeLists.txt @@ -7,29 +7,30 @@ idf_component_register( bl00mbox_user.c bl00mbox_plugin_registry.c bl00mbox_radspa_requirements.c - plugins/osc_fm.c - plugins/env_adsr.c - plugins/ampliverter.c - plugins/sampler.c - plugins/delay.c - plugins/flanger.c - plugins/multipitch.c - plugins/sequencer.c - plugins/noise.c - plugins/noise_burst.c - plugins/distortion.c - plugins/lowpass.c - plugins/mixer.c - plugins/range_shifter.c - plugins/poly_squeeze.c - plugins/slew_rate_limiter.c - plugins/bl00mbox/bl00mbox_line_in.c + radspa/standard_plugin_lib/osc_fm.c + radspa/standard_plugin_lib/env_adsr.c + radspa/standard_plugin_lib/ampliverter.c + radspa/standard_plugin_lib/sampler.c + radspa/standard_plugin_lib/delay.c + radspa/standard_plugin_lib/flanger.c + radspa/standard_plugin_lib/multipitch.c + radspa/standard_plugin_lib/sequencer.c + radspa/standard_plugin_lib/noise.c + radspa/standard_plugin_lib/noise_burst.c + radspa/standard_plugin_lib/distortion.c + radspa/standard_plugin_lib/lowpass.c + radspa/standard_plugin_lib/mixer.c + radspa/standard_plugin_lib/range_shifter.c + radspa/standard_plugin_lib/poly_squeeze.c + radspa/standard_plugin_lib/slew_rate_limiter.c + plugins/bl00mbox_specific/bl00mbox_line_in.c radspa/radspa_helpers.c extern/xoroshiro64star.c INCLUDE_DIRS include plugins - plugins/bl00mbox + plugins/bl00mbox_specific radspa + radspa/standard_plugin_lib extern ) diff --git a/components/bl00mbox/README.md b/components/bl00mbox/README.md deleted file mode 100644 index 4467c1e138e71bc312d063b59bf32a7a5967c7f4..0000000000000000000000000000000000000000 --- a/components/bl00mbox/README.md +++ /dev/null @@ -1 +0,0 @@ -Hi! bl00mbox/radspa is an external project. To find out more or contribute check out https://gitlab.com/moon2embeddedaudio diff --git a/python_payload/bl00mbox/__init__.py b/components/bl00mbox/micropython/bl00mbox/__init__.py similarity index 100% rename from python_payload/bl00mbox/__init__.py rename to components/bl00mbox/micropython/bl00mbox/__init__.py diff --git a/python_payload/bl00mbox/_helpers.py b/components/bl00mbox/micropython/bl00mbox/_helpers.py similarity index 100% rename from python_payload/bl00mbox/_helpers.py rename to components/bl00mbox/micropython/bl00mbox/_helpers.py diff --git a/python_payload/bl00mbox/_patches.py b/components/bl00mbox/micropython/bl00mbox/_patches.py similarity index 100% rename from python_payload/bl00mbox/_patches.py rename to components/bl00mbox/micropython/bl00mbox/_patches.py diff --git a/python_payload/bl00mbox/_plugins.py b/components/bl00mbox/micropython/bl00mbox/_plugins.py similarity index 100% rename from python_payload/bl00mbox/_plugins.py rename to components/bl00mbox/micropython/bl00mbox/_plugins.py diff --git a/python_payload/bl00mbox/_user.py b/components/bl00mbox/micropython/bl00mbox/_user.py similarity index 100% rename from python_payload/bl00mbox/_user.py rename to components/bl00mbox/micropython/bl00mbox/_user.py diff --git a/components/bl00mbox/micropython/mp_sys_bl00mbox.c b/components/bl00mbox/micropython/mp_sys_bl00mbox.c new file mode 100644 index 0000000000000000000000000000000000000000..05dc7837bf2feb21a039892343bfd55cbcdae737 --- /dev/null +++ b/components/bl00mbox/micropython/mp_sys_bl00mbox.c @@ -0,0 +1,608 @@ +// SPDX-License-Identifier: CC0-1.0 +#include <stdio.h> + +#include "py/obj.h" +#include "py/runtime.h" + +#include "bl00mbox.h" +#include "bl00mbox_plugin_registry.h" +#include "bl00mbox_user.h" +#include "radspa.h" + +// ======================== +// PLUGIN OPERATIONS +// ======================== +STATIC mp_obj_t mp_plugin_index_get_id(mp_obj_t index) { + /// prints name + radspa_descriptor_t *desc = + bl00mbox_plugin_registry_get_descriptor_from_index( + mp_obj_get_int(index)); + if (desc == NULL) return mp_const_none; + return mp_obj_new_int(desc->id); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_plugin_index_get_id_obj, + mp_plugin_index_get_id); + +STATIC mp_obj_t mp_plugin_index_get_name(mp_obj_t index) { + /// prints name + radspa_descriptor_t *desc = + bl00mbox_plugin_registry_get_descriptor_from_index( + mp_obj_get_int(index)); + if (desc == NULL) return mp_const_none; + return mp_obj_new_str(desc->name, strlen(desc->name)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_plugin_index_get_name_obj, + mp_plugin_index_get_name); + +STATIC mp_obj_t mp_plugin_index_get_description(mp_obj_t index) { + /// prints name + radspa_descriptor_t *desc = + bl00mbox_plugin_registry_get_descriptor_from_index( + mp_obj_get_int(index)); + if (desc == NULL) return mp_const_none; + return mp_obj_new_str(desc->description, strlen(desc->description)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_plugin_index_get_description_obj, + mp_plugin_index_get_description); + +STATIC mp_obj_t mp_plugin_registry_num_plugins(void) { + return mp_obj_new_int(bl00mbox_plugin_registry_get_plugin_num()); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_plugin_registry_num_plugins_obj, + mp_plugin_registry_num_plugins); + +// ======================== +// CHANNEL OPERATIONS +// ======================== + +STATIC mp_obj_t mp_channel_clear(mp_obj_t index) { + return mp_obj_new_bool(bl00mbox_channel_clear(mp_obj_get_int(index))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_clear_obj, mp_channel_clear); + +static mp_obj_t mp_channel_get_free(mp_obj_t index) { + return mp_obj_new_int(bl00mbox_channel_get_free(mp_obj_get_int(index))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_get_free_obj, mp_channel_get_free); + +static mp_obj_t mp_channel_set_free(mp_obj_t index, mp_obj_t free) { + return mp_obj_new_int( + bl00mbox_channel_set_free(mp_obj_get_int(index), mp_obj_is_true(free))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_set_free_obj, mp_channel_set_free); + +static mp_obj_t mp_channel_get_free_index() { + return mp_obj_new_int(bl00mbox_channel_get_free_index()); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_channel_get_free_index_obj, + mp_channel_get_free_index); + +STATIC mp_obj_t mp_channel_get_foreground() { + return mp_obj_new_int(bl00mbox_channel_get_foreground_index()); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_channel_get_foreground_obj, + mp_channel_get_foreground); + +STATIC mp_obj_t mp_channel_set_foreground(mp_obj_t index) { + bl00mbox_channel_set_foreground_index(mp_obj_get_int(index)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_set_foreground_obj, + mp_channel_set_foreground); + +STATIC mp_obj_t mp_channel_get_background_mute_override(mp_obj_t index) { + bool ret = + bl00mbox_channel_get_background_mute_override(mp_obj_get_int(index)); + return mp_obj_new_bool(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_get_background_mute_override_obj, + mp_channel_get_background_mute_override); + +STATIC mp_obj_t mp_channel_set_background_mute_override(mp_obj_t index, + mp_obj_t enable) { + bool ret = bl00mbox_channel_set_background_mute_override( + mp_obj_get_int(index), mp_obj_is_true(enable)); + return mp_obj_new_bool(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_set_background_mute_override_obj, + mp_channel_set_background_mute_override); + +STATIC mp_obj_t mp_channel_enable(mp_obj_t chan) { + bl00mbox_channel_enable(mp_obj_get_int(chan)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_enable_obj, mp_channel_enable); + +STATIC mp_obj_t mp_channel_disable(mp_obj_t chan) { + bl00mbox_channel_disable(mp_obj_get_int(chan)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_disable_obj, mp_channel_disable); + +STATIC mp_obj_t mp_channel_set_volume(mp_obj_t chan, mp_obj_t vol) { + bl00mbox_channel_set_volume(mp_obj_get_int(chan), mp_obj_get_int(vol)); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_set_volume_obj, + mp_channel_set_volume); + +STATIC mp_obj_t mp_channel_get_volume(mp_obj_t chan) { + return mp_obj_new_int(bl00mbox_channel_get_volume(mp_obj_get_int(chan))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_get_volume_obj, + mp_channel_get_volume); + +STATIC mp_obj_t mp_channel_set_name(mp_obj_t chan, mp_obj_t name) { + char *tmp = strdup(mp_obj_str_get_str(name)); + bl00mbox_channel_set_name(mp_obj_get_int(chan), tmp); + free(tmp); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_set_name_obj, mp_channel_set_name); + +STATIC mp_obj_t mp_channel_get_name(mp_obj_t chan) { + char *name = bl00mbox_channel_get_name(mp_obj_get_int(chan)); + if (name == NULL) return mp_const_none; + return mp_obj_new_str(name, strlen(name)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_get_name_obj, mp_channel_get_name); + +STATIC mp_obj_t mp_channel_buds_num(mp_obj_t chan) { + return mp_obj_new_int(bl00mbox_channel_buds_num(mp_obj_get_int(chan))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_buds_num_obj, mp_channel_buds_num); + +STATIC mp_obj_t mp_channel_get_bud_by_list_pos(mp_obj_t chan, mp_obj_t pos) { + return mp_obj_new_int(bl00mbox_channel_get_bud_by_list_pos( + mp_obj_get_int(chan), mp_obj_get_int(pos))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_get_bud_by_list_pos_obj, + mp_channel_get_bud_by_list_pos); + +STATIC mp_obj_t mp_channel_conns_num(mp_obj_t chan) { + return mp_obj_new_int(bl00mbox_channel_conns_num(mp_obj_get_int(chan))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_conns_num_obj, + mp_channel_conns_num); + +STATIC mp_obj_t mp_channel_mixer_num(mp_obj_t chan) { + return mp_obj_new_int(bl00mbox_channel_mixer_num(mp_obj_get_int(chan))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_mixer_num_obj, + mp_channel_mixer_num); + +STATIC mp_obj_t mp_channel_get_bud_by_mixer_list_pos(mp_obj_t chan, + mp_obj_t pos) { + return mp_obj_new_int(bl00mbox_channel_get_bud_by_mixer_list_pos( + mp_obj_get_int(chan), mp_obj_get_int(pos))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_get_bud_by_mixer_list_pos_obj, + mp_channel_get_bud_by_mixer_list_pos); + +STATIC mp_obj_t mp_channel_get_signal_by_mixer_list_pos(mp_obj_t chan, + mp_obj_t pos) { + return mp_obj_new_int(bl00mbox_channel_get_signal_by_mixer_list_pos( + mp_obj_get_int(chan), mp_obj_get_int(pos))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_get_signal_by_mixer_list_pos_obj, + mp_channel_get_signal_by_mixer_list_pos); + +// ======================== +// BUD OPERATIONS +// ======================== + +STATIC mp_obj_t mp_channel_new_bud(mp_obj_t chan, mp_obj_t id, + mp_obj_t init_var) { + bl00mbox_bud_t *bud = bl00mbox_channel_new_bud( + mp_obj_get_int(chan), mp_obj_get_int(id), mp_obj_get_int(init_var)); + if (bud == NULL) return mp_const_none; + return mp_obj_new_int(bud->index); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_new_bud_obj, mp_channel_new_bud); + +STATIC mp_obj_t mp_channel_delete_bud(mp_obj_t chan, mp_obj_t bud) { + bool ret = + bl00mbox_channel_delete_bud(mp_obj_get_int(chan), mp_obj_get_int(bud)); + return mp_obj_new_bool(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_delete_bud_obj, + mp_channel_delete_bud); + +STATIC mp_obj_t mp_channel_bud_exists(mp_obj_t chan, mp_obj_t bud) { + bool ret = + bl00mbox_channel_bud_exists(mp_obj_get_int(chan), mp_obj_get_int(bud)); + return mp_obj_new_bool(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_exists_obj, + mp_channel_bud_exists); + +STATIC mp_obj_t mp_channel_bud_get_name(mp_obj_t chan, mp_obj_t bud) { + char *name = bl00mbox_channel_bud_get_name(mp_obj_get_int(chan), + mp_obj_get_int(bud)); + return mp_obj_new_str(name, strlen(name)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_name_obj, + mp_channel_bud_get_name); + +STATIC mp_obj_t mp_channel_bud_get_description(mp_obj_t chan, mp_obj_t bud) { + char *description = bl00mbox_channel_bud_get_description( + mp_obj_get_int(chan), mp_obj_get_int(bud)); + return mp_obj_new_str(description, strlen(description)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_description_obj, + mp_channel_bud_get_description); + +STATIC mp_obj_t mp_channel_bud_get_plugin_id(mp_obj_t chan, mp_obj_t bud) { + uint32_t plugin_id = bl00mbox_channel_bud_get_plugin_id( + mp_obj_get_int(chan), mp_obj_get_int(bud)); + return mp_obj_new_int(plugin_id); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_plugin_id_obj, + mp_channel_bud_get_plugin_id); + +STATIC mp_obj_t mp_channel_bud_get_num_signals(mp_obj_t chan, mp_obj_t bud) { + uint16_t ret = bl00mbox_channel_bud_get_num_signals(mp_obj_get_int(chan), + mp_obj_get_int(bud)); + return mp_obj_new_int(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_num_signals_obj, + mp_channel_bud_get_num_signals); + +// ======================== +// SIGNAL OPERATIONS +// ======================== + +STATIC mp_obj_t mp_channel_bud_get_signal_name(mp_obj_t chan, mp_obj_t bud, + mp_obj_t signal) { + char *name = bl00mbox_channel_bud_get_signal_name( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_str(name, strlen(name)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_name_obj, + mp_channel_bud_get_signal_name); + +STATIC mp_obj_t mp_channel_bud_get_signal_name_multiplex(mp_obj_t chan, + mp_obj_t bud, + mp_obj_t signal) { + int8_t ret = bl00mbox_channel_bud_get_signal_name_multiplex( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_int(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_name_multiplex_obj, + mp_channel_bud_get_signal_name_multiplex); + +STATIC mp_obj_t mp_channel_bud_get_signal_description(mp_obj_t chan, + mp_obj_t bud, + mp_obj_t signal) { + char *description = bl00mbox_channel_bud_get_signal_description( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_str(description, strlen(description)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_description_obj, + mp_channel_bud_get_signal_description); + +STATIC mp_obj_t mp_channel_bud_get_signal_unit(mp_obj_t chan, mp_obj_t bud, + mp_obj_t signal) { + char *unit = bl00mbox_channel_bud_get_signal_unit( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_str(unit, strlen(unit)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_unit_obj, + mp_channel_bud_get_signal_unit); + +STATIC mp_obj_t mp_channel_bud_get_signal_hints(mp_obj_t chan, mp_obj_t bud, + mp_obj_t signal) { + uint32_t val = bl00mbox_channel_bud_get_signal_hints( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_int(val); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_hints_obj, + mp_channel_bud_get_signal_hints); + +STATIC mp_obj_t mp_channel_bud_set_signal_value(size_t n_args, + const mp_obj_t *args) { + bool success = bl00mbox_channel_bud_set_signal_value( + mp_obj_get_int(args[0]), // chan + mp_obj_get_int(args[1]), // bud_index + mp_obj_get_int(args[2]), // bud_signal_index + mp_obj_get_int(args[3])); // value + return mp_obj_new_bool(success); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_channel_bud_set_signal_value_obj, + 4, 4, + mp_channel_bud_set_signal_value); + +STATIC mp_obj_t mp_channel_bud_get_signal_value(mp_obj_t chan, mp_obj_t bud, + mp_obj_t signal) { + int16_t val = bl00mbox_channel_bud_get_signal_value( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_int(val); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_value_obj, + mp_channel_bud_get_signal_value); + +STATIC mp_obj_t mp_channel_subscriber_num(mp_obj_t chan, mp_obj_t bud, + mp_obj_t signal) { + return mp_obj_new_int(bl00mbox_channel_subscriber_num( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal))); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_subscriber_num_obj, + mp_channel_subscriber_num); + +STATIC mp_obj_t +mp_channel_get_bud_by_subscriber_list_pos(size_t n_args, const mp_obj_t *args) { + return mp_obj_new_int(bl00mbox_channel_get_bud_by_subscriber_list_pos( + mp_obj_get_int(args[0]), // chan + mp_obj_get_int(args[1]), // bud_index + mp_obj_get_int(args[2]), // bud_signal_index + mp_obj_get_int(args[3])) // pos + ); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( + mp_channel_get_bud_by_subscriber_list_pos_obj, 4, 4, + mp_channel_get_bud_by_subscriber_list_pos); + +STATIC mp_obj_t mp_channel_get_signal_by_subscriber_list_pos( + size_t n_args, const mp_obj_t *args) { + return mp_obj_new_int(bl00mbox_channel_get_signal_by_subscriber_list_pos( + mp_obj_get_int(args[0]), // chan + mp_obj_get_int(args[1]), // bud_index + mp_obj_get_int(args[2]), // bud_signal_index + mp_obj_get_int(args[3])) // pos + ); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( + mp_channel_get_signal_by_subscriber_list_pos_obj, 4, 4, + mp_channel_get_signal_by_subscriber_list_pos); + +STATIC mp_obj_t mp_channel_get_source_bud(mp_obj_t chan, mp_obj_t bud, + mp_obj_t signal) { + uint64_t val = bl00mbox_channel_get_source_bud( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_int(val); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_get_source_bud_obj, + mp_channel_get_source_bud); + +STATIC mp_obj_t mp_channel_get_source_signal(mp_obj_t chan, mp_obj_t bud, + mp_obj_t signal) { + uint64_t val = bl00mbox_channel_get_source_signal( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_int(val); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_get_source_signal_obj, + mp_channel_get_source_signal); + +// ======================== +// TABLE OPERATIONS +// ======================== + +STATIC mp_obj_t mp_channel_bud_set_table_value(size_t n_args, + const mp_obj_t *args) { + bool success = bl00mbox_channel_bud_set_table_value( + mp_obj_get_int(args[0]), // chan + mp_obj_get_int(args[1]), // bud_index + mp_obj_get_int(args[2]), // table_index + mp_obj_get_int(args[3])); // value + return mp_obj_new_bool(success); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_channel_bud_set_table_value_obj, + 4, 4, + mp_channel_bud_set_table_value); + +STATIC mp_obj_t mp_channel_bud_get_table_value(mp_obj_t chan, mp_obj_t bud, + mp_obj_t table_index) { + int16_t val = bl00mbox_channel_bud_get_table_value( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(table_index)); + return mp_obj_new_int(val); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_table_value_obj, + mp_channel_bud_get_table_value); + +STATIC mp_obj_t mp_channel_bud_get_table_pointer(mp_obj_t chan, mp_obj_t bud) { + int16_t *val = bl00mbox_channel_bud_get_table_pointer(mp_obj_get_int(chan), + mp_obj_get_int(bud)); + return mp_obj_new_int_from_uint((uint32_t)val); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_table_pointer_obj, + mp_channel_bud_get_table_pointer); + +STATIC mp_obj_t mp_channel_bud_get_table_len(mp_obj_t chan, mp_obj_t bud) { + uint32_t val = bl00mbox_channel_bud_get_table_len(mp_obj_get_int(chan), + mp_obj_get_int(bud)); + return mp_obj_new_int_from_uint(val); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_table_len_obj, + mp_channel_bud_get_table_len); + +// ======================== +// CONNECTION OPERATIONS +// ======================== + +STATIC mp_obj_t mp_channel_disconnect_signal_rx(mp_obj_t chan, mp_obj_t bud, + mp_obj_t signal) { + bool ret = bl00mbox_channel_disconnect_signal_rx( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_bool(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_disconnect_signal_rx_obj, + mp_channel_disconnect_signal_rx); + +STATIC mp_obj_t mp_channel_disconnect_signal_tx(mp_obj_t chan, mp_obj_t bud, + mp_obj_t signal) { + bool ret = bl00mbox_channel_disconnect_signal_tx( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_bool(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_disconnect_signal_tx_obj, + mp_channel_disconnect_signal_tx); + +STATIC mp_obj_t mp_channel_connect_signal(size_t n_args, const mp_obj_t *args) { + bool success = bl00mbox_channel_connect_signal( + mp_obj_get_int(args[0]), // chan + mp_obj_get_int(args[1]), // bud_tx_index + mp_obj_get_int(args[2]), // bud_tx_signal_index + mp_obj_get_int(args[3]), // bud_tx_index + mp_obj_get_int(args[4])); // bud_tx_signal_index + return mp_obj_new_bool(success); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_channel_connect_signal_obj, 5, 5, + mp_channel_connect_signal); + +STATIC mp_obj_t mp_channel_connect_signal_to_output_mixer( + mp_obj_t chan, mp_obj_t bud_index, mp_obj_t bud_signal_index) { + bool success = bl00mbox_channel_connect_signal_to_output_mixer( + mp_obj_get_int(chan), mp_obj_get_int(bud_index), + mp_obj_get_int(bud_signal_index)); + return mp_obj_new_bool(success); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_connect_signal_to_output_mixer_obj, + mp_channel_connect_signal_to_output_mixer); + +STATIC mp_obj_t mp_channel_disconnect_signal_from_output_mixer( + mp_obj_t chan, mp_obj_t bud, mp_obj_t signal) { + bool ret = bl00mbox_channel_disconnect_signal_from_output_mixer( + mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); + return mp_obj_new_bool(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3( + mp_channel_disconnect_signal_from_output_mixer_obj, + mp_channel_disconnect_signal_from_output_mixer); + +STATIC const mp_map_elem_t bl00mbox_globals_table[] = { + { MP_OBJ_NEW_QSTR(MP_QSTR___name__), + MP_OBJ_NEW_QSTR(MP_QSTR_sys_bl00mbox) }, + + // PLUGIN OPERATIONS + { MP_ROM_QSTR(MP_QSTR_plugin_registry_num_plugins), + MP_ROM_PTR(&mp_plugin_registry_num_plugins_obj) }, + { MP_ROM_QSTR(MP_QSTR_plugin_index_get_id), + MP_ROM_PTR(&mp_plugin_index_get_id_obj) }, + { MP_ROM_QSTR(MP_QSTR_plugin_index_get_name), + MP_ROM_PTR(&mp_plugin_index_get_name_obj) }, + { MP_ROM_QSTR(MP_QSTR_plugin_index_get_description), + MP_ROM_PTR(&mp_plugin_index_get_description_obj) }, + + // CHANNEL OPERATIONS + { MP_ROM_QSTR(MP_QSTR_channel_get_free), + MP_ROM_PTR(&mp_channel_get_free_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_set_free), + MP_ROM_PTR(&mp_channel_set_free_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_free_index), + MP_ROM_PTR(&mp_channel_get_free_index_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_foreground), + MP_ROM_PTR(&mp_channel_get_foreground_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_set_foreground), + MP_ROM_PTR(&mp_channel_set_foreground_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_background_mute_override), + MP_ROM_PTR(&mp_channel_get_background_mute_override_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_set_background_mute_override), + MP_ROM_PTR(&mp_channel_set_background_mute_override_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_enable), MP_ROM_PTR(&mp_channel_enable_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_disable), + MP_ROM_PTR(&mp_channel_disable_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_clear), MP_ROM_PTR(&mp_channel_clear_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_set_volume), + MP_ROM_PTR(&mp_channel_set_volume_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_volume), + MP_ROM_PTR(&mp_channel_get_volume_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_set_name), + MP_ROM_PTR(&mp_channel_set_name_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_name), + MP_ROM_PTR(&mp_channel_get_name_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_buds_num), + MP_ROM_PTR(&mp_channel_buds_num_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_bud_by_list_pos), + MP_ROM_PTR(&mp_channel_get_bud_by_list_pos_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_conns_num), + MP_ROM_PTR(&mp_channel_conns_num_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_mixer_num), + MP_ROM_PTR(&mp_channel_mixer_num_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_bud_by_mixer_list_pos), + MP_ROM_PTR(&mp_channel_get_bud_by_mixer_list_pos_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_signal_by_mixer_list_pos), + MP_ROM_PTR(&mp_channel_get_signal_by_mixer_list_pos_obj) }, + + // BUD OPERATIONS + { MP_ROM_QSTR(MP_QSTR_channel_new_bud), + MP_ROM_PTR(&mp_channel_new_bud_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_delete_bud), + MP_ROM_PTR(&mp_channel_delete_bud_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_exists), + MP_ROM_PTR(&mp_channel_bud_exists_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_name), + MP_ROM_PTR(&mp_channel_bud_get_name_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_description), + MP_ROM_PTR(&mp_channel_bud_get_description_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_plugin_id), + MP_ROM_PTR(&mp_channel_bud_get_plugin_id_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_num_signals), + MP_ROM_PTR(&mp_channel_bud_get_num_signals_obj) }, + + // SIGNAL OPERATIONS + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_name), + MP_ROM_PTR(&mp_channel_bud_get_signal_name_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_name_multiplex), + MP_ROM_PTR(&mp_channel_bud_get_signal_name_multiplex_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_description), + MP_ROM_PTR(&mp_channel_bud_get_signal_description_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_unit), + MP_ROM_PTR(&mp_channel_bud_get_signal_unit_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_set_signal_value), + MP_ROM_PTR(&mp_channel_bud_set_signal_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_value), + MP_ROM_PTR(&mp_channel_bud_get_signal_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_hints), + MP_ROM_PTR(&mp_channel_bud_get_signal_hints_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_subscriber_num), + MP_ROM_PTR(&mp_channel_subscriber_num_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_bud_by_subscriber_list_pos), + MP_ROM_PTR(&mp_channel_get_bud_by_subscriber_list_pos_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_signal_by_subscriber_list_pos), + MP_ROM_PTR(&mp_channel_get_signal_by_subscriber_list_pos_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_source_bud), + MP_ROM_PTR(&mp_channel_get_source_bud_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_get_source_signal), + MP_ROM_PTR(&mp_channel_get_source_signal_obj) }, + + // TABLE OPERATIONS + { MP_ROM_QSTR(MP_QSTR_channel_bud_set_table_value), + MP_ROM_PTR(&mp_channel_bud_set_table_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_table_value), + MP_ROM_PTR(&mp_channel_bud_get_table_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_table_pointer), + MP_ROM_PTR(&mp_channel_bud_get_table_pointer_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_bud_get_table_len), + MP_ROM_PTR(&mp_channel_bud_get_table_len_obj) }, + + // CONNECTION OPERATIONS + { MP_ROM_QSTR(MP_QSTR_channel_connect_signal), + MP_ROM_PTR(&mp_channel_connect_signal_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_disconnect_signal_rx), + MP_ROM_PTR(&mp_channel_disconnect_signal_rx_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_disconnect_signal_tx), + MP_ROM_PTR(&mp_channel_disconnect_signal_tx_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_connect_signal_to_output_mixer), + MP_ROM_PTR(&mp_channel_connect_signal_to_output_mixer_obj) }, + { MP_ROM_QSTR(MP_QSTR_channel_disconnect_signal_from_output_mixer), + MP_ROM_PTR(&mp_channel_disconnect_signal_from_output_mixer_obj) }, + + // CONSTANTS + { MP_ROM_QSTR(MP_QSTR_NUM_CHANNELS), MP_ROM_INT(BL00MBOX_CHANNELS) }, + { MP_ROM_QSTR(MP_QSTR_RADSPA_SIGNAL_HINT_SCT), + MP_ROM_INT(RADSPA_SIGNAL_HINT_SCT) }, + { MP_ROM_QSTR(MP_QSTR_RADSPA_SIGNAL_HINT_GAIN), + MP_ROM_INT(RADSPA_SIGNAL_HINT_GAIN) }, + { MP_ROM_QSTR(MP_QSTR_RADSPA_SIGNAL_HINT_TRIGGER), + MP_ROM_INT(RADSPA_SIGNAL_HINT_TRIGGER) }, + { MP_ROM_QSTR(MP_QSTR_BL00MBOX_CHANNELS), MP_ROM_INT(BL00MBOX_CHANNELS) }, +}; + +STATIC MP_DEFINE_CONST_DICT(mp_module_bl00mbox_globals, bl00mbox_globals_table); + +const mp_obj_module_t bl00mbox_user_cmodule = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&mp_module_bl00mbox_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_sys_bl00mbox, bl00mbox_user_cmodule); diff --git a/components/bl00mbox/plugins/bl00mbox/bl00mbox_line_in.c b/components/bl00mbox/plugins/bl00mbox_specific/bl00mbox_line_in.c similarity index 100% rename from components/bl00mbox/plugins/bl00mbox/bl00mbox_line_in.c rename to components/bl00mbox/plugins/bl00mbox_specific/bl00mbox_line_in.c diff --git a/components/bl00mbox/plugins/bl00mbox/bl00mbox_line_in.h b/components/bl00mbox/plugins/bl00mbox_specific/bl00mbox_line_in.h similarity index 100% rename from components/bl00mbox/plugins/bl00mbox/bl00mbox_line_in.h rename to components/bl00mbox/plugins/bl00mbox_specific/bl00mbox_line_in.h diff --git a/components/bl00mbox/plugins/ampliverter.c b/components/bl00mbox/radspa/standard_plugin_lib/ampliverter.c similarity index 100% rename from components/bl00mbox/plugins/ampliverter.c rename to components/bl00mbox/radspa/standard_plugin_lib/ampliverter.c diff --git a/components/bl00mbox/plugins/ampliverter.h b/components/bl00mbox/radspa/standard_plugin_lib/ampliverter.h similarity index 100% rename from components/bl00mbox/plugins/ampliverter.h rename to components/bl00mbox/radspa/standard_plugin_lib/ampliverter.h diff --git a/components/bl00mbox/plugins/delay.c b/components/bl00mbox/radspa/standard_plugin_lib/delay.c similarity index 100% rename from components/bl00mbox/plugins/delay.c rename to components/bl00mbox/radspa/standard_plugin_lib/delay.c diff --git a/components/bl00mbox/plugins/delay.h b/components/bl00mbox/radspa/standard_plugin_lib/delay.h similarity index 100% rename from components/bl00mbox/plugins/delay.h rename to components/bl00mbox/radspa/standard_plugin_lib/delay.h diff --git a/components/bl00mbox/plugins/distortion.c b/components/bl00mbox/radspa/standard_plugin_lib/distortion.c similarity index 100% rename from components/bl00mbox/plugins/distortion.c rename to components/bl00mbox/radspa/standard_plugin_lib/distortion.c diff --git a/components/bl00mbox/plugins/distortion.h b/components/bl00mbox/radspa/standard_plugin_lib/distortion.h similarity index 100% rename from components/bl00mbox/plugins/distortion.h rename to components/bl00mbox/radspa/standard_plugin_lib/distortion.h diff --git a/components/bl00mbox/plugins/env_adsr.c b/components/bl00mbox/radspa/standard_plugin_lib/env_adsr.c similarity index 100% rename from components/bl00mbox/plugins/env_adsr.c rename to components/bl00mbox/radspa/standard_plugin_lib/env_adsr.c diff --git a/components/bl00mbox/plugins/env_adsr.h b/components/bl00mbox/radspa/standard_plugin_lib/env_adsr.h similarity index 100% rename from components/bl00mbox/plugins/env_adsr.h rename to components/bl00mbox/radspa/standard_plugin_lib/env_adsr.h diff --git a/components/bl00mbox/plugins/flanger.c b/components/bl00mbox/radspa/standard_plugin_lib/flanger.c similarity index 100% rename from components/bl00mbox/plugins/flanger.c rename to components/bl00mbox/radspa/standard_plugin_lib/flanger.c diff --git a/components/bl00mbox/plugins/flanger.h b/components/bl00mbox/radspa/standard_plugin_lib/flanger.h similarity index 100% rename from components/bl00mbox/plugins/flanger.h rename to components/bl00mbox/radspa/standard_plugin_lib/flanger.h diff --git a/components/bl00mbox/plugins/lowpass.c b/components/bl00mbox/radspa/standard_plugin_lib/lowpass.c similarity index 100% rename from components/bl00mbox/plugins/lowpass.c rename to components/bl00mbox/radspa/standard_plugin_lib/lowpass.c diff --git a/components/bl00mbox/plugins/lowpass.h b/components/bl00mbox/radspa/standard_plugin_lib/lowpass.h similarity index 100% rename from components/bl00mbox/plugins/lowpass.h rename to components/bl00mbox/radspa/standard_plugin_lib/lowpass.h diff --git a/components/bl00mbox/plugins/mixer.c b/components/bl00mbox/radspa/standard_plugin_lib/mixer.c similarity index 100% rename from components/bl00mbox/plugins/mixer.c rename to components/bl00mbox/radspa/standard_plugin_lib/mixer.c diff --git a/components/bl00mbox/plugins/mixer.h b/components/bl00mbox/radspa/standard_plugin_lib/mixer.h similarity index 100% rename from components/bl00mbox/plugins/mixer.h rename to components/bl00mbox/radspa/standard_plugin_lib/mixer.h diff --git a/components/bl00mbox/plugins/multipitch.c b/components/bl00mbox/radspa/standard_plugin_lib/multipitch.c similarity index 100% rename from components/bl00mbox/plugins/multipitch.c rename to components/bl00mbox/radspa/standard_plugin_lib/multipitch.c diff --git a/components/bl00mbox/plugins/multipitch.h b/components/bl00mbox/radspa/standard_plugin_lib/multipitch.h similarity index 100% rename from components/bl00mbox/plugins/multipitch.h rename to components/bl00mbox/radspa/standard_plugin_lib/multipitch.h diff --git a/components/bl00mbox/plugins/noise.c b/components/bl00mbox/radspa/standard_plugin_lib/noise.c similarity index 100% rename from components/bl00mbox/plugins/noise.c rename to components/bl00mbox/radspa/standard_plugin_lib/noise.c diff --git a/components/bl00mbox/plugins/noise.h b/components/bl00mbox/radspa/standard_plugin_lib/noise.h similarity index 100% rename from components/bl00mbox/plugins/noise.h rename to components/bl00mbox/radspa/standard_plugin_lib/noise.h diff --git a/components/bl00mbox/plugins/noise_burst.c b/components/bl00mbox/radspa/standard_plugin_lib/noise_burst.c similarity index 100% rename from components/bl00mbox/plugins/noise_burst.c rename to components/bl00mbox/radspa/standard_plugin_lib/noise_burst.c diff --git a/components/bl00mbox/plugins/noise_burst.h b/components/bl00mbox/radspa/standard_plugin_lib/noise_burst.h similarity index 100% rename from components/bl00mbox/plugins/noise_burst.h rename to components/bl00mbox/radspa/standard_plugin_lib/noise_burst.h diff --git a/components/bl00mbox/plugins/osc_fm.c b/components/bl00mbox/radspa/standard_plugin_lib/osc_fm.c similarity index 100% rename from components/bl00mbox/plugins/osc_fm.c rename to components/bl00mbox/radspa/standard_plugin_lib/osc_fm.c diff --git a/components/bl00mbox/plugins/osc_fm.h b/components/bl00mbox/radspa/standard_plugin_lib/osc_fm.h similarity index 100% rename from components/bl00mbox/plugins/osc_fm.h rename to components/bl00mbox/radspa/standard_plugin_lib/osc_fm.h diff --git a/components/bl00mbox/plugins/poly_squeeze.c b/components/bl00mbox/radspa/standard_plugin_lib/poly_squeeze.c similarity index 100% rename from components/bl00mbox/plugins/poly_squeeze.c rename to components/bl00mbox/radspa/standard_plugin_lib/poly_squeeze.c diff --git a/components/bl00mbox/plugins/poly_squeeze.h b/components/bl00mbox/radspa/standard_plugin_lib/poly_squeeze.h similarity index 100% rename from components/bl00mbox/plugins/poly_squeeze.h rename to components/bl00mbox/radspa/standard_plugin_lib/poly_squeeze.h diff --git a/components/bl00mbox/plugins/range_shifter.c b/components/bl00mbox/radspa/standard_plugin_lib/range_shifter.c similarity index 100% rename from components/bl00mbox/plugins/range_shifter.c rename to components/bl00mbox/radspa/standard_plugin_lib/range_shifter.c diff --git a/components/bl00mbox/plugins/range_shifter.h b/components/bl00mbox/radspa/standard_plugin_lib/range_shifter.h similarity index 100% rename from components/bl00mbox/plugins/range_shifter.h rename to components/bl00mbox/radspa/standard_plugin_lib/range_shifter.h diff --git a/components/bl00mbox/plugins/sampler.c b/components/bl00mbox/radspa/standard_plugin_lib/sampler.c similarity index 100% rename from components/bl00mbox/plugins/sampler.c rename to components/bl00mbox/radspa/standard_plugin_lib/sampler.c diff --git a/components/bl00mbox/plugins/sampler.h b/components/bl00mbox/radspa/standard_plugin_lib/sampler.h similarity index 100% rename from components/bl00mbox/plugins/sampler.h rename to components/bl00mbox/radspa/standard_plugin_lib/sampler.h diff --git a/components/bl00mbox/plugins/sequencer.c b/components/bl00mbox/radspa/standard_plugin_lib/sequencer.c similarity index 100% rename from components/bl00mbox/plugins/sequencer.c rename to components/bl00mbox/radspa/standard_plugin_lib/sequencer.c diff --git a/components/bl00mbox/plugins/sequencer.h b/components/bl00mbox/radspa/standard_plugin_lib/sequencer.h similarity index 100% rename from components/bl00mbox/plugins/sequencer.h rename to components/bl00mbox/radspa/standard_plugin_lib/sequencer.h diff --git a/components/bl00mbox/plugins/slew_rate_limiter.c b/components/bl00mbox/radspa/standard_plugin_lib/slew_rate_limiter.c similarity index 100% rename from components/bl00mbox/plugins/slew_rate_limiter.c rename to components/bl00mbox/radspa/standard_plugin_lib/slew_rate_limiter.c diff --git a/components/bl00mbox/plugins/slew_rate_limiter.h b/components/bl00mbox/radspa/standard_plugin_lib/slew_rate_limiter.h similarity index 100% rename from components/bl00mbox/plugins/slew_rate_limiter.h rename to components/bl00mbox/radspa/standard_plugin_lib/slew_rate_limiter.h diff --git a/components/micropython/usermodule/mp_sys_bl00mbox.c b/components/micropython/usermodule/mp_sys_bl00mbox.c deleted file mode 100644 index 05dc7837bf2feb21a039892343bfd55cbcdae737..0000000000000000000000000000000000000000 --- a/components/micropython/usermodule/mp_sys_bl00mbox.c +++ /dev/null @@ -1,608 +0,0 @@ -// SPDX-License-Identifier: CC0-1.0 -#include <stdio.h> - -#include "py/obj.h" -#include "py/runtime.h" - -#include "bl00mbox.h" -#include "bl00mbox_plugin_registry.h" -#include "bl00mbox_user.h" -#include "radspa.h" - -// ======================== -// PLUGIN OPERATIONS -// ======================== -STATIC mp_obj_t mp_plugin_index_get_id(mp_obj_t index) { - /// prints name - radspa_descriptor_t *desc = - bl00mbox_plugin_registry_get_descriptor_from_index( - mp_obj_get_int(index)); - if (desc == NULL) return mp_const_none; - return mp_obj_new_int(desc->id); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_plugin_index_get_id_obj, - mp_plugin_index_get_id); - -STATIC mp_obj_t mp_plugin_index_get_name(mp_obj_t index) { - /// prints name - radspa_descriptor_t *desc = - bl00mbox_plugin_registry_get_descriptor_from_index( - mp_obj_get_int(index)); - if (desc == NULL) return mp_const_none; - return mp_obj_new_str(desc->name, strlen(desc->name)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_plugin_index_get_name_obj, - mp_plugin_index_get_name); - -STATIC mp_obj_t mp_plugin_index_get_description(mp_obj_t index) { - /// prints name - radspa_descriptor_t *desc = - bl00mbox_plugin_registry_get_descriptor_from_index( - mp_obj_get_int(index)); - if (desc == NULL) return mp_const_none; - return mp_obj_new_str(desc->description, strlen(desc->description)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_plugin_index_get_description_obj, - mp_plugin_index_get_description); - -STATIC mp_obj_t mp_plugin_registry_num_plugins(void) { - return mp_obj_new_int(bl00mbox_plugin_registry_get_plugin_num()); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_plugin_registry_num_plugins_obj, - mp_plugin_registry_num_plugins); - -// ======================== -// CHANNEL OPERATIONS -// ======================== - -STATIC mp_obj_t mp_channel_clear(mp_obj_t index) { - return mp_obj_new_bool(bl00mbox_channel_clear(mp_obj_get_int(index))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_clear_obj, mp_channel_clear); - -static mp_obj_t mp_channel_get_free(mp_obj_t index) { - return mp_obj_new_int(bl00mbox_channel_get_free(mp_obj_get_int(index))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_get_free_obj, mp_channel_get_free); - -static mp_obj_t mp_channel_set_free(mp_obj_t index, mp_obj_t free) { - return mp_obj_new_int( - bl00mbox_channel_set_free(mp_obj_get_int(index), mp_obj_is_true(free))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_set_free_obj, mp_channel_set_free); - -static mp_obj_t mp_channel_get_free_index() { - return mp_obj_new_int(bl00mbox_channel_get_free_index()); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_channel_get_free_index_obj, - mp_channel_get_free_index); - -STATIC mp_obj_t mp_channel_get_foreground() { - return mp_obj_new_int(bl00mbox_channel_get_foreground_index()); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_channel_get_foreground_obj, - mp_channel_get_foreground); - -STATIC mp_obj_t mp_channel_set_foreground(mp_obj_t index) { - bl00mbox_channel_set_foreground_index(mp_obj_get_int(index)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_set_foreground_obj, - mp_channel_set_foreground); - -STATIC mp_obj_t mp_channel_get_background_mute_override(mp_obj_t index) { - bool ret = - bl00mbox_channel_get_background_mute_override(mp_obj_get_int(index)); - return mp_obj_new_bool(ret); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_get_background_mute_override_obj, - mp_channel_get_background_mute_override); - -STATIC mp_obj_t mp_channel_set_background_mute_override(mp_obj_t index, - mp_obj_t enable) { - bool ret = bl00mbox_channel_set_background_mute_override( - mp_obj_get_int(index), mp_obj_is_true(enable)); - return mp_obj_new_bool(ret); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_set_background_mute_override_obj, - mp_channel_set_background_mute_override); - -STATIC mp_obj_t mp_channel_enable(mp_obj_t chan) { - bl00mbox_channel_enable(mp_obj_get_int(chan)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_enable_obj, mp_channel_enable); - -STATIC mp_obj_t mp_channel_disable(mp_obj_t chan) { - bl00mbox_channel_disable(mp_obj_get_int(chan)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_disable_obj, mp_channel_disable); - -STATIC mp_obj_t mp_channel_set_volume(mp_obj_t chan, mp_obj_t vol) { - bl00mbox_channel_set_volume(mp_obj_get_int(chan), mp_obj_get_int(vol)); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_set_volume_obj, - mp_channel_set_volume); - -STATIC mp_obj_t mp_channel_get_volume(mp_obj_t chan) { - return mp_obj_new_int(bl00mbox_channel_get_volume(mp_obj_get_int(chan))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_get_volume_obj, - mp_channel_get_volume); - -STATIC mp_obj_t mp_channel_set_name(mp_obj_t chan, mp_obj_t name) { - char *tmp = strdup(mp_obj_str_get_str(name)); - bl00mbox_channel_set_name(mp_obj_get_int(chan), tmp); - free(tmp); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_set_name_obj, mp_channel_set_name); - -STATIC mp_obj_t mp_channel_get_name(mp_obj_t chan) { - char *name = bl00mbox_channel_get_name(mp_obj_get_int(chan)); - if (name == NULL) return mp_const_none; - return mp_obj_new_str(name, strlen(name)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_get_name_obj, mp_channel_get_name); - -STATIC mp_obj_t mp_channel_buds_num(mp_obj_t chan) { - return mp_obj_new_int(bl00mbox_channel_buds_num(mp_obj_get_int(chan))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_buds_num_obj, mp_channel_buds_num); - -STATIC mp_obj_t mp_channel_get_bud_by_list_pos(mp_obj_t chan, mp_obj_t pos) { - return mp_obj_new_int(bl00mbox_channel_get_bud_by_list_pos( - mp_obj_get_int(chan), mp_obj_get_int(pos))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_get_bud_by_list_pos_obj, - mp_channel_get_bud_by_list_pos); - -STATIC mp_obj_t mp_channel_conns_num(mp_obj_t chan) { - return mp_obj_new_int(bl00mbox_channel_conns_num(mp_obj_get_int(chan))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_conns_num_obj, - mp_channel_conns_num); - -STATIC mp_obj_t mp_channel_mixer_num(mp_obj_t chan) { - return mp_obj_new_int(bl00mbox_channel_mixer_num(mp_obj_get_int(chan))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_channel_mixer_num_obj, - mp_channel_mixer_num); - -STATIC mp_obj_t mp_channel_get_bud_by_mixer_list_pos(mp_obj_t chan, - mp_obj_t pos) { - return mp_obj_new_int(bl00mbox_channel_get_bud_by_mixer_list_pos( - mp_obj_get_int(chan), mp_obj_get_int(pos))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_get_bud_by_mixer_list_pos_obj, - mp_channel_get_bud_by_mixer_list_pos); - -STATIC mp_obj_t mp_channel_get_signal_by_mixer_list_pos(mp_obj_t chan, - mp_obj_t pos) { - return mp_obj_new_int(bl00mbox_channel_get_signal_by_mixer_list_pos( - mp_obj_get_int(chan), mp_obj_get_int(pos))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_get_signal_by_mixer_list_pos_obj, - mp_channel_get_signal_by_mixer_list_pos); - -// ======================== -// BUD OPERATIONS -// ======================== - -STATIC mp_obj_t mp_channel_new_bud(mp_obj_t chan, mp_obj_t id, - mp_obj_t init_var) { - bl00mbox_bud_t *bud = bl00mbox_channel_new_bud( - mp_obj_get_int(chan), mp_obj_get_int(id), mp_obj_get_int(init_var)); - if (bud == NULL) return mp_const_none; - return mp_obj_new_int(bud->index); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_new_bud_obj, mp_channel_new_bud); - -STATIC mp_obj_t mp_channel_delete_bud(mp_obj_t chan, mp_obj_t bud) { - bool ret = - bl00mbox_channel_delete_bud(mp_obj_get_int(chan), mp_obj_get_int(bud)); - return mp_obj_new_bool(ret); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_delete_bud_obj, - mp_channel_delete_bud); - -STATIC mp_obj_t mp_channel_bud_exists(mp_obj_t chan, mp_obj_t bud) { - bool ret = - bl00mbox_channel_bud_exists(mp_obj_get_int(chan), mp_obj_get_int(bud)); - return mp_obj_new_bool(ret); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_exists_obj, - mp_channel_bud_exists); - -STATIC mp_obj_t mp_channel_bud_get_name(mp_obj_t chan, mp_obj_t bud) { - char *name = bl00mbox_channel_bud_get_name(mp_obj_get_int(chan), - mp_obj_get_int(bud)); - return mp_obj_new_str(name, strlen(name)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_name_obj, - mp_channel_bud_get_name); - -STATIC mp_obj_t mp_channel_bud_get_description(mp_obj_t chan, mp_obj_t bud) { - char *description = bl00mbox_channel_bud_get_description( - mp_obj_get_int(chan), mp_obj_get_int(bud)); - return mp_obj_new_str(description, strlen(description)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_description_obj, - mp_channel_bud_get_description); - -STATIC mp_obj_t mp_channel_bud_get_plugin_id(mp_obj_t chan, mp_obj_t bud) { - uint32_t plugin_id = bl00mbox_channel_bud_get_plugin_id( - mp_obj_get_int(chan), mp_obj_get_int(bud)); - return mp_obj_new_int(plugin_id); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_plugin_id_obj, - mp_channel_bud_get_plugin_id); - -STATIC mp_obj_t mp_channel_bud_get_num_signals(mp_obj_t chan, mp_obj_t bud) { - uint16_t ret = bl00mbox_channel_bud_get_num_signals(mp_obj_get_int(chan), - mp_obj_get_int(bud)); - return mp_obj_new_int(ret); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_num_signals_obj, - mp_channel_bud_get_num_signals); - -// ======================== -// SIGNAL OPERATIONS -// ======================== - -STATIC mp_obj_t mp_channel_bud_get_signal_name(mp_obj_t chan, mp_obj_t bud, - mp_obj_t signal) { - char *name = bl00mbox_channel_bud_get_signal_name( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_str(name, strlen(name)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_name_obj, - mp_channel_bud_get_signal_name); - -STATIC mp_obj_t mp_channel_bud_get_signal_name_multiplex(mp_obj_t chan, - mp_obj_t bud, - mp_obj_t signal) { - int8_t ret = bl00mbox_channel_bud_get_signal_name_multiplex( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_int(ret); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_name_multiplex_obj, - mp_channel_bud_get_signal_name_multiplex); - -STATIC mp_obj_t mp_channel_bud_get_signal_description(mp_obj_t chan, - mp_obj_t bud, - mp_obj_t signal) { - char *description = bl00mbox_channel_bud_get_signal_description( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_str(description, strlen(description)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_description_obj, - mp_channel_bud_get_signal_description); - -STATIC mp_obj_t mp_channel_bud_get_signal_unit(mp_obj_t chan, mp_obj_t bud, - mp_obj_t signal) { - char *unit = bl00mbox_channel_bud_get_signal_unit( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_str(unit, strlen(unit)); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_unit_obj, - mp_channel_bud_get_signal_unit); - -STATIC mp_obj_t mp_channel_bud_get_signal_hints(mp_obj_t chan, mp_obj_t bud, - mp_obj_t signal) { - uint32_t val = bl00mbox_channel_bud_get_signal_hints( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_int(val); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_hints_obj, - mp_channel_bud_get_signal_hints); - -STATIC mp_obj_t mp_channel_bud_set_signal_value(size_t n_args, - const mp_obj_t *args) { - bool success = bl00mbox_channel_bud_set_signal_value( - mp_obj_get_int(args[0]), // chan - mp_obj_get_int(args[1]), // bud_index - mp_obj_get_int(args[2]), // bud_signal_index - mp_obj_get_int(args[3])); // value - return mp_obj_new_bool(success); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_channel_bud_set_signal_value_obj, - 4, 4, - mp_channel_bud_set_signal_value); - -STATIC mp_obj_t mp_channel_bud_get_signal_value(mp_obj_t chan, mp_obj_t bud, - mp_obj_t signal) { - int16_t val = bl00mbox_channel_bud_get_signal_value( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_int(val); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_signal_value_obj, - mp_channel_bud_get_signal_value); - -STATIC mp_obj_t mp_channel_subscriber_num(mp_obj_t chan, mp_obj_t bud, - mp_obj_t signal) { - return mp_obj_new_int(bl00mbox_channel_subscriber_num( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal))); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_subscriber_num_obj, - mp_channel_subscriber_num); - -STATIC mp_obj_t -mp_channel_get_bud_by_subscriber_list_pos(size_t n_args, const mp_obj_t *args) { - return mp_obj_new_int(bl00mbox_channel_get_bud_by_subscriber_list_pos( - mp_obj_get_int(args[0]), // chan - mp_obj_get_int(args[1]), // bud_index - mp_obj_get_int(args[2]), // bud_signal_index - mp_obj_get_int(args[3])) // pos - ); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( - mp_channel_get_bud_by_subscriber_list_pos_obj, 4, 4, - mp_channel_get_bud_by_subscriber_list_pos); - -STATIC mp_obj_t mp_channel_get_signal_by_subscriber_list_pos( - size_t n_args, const mp_obj_t *args) { - return mp_obj_new_int(bl00mbox_channel_get_signal_by_subscriber_list_pos( - mp_obj_get_int(args[0]), // chan - mp_obj_get_int(args[1]), // bud_index - mp_obj_get_int(args[2]), // bud_signal_index - mp_obj_get_int(args[3])) // pos - ); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN( - mp_channel_get_signal_by_subscriber_list_pos_obj, 4, 4, - mp_channel_get_signal_by_subscriber_list_pos); - -STATIC mp_obj_t mp_channel_get_source_bud(mp_obj_t chan, mp_obj_t bud, - mp_obj_t signal) { - uint64_t val = bl00mbox_channel_get_source_bud( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_int(val); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_get_source_bud_obj, - mp_channel_get_source_bud); - -STATIC mp_obj_t mp_channel_get_source_signal(mp_obj_t chan, mp_obj_t bud, - mp_obj_t signal) { - uint64_t val = bl00mbox_channel_get_source_signal( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_int(val); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_get_source_signal_obj, - mp_channel_get_source_signal); - -// ======================== -// TABLE OPERATIONS -// ======================== - -STATIC mp_obj_t mp_channel_bud_set_table_value(size_t n_args, - const mp_obj_t *args) { - bool success = bl00mbox_channel_bud_set_table_value( - mp_obj_get_int(args[0]), // chan - mp_obj_get_int(args[1]), // bud_index - mp_obj_get_int(args[2]), // table_index - mp_obj_get_int(args[3])); // value - return mp_obj_new_bool(success); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_channel_bud_set_table_value_obj, - 4, 4, - mp_channel_bud_set_table_value); - -STATIC mp_obj_t mp_channel_bud_get_table_value(mp_obj_t chan, mp_obj_t bud, - mp_obj_t table_index) { - int16_t val = bl00mbox_channel_bud_get_table_value( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(table_index)); - return mp_obj_new_int(val); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_bud_get_table_value_obj, - mp_channel_bud_get_table_value); - -STATIC mp_obj_t mp_channel_bud_get_table_pointer(mp_obj_t chan, mp_obj_t bud) { - int16_t *val = bl00mbox_channel_bud_get_table_pointer(mp_obj_get_int(chan), - mp_obj_get_int(bud)); - return mp_obj_new_int_from_uint((uint32_t)val); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_table_pointer_obj, - mp_channel_bud_get_table_pointer); - -STATIC mp_obj_t mp_channel_bud_get_table_len(mp_obj_t chan, mp_obj_t bud) { - uint32_t val = bl00mbox_channel_bud_get_table_len(mp_obj_get_int(chan), - mp_obj_get_int(bud)); - return mp_obj_new_int_from_uint(val); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_channel_bud_get_table_len_obj, - mp_channel_bud_get_table_len); - -// ======================== -// CONNECTION OPERATIONS -// ======================== - -STATIC mp_obj_t mp_channel_disconnect_signal_rx(mp_obj_t chan, mp_obj_t bud, - mp_obj_t signal) { - bool ret = bl00mbox_channel_disconnect_signal_rx( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_bool(ret); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_disconnect_signal_rx_obj, - mp_channel_disconnect_signal_rx); - -STATIC mp_obj_t mp_channel_disconnect_signal_tx(mp_obj_t chan, mp_obj_t bud, - mp_obj_t signal) { - bool ret = bl00mbox_channel_disconnect_signal_tx( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_bool(ret); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_disconnect_signal_tx_obj, - mp_channel_disconnect_signal_tx); - -STATIC mp_obj_t mp_channel_connect_signal(size_t n_args, const mp_obj_t *args) { - bool success = bl00mbox_channel_connect_signal( - mp_obj_get_int(args[0]), // chan - mp_obj_get_int(args[1]), // bud_tx_index - mp_obj_get_int(args[2]), // bud_tx_signal_index - mp_obj_get_int(args[3]), // bud_tx_index - mp_obj_get_int(args[4])); // bud_tx_signal_index - return mp_obj_new_bool(success); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_channel_connect_signal_obj, 5, 5, - mp_channel_connect_signal); - -STATIC mp_obj_t mp_channel_connect_signal_to_output_mixer( - mp_obj_t chan, mp_obj_t bud_index, mp_obj_t bud_signal_index) { - bool success = bl00mbox_channel_connect_signal_to_output_mixer( - mp_obj_get_int(chan), mp_obj_get_int(bud_index), - mp_obj_get_int(bud_signal_index)); - return mp_obj_new_bool(success); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3(mp_channel_connect_signal_to_output_mixer_obj, - mp_channel_connect_signal_to_output_mixer); - -STATIC mp_obj_t mp_channel_disconnect_signal_from_output_mixer( - mp_obj_t chan, mp_obj_t bud, mp_obj_t signal) { - bool ret = bl00mbox_channel_disconnect_signal_from_output_mixer( - mp_obj_get_int(chan), mp_obj_get_int(bud), mp_obj_get_int(signal)); - return mp_obj_new_bool(ret); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_3( - mp_channel_disconnect_signal_from_output_mixer_obj, - mp_channel_disconnect_signal_from_output_mixer); - -STATIC const mp_map_elem_t bl00mbox_globals_table[] = { - { MP_OBJ_NEW_QSTR(MP_QSTR___name__), - MP_OBJ_NEW_QSTR(MP_QSTR_sys_bl00mbox) }, - - // PLUGIN OPERATIONS - { MP_ROM_QSTR(MP_QSTR_plugin_registry_num_plugins), - MP_ROM_PTR(&mp_plugin_registry_num_plugins_obj) }, - { MP_ROM_QSTR(MP_QSTR_plugin_index_get_id), - MP_ROM_PTR(&mp_plugin_index_get_id_obj) }, - { MP_ROM_QSTR(MP_QSTR_plugin_index_get_name), - MP_ROM_PTR(&mp_plugin_index_get_name_obj) }, - { MP_ROM_QSTR(MP_QSTR_plugin_index_get_description), - MP_ROM_PTR(&mp_plugin_index_get_description_obj) }, - - // CHANNEL OPERATIONS - { MP_ROM_QSTR(MP_QSTR_channel_get_free), - MP_ROM_PTR(&mp_channel_get_free_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_set_free), - MP_ROM_PTR(&mp_channel_set_free_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_free_index), - MP_ROM_PTR(&mp_channel_get_free_index_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_foreground), - MP_ROM_PTR(&mp_channel_get_foreground_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_set_foreground), - MP_ROM_PTR(&mp_channel_set_foreground_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_background_mute_override), - MP_ROM_PTR(&mp_channel_get_background_mute_override_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_set_background_mute_override), - MP_ROM_PTR(&mp_channel_set_background_mute_override_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_enable), MP_ROM_PTR(&mp_channel_enable_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_disable), - MP_ROM_PTR(&mp_channel_disable_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_clear), MP_ROM_PTR(&mp_channel_clear_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_set_volume), - MP_ROM_PTR(&mp_channel_set_volume_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_volume), - MP_ROM_PTR(&mp_channel_get_volume_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_set_name), - MP_ROM_PTR(&mp_channel_set_name_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_name), - MP_ROM_PTR(&mp_channel_get_name_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_buds_num), - MP_ROM_PTR(&mp_channel_buds_num_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_bud_by_list_pos), - MP_ROM_PTR(&mp_channel_get_bud_by_list_pos_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_conns_num), - MP_ROM_PTR(&mp_channel_conns_num_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_mixer_num), - MP_ROM_PTR(&mp_channel_mixer_num_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_bud_by_mixer_list_pos), - MP_ROM_PTR(&mp_channel_get_bud_by_mixer_list_pos_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_signal_by_mixer_list_pos), - MP_ROM_PTR(&mp_channel_get_signal_by_mixer_list_pos_obj) }, - - // BUD OPERATIONS - { MP_ROM_QSTR(MP_QSTR_channel_new_bud), - MP_ROM_PTR(&mp_channel_new_bud_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_delete_bud), - MP_ROM_PTR(&mp_channel_delete_bud_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_exists), - MP_ROM_PTR(&mp_channel_bud_exists_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_name), - MP_ROM_PTR(&mp_channel_bud_get_name_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_description), - MP_ROM_PTR(&mp_channel_bud_get_description_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_plugin_id), - MP_ROM_PTR(&mp_channel_bud_get_plugin_id_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_num_signals), - MP_ROM_PTR(&mp_channel_bud_get_num_signals_obj) }, - - // SIGNAL OPERATIONS - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_name), - MP_ROM_PTR(&mp_channel_bud_get_signal_name_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_name_multiplex), - MP_ROM_PTR(&mp_channel_bud_get_signal_name_multiplex_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_description), - MP_ROM_PTR(&mp_channel_bud_get_signal_description_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_unit), - MP_ROM_PTR(&mp_channel_bud_get_signal_unit_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_set_signal_value), - MP_ROM_PTR(&mp_channel_bud_set_signal_value_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_value), - MP_ROM_PTR(&mp_channel_bud_get_signal_value_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_signal_hints), - MP_ROM_PTR(&mp_channel_bud_get_signal_hints_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_subscriber_num), - MP_ROM_PTR(&mp_channel_subscriber_num_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_bud_by_subscriber_list_pos), - MP_ROM_PTR(&mp_channel_get_bud_by_subscriber_list_pos_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_signal_by_subscriber_list_pos), - MP_ROM_PTR(&mp_channel_get_signal_by_subscriber_list_pos_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_source_bud), - MP_ROM_PTR(&mp_channel_get_source_bud_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_get_source_signal), - MP_ROM_PTR(&mp_channel_get_source_signal_obj) }, - - // TABLE OPERATIONS - { MP_ROM_QSTR(MP_QSTR_channel_bud_set_table_value), - MP_ROM_PTR(&mp_channel_bud_set_table_value_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_table_value), - MP_ROM_PTR(&mp_channel_bud_get_table_value_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_table_pointer), - MP_ROM_PTR(&mp_channel_bud_get_table_pointer_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_bud_get_table_len), - MP_ROM_PTR(&mp_channel_bud_get_table_len_obj) }, - - // CONNECTION OPERATIONS - { MP_ROM_QSTR(MP_QSTR_channel_connect_signal), - MP_ROM_PTR(&mp_channel_connect_signal_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_disconnect_signal_rx), - MP_ROM_PTR(&mp_channel_disconnect_signal_rx_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_disconnect_signal_tx), - MP_ROM_PTR(&mp_channel_disconnect_signal_tx_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_connect_signal_to_output_mixer), - MP_ROM_PTR(&mp_channel_connect_signal_to_output_mixer_obj) }, - { MP_ROM_QSTR(MP_QSTR_channel_disconnect_signal_from_output_mixer), - MP_ROM_PTR(&mp_channel_disconnect_signal_from_output_mixer_obj) }, - - // CONSTANTS - { MP_ROM_QSTR(MP_QSTR_NUM_CHANNELS), MP_ROM_INT(BL00MBOX_CHANNELS) }, - { MP_ROM_QSTR(MP_QSTR_RADSPA_SIGNAL_HINT_SCT), - MP_ROM_INT(RADSPA_SIGNAL_HINT_SCT) }, - { MP_ROM_QSTR(MP_QSTR_RADSPA_SIGNAL_HINT_GAIN), - MP_ROM_INT(RADSPA_SIGNAL_HINT_GAIN) }, - { MP_ROM_QSTR(MP_QSTR_RADSPA_SIGNAL_HINT_TRIGGER), - MP_ROM_INT(RADSPA_SIGNAL_HINT_TRIGGER) }, - { MP_ROM_QSTR(MP_QSTR_BL00MBOX_CHANNELS), MP_ROM_INT(BL00MBOX_CHANNELS) }, -}; - -STATIC MP_DEFINE_CONST_DICT(mp_module_bl00mbox_globals, bl00mbox_globals_table); - -const mp_obj_module_t bl00mbox_user_cmodule = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_bl00mbox_globals, -}; - -MP_REGISTER_MODULE(MP_QSTR_sys_bl00mbox, bl00mbox_user_cmodule); diff --git a/components/micropython/usermodule/mp_sys_bl00mbox.c b/components/micropython/usermodule/mp_sys_bl00mbox.c new file mode 120000 index 0000000000000000000000000000000000000000..956cebdbe4664454cf278d3d2e071fac512d401d --- /dev/null +++ b/components/micropython/usermodule/mp_sys_bl00mbox.c @@ -0,0 +1 @@ +../../bl00mbox/micropython/mp_sys_bl00mbox.c \ No newline at end of file diff --git a/python_payload/bl00mbox b/python_payload/bl00mbox new file mode 120000 index 0000000000000000000000000000000000000000..cdb3190c4506a22b1edc57420e174da6f30179e2 --- /dev/null +++ b/python_payload/bl00mbox @@ -0,0 +1 @@ +../components/bl00mbox/micropython/bl00mbox \ No newline at end of file diff --git a/python_payload/bl00mbox/LICENSE b/python_payload/bl00mbox/LICENSE deleted file mode 100644 index 0e259d42c996742e9e3cba14c677129b2c1b6311..0000000000000000000000000000000000000000 --- a/python_payload/bl00mbox/LICENSE +++ /dev/null @@ -1,121 +0,0 @@ -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work.