summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/xas/spatial.h49
1 files changed, 36 insertions, 13 deletions
diff --git a/include/xas/spatial.h b/include/xas/spatial.h
index 8b1ca05..a715b65 100644
--- a/include/xas/spatial.h
+++ b/include/xas/spatial.h
@@ -4,14 +4,28 @@
#include <xas/audio.h>
#define XAS_SPATIAL_DEFAULT_OBSERVER_WIDTH 0.18f
-#define XAS_SPATIAL_DEFAULT_SPEED 343.0f /* m/s */
+#define XAS_SPATIAL_DEFAULT_RADIUS 4000.0f /* metres */
+#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;
+ union {
+ float x;
+ float pitch;
+ };
+
+ union {
+ float y;
+ float roll;
+ };
+
+ union {
+ float z;
+ float yaw;
+ };
} xas_spatial_rotation;
typedef struct _xas_spatial_observer {
@@ -23,11 +37,16 @@ typedef struct _xas_spatial_observer {
typedef struct _xas_spatial_object xas_spatial_object;
struct _xas_spatial_object {
- float x, y, z;
+ xas_spatial_coord coord;
xas_audio_stream *source;
xas_spatial_object *next;
};
+typedef struct _xas_spatial_buffer {
+ size_t index,
+ size;
+} xas_spatial_buffer;
+
typedef struct _xas_spatial_scene {
xas_audio_format format;
@@ -36,13 +55,13 @@ typedef struct _xas_spatial_scene {
xas_spatial_coord speaker_l,
speaker_r;
- float speed;
+ float speed,
+ radius;
xas_spatial_object *first,
*last;
- void *buf;
- size_t buflen;
+ xas_spatial_buffer *buffer;
} xas_spatial_scene;
xas_spatial_scene *xas_spatial_scene_new(xas_audio_format format,
@@ -51,18 +70,21 @@ xas_spatial_scene *xas_spatial_scene_new(xas_audio_format format,
void xas_spatial_scene_destroy(xas_spatial_scene *scene);
-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_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_speed(xas_spatial_scene *scene, float speed);
+int xas_spatial_scene_set_speed(xas_spatial_scene *scene, float speed);
+
+int xas_spatial_scene_set_radius(xas_spatial_scene *scene, float radius);
-xas_spatial_object *xas_spatial_scene_add_object(xas_spatial_coord coord,
+xas_spatial_object *xas_spatial_scene_add_object(xas_spatial_scene *scene,
+ xas_spatial_coord coord,
xas_audio_stream *source);
void xas_spatial_object_get_coord(xas_spatial_object *object,
@@ -71,6 +93,7 @@ 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);
+xas_audio_stream *xas_spatial_scene_new_stream(xas_spatial_scene *scene,
+ size_t buffer_size);
#endif /* _XAS_SPATIAL_H */