summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 */