]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_bsd.c
this should fix some Solaris/NetBSD/OpenBSD compile problems, model_t still remaining
[xonotic/darkplaces.git] / snd_bsd.c
index e202342b798ba331575571cdbd82a355b09769fc..e32766f11dea6f2d94ff08990e8629d4ddd4e097 100644 (file)
--- a/snd_bsd.c
+++ b/snd_bsd.c
@@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 */
+#include "quakedef.h"
 
 #include <sys/param.h>
 #include <sys/audioio.h>
@@ -31,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #endif
 #include <unistd.h>
 
-#include "quakedef.h"
 #include "snd_main.h"
 
 
@@ -68,7 +68,7 @@ qboolean SndSys_Init (const snd_format_t* requested, snd_format_t* suggested)
        }
 
        AUDIO_INITINFO (&info);
-#ifdef AUMODE_PLAY     // NetBSD / OpenBSD 
+#ifdef AUMODE_PLAY     // NetBSD / OpenBSD
        info.mode = AUMODE_PLAY;
 #endif
        info.play.sample_rate = requested->speed;
@@ -91,8 +91,11 @@ qboolean SndSys_Init (const snd_format_t* requested, snd_format_t* suggested)
 #      endif
 #endif
 
-       if (ioctl (audio_fd, AUDIO_SETINFO, &info) == 0)
-               break;
+       if (ioctl (audio_fd, AUDIO_SETINFO, &info) != 0)
+       {
+               Con_Printf("Can't set up the sound device (%s)\n", snddev);
+               return false;
+       }
 
        // TODO: check the parameters with AUDIO_GETINFO
        // TODO: check AUDIO_ENCODINGFLAG_EMULATED with AUDIO_GETENC
@@ -137,7 +140,7 @@ void SndSys_Submit (void)
 {
        unsigned int startoffset, factor, limit, nbframes;
        int written;
-       
+
        if (audio_fd < 0 ||
                snd_renderbuffer->startframe == snd_renderbuffer->endframe)
                return;
@@ -165,7 +168,7 @@ void SndSys_Submit (void)
                        Con_Printf("SndSys_Submit: audio can't keep up! (%u < %u)\n", written, limit * factor);
                        return;
                }
-               
+
                nbframes -= limit;
                startoffset = 0;
        }
@@ -194,7 +197,7 @@ unsigned int SndSys_GetSoundTime (void)
        if (ioctl (audio_fd, AUDIO_GETINFO, &info) < 0)
        {
                Con_Print("Error: can't get audio info\n");
-               SNDDMA_Shutdown ();
+               SndSys_Shutdown ();
                return 0;
        }