changeset 31:502d54fd46fa

Remove useless pwp_sdlaudio_close(), move fragment size calculation after SDL_OpenAudio() call as it may possibly modify the frequency. Show acquired audio parameters to user.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 24 May 2010 00:21:39 +0300
parents 72d1c04c788b
children 7deee201073e
files pwplib/snd-sdl.c
diffstat 1 files changed, 4 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/pwplib/snd-sdl.c	Mon May 24 00:20:21 2010 +0300
+++ b/pwplib/snd-sdl.c	Mon May 24 00:21:39 2010 +0300
@@ -53,11 +53,6 @@
     }
 }
 
-static void pwp_sdlaudio_close(void)
-{
-    SDL_CloseAudio();
-}
-
 int pwp_sdlaudio_init()
 {
     SDL_AudioSpec fmt;
@@ -69,7 +64,6 @@
     fmt.channels = 1;
     fmt.samples = 2048;
     fmt.callback = pwp_sdlaudio_fill;
-    pwp_sdlaudio_frag = fmt.freq / TIMERHZ;
 
     if (SDL_OpenAudio(&fmt, NULL) < 0)
     {
@@ -77,14 +71,15 @@
         return 0;
     }
 
-    pwpwrite("* SDL sound\n");
+    pwp_sdlaudio_frag = fmt.freq / TIMERHZ;
+
+    pwpwrite("* SDL sound (freq=%d, fmt=%d, chn=%d, buf=%d, frag=%d)\n",
+        fmt.freq, fmt.format, fmt.channels, fmt.samples, pwp_sdlaudio_frag);
 
     pwplib.sound = gb_sound;
     pwplib.loopflush = pwp_sdlaudio_start;
     gb_init(fmt.freq);
 
-//    pwplib_regdestr(pwp_sdlaudio_close);
-
     return 1;
 }
 #endif