[PATCH spice-server 4/4] test-playback: Simplify wave generation formulae

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Split level computation, make clear is a sine wave on both channels.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]