diff options
author | XANTRONIX Development | 2022-02-28 13:14:32 -0500 |
---|---|---|
committer | XANTRONIX Development | 2022-02-28 13:14:32 -0500 |
commit | e3117bdba5a7e7531ba06c8dcbcc893d184a16e0 (patch) | |
tree | d436a0dd52c7bc5b722d9e64e559b17ac9b7411d | |
parent | 2bf8a288c817715f84a16cabc13c717c3943e3f4 (diff) | |
download | xas-e3117bdba5a7e7531ba06c8dcbcc893d184a16e0.tar.gz xas-e3117bdba5a7e7531ba06c8dcbcc893d184a16e0.tar.bz2 xas-e3117bdba5a7e7531ba06c8dcbcc893d184a16e0.zip |
Implement xas_spatial_scene_position_object()
-rw-r--r-- | src/Makefile | 6 | ||||
-rw-r--r-- | src/spatial.c | 24 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/Makefile b/src/Makefile index e8bf54d..ce60d40 100644 --- a/src/Makefile +++ b/src/Makefile @@ -7,9 +7,11 @@ CC = $(CROSS)cc CFLAGS += -I$(INCLUDE_PATH) LDFLAGS += -HEADERS = audio.h riff.h mixer.h synth.h vox.h bank.h spatial.h script.h +HEADERS = audio.h riff.h mixer.h object.h synth.h vox.h bank.h \ + spatial.h script.h -OBJS = audio.o riff.o mixer.o synth.o vox.o bank.o spatial.o script.o +OBJS = audio.o riff.o mixer.o object.o synth.o vox.o bank.o \ + spatial.o script.o VERSION_MAJOR = 0 VERSION_MINOR = 0.1 diff --git a/src/spatial.c b/src/spatial.c index 9399369..da89ad3 100644 --- a/src/spatial.c +++ b/src/spatial.c @@ -346,14 +346,9 @@ static void object_position(xas_spatial_scene *scene, object->shift_r = object->delta_r - delta_r_old; } -void xas_spatial_scene_set_speaker_coords(xas_spatial_scene *scene, - xas_spatial_coord speaker_l, - xas_spatial_coord speaker_r) { +static void object_update_deltas(xas_spatial_scene *scene) { xas_spatial_object *obj = scene->first; - scene->speaker_l = speaker_l; - scene->speaker_r = speaker_r; - while (obj) { xas_spatial_object *next = obj->next; @@ -363,6 +358,15 @@ void xas_spatial_scene_set_speaker_coords(xas_spatial_scene *scene, } } +void xas_spatial_scene_set_speaker_coords(xas_spatial_scene *scene, + xas_spatial_coord speaker_l, + xas_spatial_coord speaker_r) { + scene->speaker_l = speaker_l; + scene->speaker_r = speaker_r; + + object_update_deltas(scene); +} + int xas_spatial_scene_set_speed(xas_spatial_scene *scene, float speed) { scene->speed = speed; @@ -417,6 +421,14 @@ error_invalid_source: return NULL; } +void xas_spatial_scene_position_object(xas_spatial_scene *scene, + xas_spatial_object *object, + xas_spatial_coord point) { + object->point = point; + + object_update_deltas(scene); +} + void xas_spatial_object_get_point(xas_spatial_object *object, xas_spatial_coord *point) { point->x = object->point.x; |