summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/xas/spatial.h4
-rw-r--r--src/spatial.c24
2 files changed, 14 insertions, 14 deletions
diff --git a/include/xas/spatial.h b/include/xas/spatial.h
index 26d47e5..af10ef4 100644
--- a/include/xas/spatial.h
+++ b/include/xas/spatial.h
@@ -38,8 +38,8 @@ struct _xas_spatial_object {
float distance_l,
distance_r;
- size_t delta_l,
- delta_r;
+ size_t delay_l,
+ delay_r;
ssize_t shift_l,
shift_r;
diff --git a/src/spatial.c b/src/spatial.c
index 2abe22e..87307f0 100644
--- a/src/spatial.c
+++ b/src/spatial.c
@@ -129,7 +129,7 @@ error_realloc_buffer:
return -1;
}
-static inline size_t sample_delta(xas_spatial_scene *scene, float distance) {
+static inline size_t sample_delay(xas_spatial_scene *scene, float distance) {
return floorf((distance / scene->speed) * (float)scene->format.sample_rate);
}
@@ -184,20 +184,20 @@ static void buffer_copy(xas_spatial_buffer *buffer,
static void object_position(xas_spatial_scene *scene,
xas_spatial_object *object,
xas_spatial_coord point) {
- size_t delta_l_old = object->delta_l,
- delta_r_old = object->delta_r;
+ size_t delay_l_old = object->delay_l,
+ delay_r_old = object->delay_r;
object->point = point;
object->distance_l = dist(scene->speaker_l, point);
object->distance_r = dist(scene->speaker_r, point);
- object->delta_l = sample_delta(scene, object->distance_l);
- object->delta_r = sample_delta(scene, object->distance_r);
- object->shift_l = object->delta_l - delta_l_old;
- object->shift_r = object->delta_r - delta_r_old;
+ object->delay_l = sample_delay(scene, object->distance_l);
+ object->delay_r = sample_delay(scene, object->distance_r);
+ object->shift_l = object->delay_l - delay_l_old;
+ object->shift_r = object->delay_r - delay_r_old;
}
-static void object_update_deltas(xas_spatial_scene *scene) {
+static void object_update_delays(xas_spatial_scene *scene) {
xas_spatial_object *obj = scene->first;
while (obj) {
@@ -368,7 +368,7 @@ void xas_spatial_scene_set_speaker_coords(xas_spatial_scene *scene,
scene->speaker_l = speaker_l;
scene->speaker_r = speaker_r;
- object_update_deltas(scene);
+ object_update_delays(scene);
}
int xas_spatial_scene_set_speed(xas_spatial_scene *scene, float speed) {
@@ -408,8 +408,8 @@ xas_spatial_object *xas_spatial_scene_add_object(xas_spatial_scene *scene,
object->heading.z = 0;
object->speed = XAS_SPATIAL_DEFAULT_OBJECT_SPEED;
object->next = NULL;
- object->delta_l = 0;
- object->delta_r = 0;
+ object->delay_l = 0;
+ object->delay_r = 0;
object_position(scene, object, point);
@@ -547,7 +547,7 @@ void xas_spatial_scene_position_object(xas_spatial_scene *scene,
xas_spatial_coord point) {
object->point = point;
- object_update_deltas(scene);
+ object_update_delays(scene);
}
void xas_spatial_object_get_point(xas_spatial_object *object,