[Spice-devel] [PATCH spice-server 4/4] test-playback: Simplify wave generation formulae
Frediano Ziglio
fziglio at redhat.com
Fri Dec 21 08:58:19 UTC 2018
Split level computation, make clear is a sine wave on both channels.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/tests/test-playback.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/server/tests/test-playback.c b/server/tests/test-playback.c
index 87469c8e..290c8609 100644
--- a/server/tests/test-playback.c
+++ b/server/tests/test-playback.c
@@ -89,7 +89,8 @@ static void playback_timer_cb(SPICE_GNUC_UNUSED void *opaque)
while (samples_to_send > num_samples && frame) {
samples_to_send -= num_samples;
for (i = 0 ; i < num_samples; ++i) {
- frame[i] = (((uint16_t)((1<<14)*sin((t+i)/10))) << 16) + (((uint16_t)((1<<14)*sin((t+i)/10))));
+ uint16_t level = (1<<14) * sin((t+i)/10.0);
+ frame[i] = (level << 16) + level;
}
t += num_samples;
spice_server_playback_put_samples(&playback_instance, frame);
--
2.17.2
More information about the Spice-devel
mailing list