Skip to content
Snippets Groups Projects
Commit 9a55bb51 authored by moon2's avatar moon2 :speech_balloon:
Browse files

bl00mbox bugfixes:

- expose ReferenceError
- remove duplicate fg/bg chans
parent 168deae5
No related branches found
No related tags found
1 merge request!757bl00mbox bugfixes:
Pipeline #13339 passed
......@@ -22,3 +22,7 @@ __pycache__
docs/_build/
/tools/mypy.sh
# bl00mbox docs
components/bl00mbox/docs/
components/bl00mbox/public/
This diff is collapsed.
......@@ -41,10 +41,11 @@ static void update_active_chans(){
bl00mbox_set_iter_start(&iter, background_mute_override_chans);
bl00mbox_channel_t * chan;
while((chan = bl00mbox_set_iter_next(&iter))){
if(chan == foreground_chan) continue;
new_active_chans->elems[index] = chan;
index++;
}
new_active_chans->len = num_chans;
new_active_chans->len = index;
} else {
bl00mbox_log_error("out of memory");
}
......
......@@ -14,6 +14,7 @@
#error "bl00mbox needs finaliser"
#endif
#include "py/objexcept.h"
MP_DEFINE_EXCEPTION(ReferenceError, Exception)
typedef struct _channel_core_obj_t {
......@@ -775,6 +776,9 @@ STATIC const mp_rom_map_elem_t bl00mbox_globals_table[] = {
MP_ROM_INT(RADSPA_SIGNAL_HINT_DEPRECATED) },
{ MP_ROM_QSTR(MP_QSTR_BL00MBOX_CHANNEL_PLUGIN_ID),
MP_ROM_INT(BL00MBOX_CHANNEL_PLUGIN_ID) },
{ MP_ROM_QSTR(MP_QSTR_ReferenceError),
MP_ROM_PTR(&mp_type_ReferenceError) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_bl00mbox_globals, bl00mbox_globals_table);
......
......@@ -52,6 +52,8 @@ struct _radspa_descriptor_t;
struct _radspa_signal_t;
struct _radspa_t;
typedef void (* radspa_render_t)(struct _radspa_t * plugin, uint16_t num_samples, uint32_t render_pass_id);
typedef struct _radspa_descriptor_t{
char * name;
uint32_t id; // unique id number
......@@ -84,10 +86,11 @@ typedef struct _radspa_signal_t{
typedef struct _radspa_t{
const radspa_descriptor_t * descriptor;
void * parent;
// renders all signal outputs for num_samples if render_pass_id has changed
// since the last call, else does nothing.
void (* render)(struct _radspa_t * plugin, uint16_t num_samples, uint32_t render_pass_id);
radspa_render_t render;
// stores id number of render pass.
uint32_t render_pass_id;
......
......@@ -106,11 +106,11 @@ signal from the line input, as well as another that line output that routes to t
# continue playing sound if exited while a petal is held.
This app frees all resources that it doesn't need anymore, simply by calling ``.delete()`` on the channel.
Further attempts to interact with that channel and its plugins will result in a ``ReferenceError``, so a new one
must be created when re-entering. This is okay; the OS recognizes the name of the channel and applies all the
previous mixer settings again. A name should therefore not only be **descriptive**, but also **unique**. But not to
worry, you don't need to check every app ever, if your application name is unique in the app store and you use it for
the channel you have done due diligence.
Further attempts to interact with that channel and its plugins will result in a ``bl00mbox.ReferenceError``, so
a new one must be created when re-entering. This is okay; the OS recognizes the name of the channel and applies
all the previous mixer settings again. A name should therefore not only be **descriptive**, but also **unique**.
But not to worry, you don't need to check every app ever, if your application name is unique in the app store
and you use it for the channel you have done due diligence.
This application is almost well behaved and ready to ship, but there's one more thing we should do first to make
users happy:
......@@ -222,7 +222,7 @@ Secondly, what if a user just wants to be done with that background channel with
if some application has a bug and cannot *not* play in the background by accident? Remember that ``blm.delete()`` method
from earlier - the mixer can call it too. Not on the currently active foreground channel, so if your app doesn't do
backgrounding you don't have to worry about it, but if it does it need to check after re-entry if the channel still
exists, else it might crash with a ``ReferenceError``.
exists, else it might crash with a ``bl00mbox.ReferenceError``.
One last thing before we write some code: What's that currently active foreground channel? Well, simply put, only one
channel is in the foreground at any given time. Most interactions with a channel or its plugins set it as the foreground
......@@ -244,7 +244,7 @@ waste RAM. The OS is not automatically doing it. **For now** :P.
if self.blm is not None:
try:
self.blm.foreground = True
except ReferenceError:
except bl00mbox.ReferenceError:
self.blm = None
if self.blm is None:
......@@ -326,7 +326,7 @@ this example.
if self.blm is not None:
try:
self.blm.foreground = True
except ReferenceError:
except bl00mbox.ReferenceError:
self.blm = None
if self.blm is None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment