summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorXANTRONIX Development2022-02-09 02:13:22 -0500
committerXANTRONIX Development2022-02-09 02:16:45 -0500
commite72fb150ee2c46d2b148d31e6948868d56cfc8e7 (patch)
tree008c75312717873cddf4eebeb98a58a1ea0272aa /include
parent77976d03699f95ea28278b5fdbba392f198b5f52 (diff)
downloadxas-e72fb150ee2c46d2b148d31e6948868d56cfc8e7.tar.gz
xas-e72fb150ee2c46d2b148d31e6948868d56cfc8e7.tar.bz2
xas-e72fb150ee2c46d2b148d31e6948868d56cfc8e7.zip
Initial implementation of include/xas/spatial.h
Diffstat (limited to 'include')
-rw-r--r--include/xas/spatial.h66
1 files changed, 66 insertions, 0 deletions
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 <xas/audio.h>
+
+#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 */