improved the soundblaster code, but still doesn't work on the real
[dos_sbtest] / src / audio.c
index d783559..adb8e3e 100644 (file)
@@ -1,71 +1,78 @@
-#include <stdio.h>
-#include "audio.h"
-#include "au_sb.h"
-
-struct audrv {
-       void *(*get_buffer)(int *size);
-       void (*start)(int rate, int nchan);
-       void (*pause)(void);
-       void (*cont)(void);
-       void (*stop)(void);
-       void (*volume)(int vol);
-};
-
-static struct audrv drv;
-
-static audio_callback_func cbfunc;
-static void *cbcls;
-
-void audio_init(void)
-{
-       if(sb_detect()) {
-               drv.get_buffer = sb_buffer;
-               drv.start = sb_start;
-               drv.pause = sb_pause;
-               drv.cont = sb_continue;
-               drv.stop = sb_stop;
-               drv.volume = sb_volume;
-               return;
-       }
-
-       printf("No supported audio device detected\n");
-}
-
-void audio_set_callback(audio_callback_func func, void *cls)
-{
-       cbfunc = func;
-       cbcls = cls;
-}
-
-int audio_callback(void *buf, int sz)
-{
-       if(!cbfunc) {
-               return 0;
-       }
-       return cbfunc(buf, sz, cbcls);
-}
-
-void audio_play(int rate, int nchan)
-{
-       drv.start(rate, nchan);
-}
-
-void audio_pause(void)
-{
-       drv.pause();
-}
-
-void audio_resume(void)
-{
-       drv.cont();
-}
-
-void audio_stop(void)
-{
-       drv.stop();
-}
-
-void audio_volume(int vol)
-{
-       drv.volume(vol);
-}
+#include <stdio.h>\r
+#include "audio.h"\r
+#include "au_sb.h"\r
+\r
+struct audrv {\r
+       void *(*get_buffer)(int *size);\r
+       void (*start)(int rate, int nchan);\r
+       void (*pause)(void);\r
+       void (*cont)(void);\r
+       void (*stop)(void);\r
+       void (*volume)(int vol);\r
+       int (*isplaying)(void);\r
+};\r
+\r
+static struct audrv drv;\r
+\r
+static audio_callback_func cbfunc;\r
+static void *cbcls;\r
+\r
+void audio_init(void)\r
+{\r
+       if(sb_detect()) {\r
+               drv.get_buffer = sb_buffer;\r
+               drv.start = sb_start;\r
+               drv.pause = sb_pause;\r
+               drv.cont = sb_continue;\r
+               drv.stop = sb_stop;\r
+               drv.volume = sb_volume;\r
+               drv.isplaying = sb_isplaying;\r
+               return;\r
+       }\r
+\r
+       printf("No supported audio device detected\n");\r
+}\r
+\r
+void audio_set_callback(audio_callback_func func, void *cls)\r
+{\r
+       cbfunc = func;\r
+       cbcls = cls;\r
+}\r
+\r
+int audio_callback(void *buf, int sz)\r
+{\r
+       if(!cbfunc) {\r
+               return 0;\r
+       }\r
+       return cbfunc(buf, sz, cbcls);\r
+}\r
+\r
+void audio_play(int rate, int nchan)\r
+{\r
+       drv.start(rate, nchan);\r
+}\r
+\r
+void audio_pause(void)\r
+{\r
+       drv.pause();\r
+}\r
+\r
+void audio_resume(void)\r
+{\r
+       drv.cont();\r
+}\r
+\r
+void audio_stop(void)\r
+{\r
+       drv.stop();\r
+}\r
+\r
+void audio_volume(int vol)\r
+{\r
+       drv.volume(vol);\r
+}\r
+\r
+int audio_isplaying(void)\r
+{\r
+       return drv.isplaying();\r
+}\r