From: Philip Chimento Date: Wed, 5 Jan 2011 21:54:34 +0000 (-0500) Subject: Add test plugin for sound functions X-Git-Tag: v0.9~152^2~15 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=ca7d2c46ded9c992b652a490532c6334b7eed207;p=projects%2Fchimara%2Fchimara.git Add test plugin for sound functions Add a test plugin, to be loaded with plugin-loader, for various testing of sound functions. --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 0300609..0fdb542 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,7 +29,8 @@ test_close_SOURCES = test-close.c test_close_CFLAGS = @TEST_CFLAGS@ $(AM_CFLAGS) test_close_LDADD = @TEST_LIBS@ $(top_builddir)/libchimara/libchimara.la -noinst_LTLIBRARIES = first.la model.la gridtest.la splittest.la multiwin.la styletest.la +noinst_LTLIBRARIES = first.la model.la gridtest.la splittest.la multiwin.la \ + styletest.la soundtest.la first_la_SOURCES = first.c first_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS) @@ -48,3 +49,6 @@ multiwin_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS) styletest_la_SOURCES = styletest.c styletest_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS) + +soundtest_la_SOURCES = soundtest.c +soundtest_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS) diff --git a/tests/soundtest.c b/tests/soundtest.c new file mode 100644 index 0000000..18c36fa --- /dev/null +++ b/tests/soundtest.c @@ -0,0 +1,31 @@ +#include +#include + +void +glk_main(void) +{ + if(!glk_gestalt(gestalt_Sound, 0)) { + fprintf(stderr, "Sound not supported.\n"); + return; + } + if(!glk_gestalt(gestalt_SoundVolume, 0)) { + fprintf(stderr, "Sound volume not supported.\n"); + return; + } + + schanid_t sc = glk_schannel_create(0); + if(!sc) { + fprintf(stderr, "Could not create sound channel.\n"); + return; + } + + glk_schannel_set_volume(sc, 0x10000); + glk_schannel_set_volume(sc, 0x08000); + glk_schannel_set_volume(sc, 0x04000); + 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_destroy(sc); +}