From e72fb150ee2c46d2b148d31e6948868d56cfc8e7 Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Wed, 9 Feb 2022 02:13:22 -0500 Subject: Initial implementation of include/xas/spatial.h --- include/xas/spatial.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 include/xas/spatial.h (limited to 'include') diff --git a/include/xas/spatial.h b/include/xas/spatial.h new file mode 100644 index 0000000..7f07b01 --- /dev/null +++ b/include/xas/spatial.h @@ -0,0 +1,66 @@ +#ifndef _XAS_SPATIAL_H +#define _XAS_SPATIAL_H + +#include + +#define XAS_SPATIAL_SPEED_M_S 343.0f + +typedef struct _xas_spatial_coord { + float x, y, z; +} xas_spatial_coord; + +typedef struct _xas_spatial_object xas_spatial_object; + +struct _xas_spatial_object { + float x, y, z; + xas_audio_stream *source; + xas_spatial_object *next; +}; + +typedef struct _xas_spatial_scene { + xas_spatial_coord speaker_l, + speaker_r, + observer; + + float speed_m_s, + headwidth; + + 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); + +void xas_spatial_scene_destroy(xas_spatial_scene *scene); + +void xas_spatial_scene_set_speed_m_s(xas_spatial_scene *scene, + float m_s); + +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); + +xas_spatial_object *xas_spatial_scene_add_object(xas_spatial_coord coord, + xas_audio_stream *source); + +void xas_spatial_object_get_coord(xas_spatial_object *object, + xas_spatial_coord *coord); + +void xas_spatial_object_set_coord(xas_spatial_object *object, + xas_spatial_coord coord); + +#endif /* _XAS_SPATIAL_H */ -- cgit v1.2.3