X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=linux%2Fsndout_oss.c;h=6d4eded4241e94cbb0ff36ef799532cef656857d;hb=d07718a03be25075abef1888b836dfb77e1c83a0;hp=a8fbe3fa3258d30a7b755705ec8a7f5057a99d12;hpb=7ceadd9993ea84078e9d74d79215419e06496f90;p=libpicofe.git diff --git a/linux/sndout_oss.c b/linux/sndout_oss.c index a8fbe3f..6d4eded 100644 --- a/linux/sndout_oss.c +++ b/linux/sndout_oss.c @@ -21,6 +21,7 @@ #include "sndout_oss.h" int sndout_oss_frag_frames = 1; +int sndout_oss_can_restart = 1; static int sounddev = -1, mixerdev = -1; static int can_write_safe; @@ -41,15 +42,17 @@ int sndout_oss_init(void) void sndout_oss_stop(void) { -#ifdef __GP2X__ - /* restarting audio on GP2X causes trouble */ - return; -#endif + /* restarting audio on GP2X causes trouble, + * not restarting on Caanoo causes trouble */ + if (!sndout_oss_can_restart) + return; if (sounddev < 0) return; - ioctl(sounddev, SOUND_PCM_SYNC, 0); + // sync causes trouble on Caanoo.. + //ioctl(sounddev, SNDCTL_DSP_SYNC, 0); + close(sounddev); sounddev = -1; } @@ -175,7 +178,7 @@ int sndout_oss_can_write(int bytes) void sndout_oss_wait(void) { // FIXME? - ioctl(sounddev, SOUND_PCM_SYNC, 0); + ioctl(sounddev, SNDCTL_DSP_SYNC, 0); } void sndout_oss_setvol(int l, int r) @@ -189,7 +192,10 @@ void sndout_oss_setvol(int l, int r) void sndout_oss_exit(void) { - if (sounddev >= 0) close(sounddev); sounddev = -1; - if (mixerdev >= 0) close(mixerdev); mixerdev = -1; + if (sounddev >= 0) + close(sounddev); + if (mixerdev >= 0) + close(mixerdev); + sounddev = mixerdev = -1; }