summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXANTRONIX Development2022-03-06 10:04:34 -0500
committerXANTRONIX Development2022-03-06 10:04:34 -0500
commitcb7f5f0dc85cd3415d6e7893dde649670559e944 (patch)
tree55c29773a4b2e9c12f4a6b0cbe6b19ffdc313972 /src
parent79ff65a3613ba81c0d982077bc92d1192faa742b (diff)
downloadxas-cb7f5f0dc85cd3415d6e7893dde649670559e944.tar.gz
xas-cb7f5f0dc85cd3415d6e7893dde649670559e944.tar.bz2
xas-cb7f5f0dc85cd3415d6e7893dde649670559e944.zip
Rename sample delta to "delay" in src/spatial.c
Diffstat (limited to 'src')
-rw-r--r--src/spatial.c24
1 files changed, 12 insertions, 12 deletions
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,