Implemented sound playing with test sound
[projects/chimara/chimara.git] / tests / soundtest.c
index 18c36fa7a857e6c0eb6386715dc26c2d5e89baee..a4aae14f3b7f102b8977a8bdaeccea91377de1c7 100644 (file)
@@ -1,5 +1,6 @@
 #include <libchimara/glk.h>
 #include <stdio.h>
+#include <unistd.h>
 
 void
 glk_main(void)
@@ -18,14 +19,23 @@ glk_main(void)
                fprintf(stderr, "Could not create sound channel.\n");
                return;
        }
+
+       if(!glk_schannel_play(sc, 0)) { /* resource number doesn't matter right now */
+               fprintf(stderr, "Could not start sound channel.\n");
+               return;
+       }
        
        glk_schannel_set_volume(sc, 0x10000);
+       sleep(1);
        glk_schannel_set_volume(sc, 0x08000);
+       sleep(1);
        glk_schannel_set_volume(sc, 0x04000);
+       sleep(1);
        glk_schannel_set_volume(sc, 0x00000);
        glk_schannel_set_volume(sc, 0xA0000); /* max supported volume */
        glk_schannel_set_volume(sc, 0xB0000); /* should be coerced */
        glk_schannel_set_volume(sc, 0x10000);
-       
+
+       glk_schannel_stop(sc);
        glk_schannel_destroy(sc);
 }