From 91a00438028c9e48d0fffbcc838fe038cc18d7e0 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Tue, 1 Mar 2022 01:49:43 -0500 Subject: Destroy managed spatial scene objects --- src/bank.c | 1 + src/spatial.c | 5 +++++ src/synth.c | 1 + src/vox.c | 1 + 4 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/bank.c b/src/bank.c index e311023..fbc9cb4 100644 --- a/src/bank.c +++ b/src/bank.c @@ -135,6 +135,7 @@ xas_bank_player *xas_bank_player_new(xas_bank *bank) { player->obj.stop = (xas_object_stop_callback)xas_bank_player_stop; player->obj.set_gain = (xas_object_set_gain_callback)set_gain; player->obj.stream_new = (xas_object_stream_new_callback)xas_bank_player_stream_new; + player->obj.destroy = (xas_object_destroy_callback)xas_bank_player_destroy; player->bank = bank; player->status = XAS_BANK_PLAYER_STOPPED; diff --git a/src/spatial.c b/src/spatial.c index 63207fa..9631603 100644 --- a/src/spatial.c +++ b/src/spatial.c @@ -311,6 +311,10 @@ void xas_spatial_scene_destroy(xas_spatial_scene *scene) { while (object) { xas_spatial_object *next = object->next; + if (object->flags & XAS_SPATIAL_OBJECT_MANAGED) { + xas_object_destroy(object->ctx); + } + free(object); object = next; @@ -398,6 +402,7 @@ xas_spatial_object *xas_spatial_scene_add_object(xas_spatial_scene *scene, object->point = point; object->source = source; object->ctx = ctx; + object->flags = XAS_SPATIAL_OBJECT_NONE; object->next = NULL; object->delta_l = 0; object->delta_r = 0; diff --git a/src/synth.c b/src/synth.c index 4956621..6057ce3 100644 --- a/src/synth.c +++ b/src/synth.c @@ -130,6 +130,7 @@ xas_synth *xas_synth_new(xas_audio_format format, synth->obj.stop = (xas_object_stop_callback)synth_stop; synth->obj.set_gain = (xas_object_set_gain_callback)set_gain; synth->obj.stream_new = (xas_object_stream_new_callback)xas_synth_stream_new; + synth->obj.destroy = (xas_object_destroy_callback)xas_synth_destroy; synth->type = type; synth->state = XAS_SYNTH_IDLE; diff --git a/src/vox.c b/src/vox.c index f53f3fd..9d3d098 100644 --- a/src/vox.c +++ b/src/vox.c @@ -293,6 +293,7 @@ xas_vox *xas_vox_new_args(xas_audio_format format, vox->obj.stop = (xas_object_stop_callback)xas_vox_stop; vox->obj.set_gain = (xas_object_set_gain_callback)set_gain; vox->obj.stream_new = (xas_object_stream_new_callback)xas_vox_stream_new; + vox->obj.destroy = (xas_object_destroy_callback)xas_vox_destroy; vox->text2wave_path = text2wave_path; -- cgit v1.2.3