summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-11 16:51:28 -0500
committerXANTRONIX Development2022-03-11 16:51:28 -0500
commit9a3ccf5f3e1ff27f363d636db7463cd176918fe1 (patch)
treef0cdc9cda0d9ac1df1a35442944ff2644c481e35
parentcd1473045a30548b10d5873ec825863ddd429674 (diff)
downloadxas-9a3ccf5f3e1ff27f363d636db7463cd176918fe1.tar.gz
xas-9a3ccf5f3e1ff27f363d636db7463cd176918fe1.tar.bz2
xas-9a3ccf5f3e1ff27f363d636db7463cd176918fe1.zip
Implement methods for observer, speaker rotation
-rw-r--r--include/xas/spatial.h9
-rw-r--r--src/spatial.c18
2 files changed, 27 insertions, 0 deletions
diff --git a/include/xas/spatial.h b/include/xas/spatial.h
index af10ef4..00cf8ff 100644
--- a/include/xas/spatial.h
+++ b/include/xas/spatial.h
@@ -89,10 +89,19 @@ void xas_spatial_scene_set_observer(xas_spatial_scene *scene,
xas_spatial_coord rotation,
float width);
+void xas_spatial_scene_position_observer(xas_spatial_scene *scene,
+ xas_spatial_coord point);
+
+void xas_spatial_scene_rotate_observer(xas_spatial_scene *scene,
+ xas_spatial_coord rotation);
+
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_rotate_speakers(xas_spatial_scene *scene,
+ xas_spatial_coord rotation);
+
int xas_spatial_scene_set_speed(xas_spatial_scene *scene, float speed);
int xas_spatial_scene_set_radius(xas_spatial_scene *scene, float radius);
diff --git a/src/spatial.c b/src/spatial.c
index fc13a53..1da1bdc 100644
--- a/src/spatial.c
+++ b/src/spatial.c
@@ -412,6 +412,16 @@ void xas_spatial_scene_set_observer(xas_spatial_scene *scene,
scene->observer.width = width;
}
+void xas_spatial_scene_position_observer(xas_spatial_scene *scene,
+ xas_spatial_coord point) {
+ scene->observer.point = point;
+}
+
+void xas_spatial_scene_rotate_observer(xas_spatial_scene *scene,
+ xas_spatial_coord rotation) {
+ scene->observer.rotation = rotation;
+}
+
void xas_spatial_scene_set_speaker_coords(xas_spatial_scene *scene,
xas_spatial_coord speaker_l,
xas_spatial_coord speaker_r) {
@@ -421,6 +431,14 @@ void xas_spatial_scene_set_speaker_coords(xas_spatial_scene *scene,
object_update_delays(scene);
}
+void xas_spatial_scene_rotate_speakers(xas_spatial_scene *scene,
+ xas_spatial_coord rotation) {
+ rotate(rotation, &scene->speaker_l);
+ rotate(rotation, &scene->speaker_r);
+
+ object_update_delays(scene);
+}
+
int xas_spatial_scene_set_speed(xas_spatial_scene *scene, float speed) {
scene->speed = speed;