fixed by preloading samples. the audio callback is being called from the
[dos_auplay] / src / audio.c
index 88b8400..51a3521 100644 (file)
@@ -17,7 +17,7 @@ static struct audrv drv;
 static audio_callback_func cbfunc;\r
 static void *cbcls;\r
 \r
-void audio_init(void)\r
+int audio_init(void)\r
 {\r
        if(sb_detect()) {\r
                drv.get_buffer = sb_buffer;\r
@@ -27,10 +27,11 @@ void audio_init(void)
                drv.stop = sb_stop;\r
                drv.volume = sb_volume;\r
                drv.isplaying = sb_isplaying;\r
-               return;\r
+               return 0;\r
        }\r
 \r
-       printf("No supported audio device detected\n");\r
+       fprintf(stderr, "No supported audio device detected\n");\r
+       return -1;\r
 }\r
 \r
 void audio_set_callback(audio_callback_func func, void *cls)\r
@@ -49,6 +50,7 @@ int audio_callback(void *buf, int sz)
 \r
 void audio_play(int rate, int bits, int nchan)\r
 {\r
+       printf("play %d samples/s, %d bits, %s\n", rate, bits, nchan == 1 ? "mono" : "stereo");\r
        drv.start(rate, bits, nchan);\r
 }\r
 \r