INNER CODE UNIT · C
_a_layer_add
tek256/astera · src/audio.c:190
static uint8_t _a_layer_add(a_layer* layer, uint32_t id, uint8_t is_sfx) {
if (is_sfx) {
if (layer->sfx_count == layer->sfx_capacity) {
ASTERA_FUNC_DBG("no free sfx slots in layer\n");
return 0;
}
for (uint16_t i = 0; i < layer->sfx_capacity; ++i) {
if (layer->sfx[i] == id) {
ASTERA_FUNC_DBG("sfx id [%i] already in layer\n", id);
return 0;
}
if (layer->sfx[i] == 0) {
layer->sfx[i] = id;
++layer->sfx_count;
return 1;
}