diff options
author | XANTRONIX Development | 2022-03-05 22:35:17 -0500 |
---|---|---|
committer | XANTRONIX Development | 2022-03-05 22:35:17 -0500 |
commit | b90c3e14988c2180fd5b8028fec74527501a4deb (patch) | |
tree | bb1faa3526920296c186b642c7343bfe7deea5d3 | |
parent | 79886752ce99eab7f6e659aa99f0a416b1928b9d (diff) | |
download | xas-b90c3e14988c2180fd5b8028fec74527501a4deb.tar.gz xas-b90c3e14988c2180fd5b8028fec74527501a4deb.tar.bz2 xas-b90c3e14988c2180fd5b8028fec74527501a4deb.zip |
Ensure defaults are initialised
-rw-r--r-- | include/xas/spatial.h | 9 | ||||
-rw-r--r-- | src/spatial.c | 20 |
2 files changed, 17 insertions, 12 deletions
diff --git a/include/xas/spatial.h b/include/xas/spatial.h index f8591df..26d47e5 100644 --- a/include/xas/spatial.h +++ b/include/xas/spatial.h @@ -5,14 +5,15 @@ #include <xas/bank.h> #include <xas/audio.h> -#define XAS_SPATIAL_OBJECT_NONE 0 -#define XAS_SPATIAL_OBJECT_MANAGED (1 << 0) - #define XAS_SPATIAL_DEFAULT_OBSERVER_WIDTH 0.18f #define XAS_SPATIAL_DEFAULT_RADIUS 4000.0f /* metres */ -#define XAS_SPATIAL_DEFAULT_SPEED 343.0f /* m/s */ +#define XAS_SPATIAL_DEFAULT_MEDIUM_SPEED 343.0f /* m/s */ +#define XAS_SPATIAL_DEFAULT_OBJECT_SPEED 0.0f /* m/s */ #define XAS_SPATIAL_DEFAULT_CONE_ANGLE 35.0f /* degrees */ +#define XAS_SPATIAL_OBJECT_NONE 0 +#define XAS_SPATIAL_OBJECT_MANAGED (1 << 0) + typedef struct _xas_spatial_coord { float x, y, z; } xas_spatial_coord; diff --git a/src/spatial.c b/src/spatial.c index 7d71e37..ce3b64e 100644 --- a/src/spatial.c +++ b/src/spatial.c @@ -337,7 +337,7 @@ xas_spatial_scene *xas_spatial_scene_new(xas_audio_format format, scene->speaker_l = speaker_l; scene->speaker_r = speaker_r; scene->radius = XAS_SPATIAL_DEFAULT_RADIUS; - scene->speed = XAS_SPATIAL_DEFAULT_SPEED; + scene->speed = XAS_SPATIAL_DEFAULT_MEDIUM_SPEED; if (buffer_realloc(scene, NULL) < 0) { goto error_buffer_realloc; @@ -418,13 +418,17 @@ xas_spatial_object *xas_spatial_scene_add_object(xas_spatial_scene *scene, goto error_malloc_object; } - 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; + object->point = point; + object->source = source; + object->ctx = ctx; + object->flags = XAS_SPATIAL_OBJECT_NONE; + object->heading.x = 0; + object->heading.y = 0; + object->heading.z = 0; + object->speed = XAS_SPATIAL_DEFAULT_OBJECT_SPEED; + object->next = NULL; + object->delta_l = 0; + object->delta_r = 0; object_position(scene, object, point); |