From 45b88124dbf7dd2a9b276b32f47c1daf549f0779 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Wed, 9 Feb 2022 15:28:43 -0500 Subject: I wish I could do this to get out of my life --- include/xas/spatial.h | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'include') diff --git a/include/xas/spatial.h b/include/xas/spatial.h index 7f07b01..8b1ca05 100644 --- a/include/xas/spatial.h +++ b/include/xas/spatial.h @@ -3,12 +3,23 @@ #include -#define XAS_SPATIAL_SPEED_M_S 343.0f +#define XAS_SPATIAL_DEFAULT_OBSERVER_WIDTH 0.18f +#define XAS_SPATIAL_DEFAULT_SPEED 343.0f /* m/s */ typedef struct _xas_spatial_coord { float x, y, z; } xas_spatial_coord; +typedef struct _xas_spatial_rotation { + float pitch, roll, yaw; +} xas_spatial_rotation; + +typedef struct _xas_spatial_observer { + xas_spatial_coord coord; + xas_spatial_rotation rotation; + float width; +} xas_spatial_observer; + typedef struct _xas_spatial_object xas_spatial_object; struct _xas_spatial_object { @@ -18,41 +29,38 @@ struct _xas_spatial_object { }; typedef struct _xas_spatial_scene { + xas_audio_format format; + + xas_spatial_observer observer; + xas_spatial_coord speaker_l, - speaker_r, - observer; + speaker_r; - float speed_m_s, - headwidth; + float speed; xas_spatial_object *first, *last; - xas_audio_stream *source; - void *buf; size_t buflen; } xas_spatial_scene; -xas_spatial_scene *xas_spatial_scene_new(xas_spatial_coord speaker_l, - xas_spatial_coord speaker_r, - xas_spatial_coord observer, - float headwidth); +xas_spatial_scene *xas_spatial_scene_new(xas_audio_format format, + xas_spatial_coord speaker_l, + xas_spatial_coord speaker_r); void xas_spatial_scene_destroy(xas_spatial_scene *scene); -void xas_spatial_scene_set_speed_m_s(xas_spatial_scene *scene, - float m_s); +int xas_spatial_scene_set_observer(xas_spatial_scene *scene, + xas_spatial_coord coord, + xas_spatial_rotation rotation, + float width); void xas_spatial_scene_set_speaker_coords(xas_spatial_scene *scene, xas_spatial_coord speaker_l, xas_spatial_coord speaker_r); -void xas_spatial_scene_set_observer_coords(xas_spatial_scene *scene, - xas_spatial_coord observer); - -void xas_spatial_scene_set_observer_headwidth(xas_spatial_scene *scene, - float headwidth); +void xas_spatial_scene_set_speed(xas_spatial_scene *scene, float speed); xas_spatial_object *xas_spatial_scene_add_object(xas_spatial_coord coord, xas_audio_stream *source); @@ -63,4 +71,6 @@ void xas_spatial_object_get_coord(xas_spatial_object *object, void xas_spatial_object_set_coord(xas_spatial_object *object, xas_spatial_coord coord); +xas_audio_stream *xas_spatial_scene_new_stream(xas_spatial_scene *scene); + #endif /* _XAS_SPATIAL_H */ -- cgit v1.2.3