Removed some debug printings, and made some others requiring developer >= 100. Reset...
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 10 Jun 2006 14:00:25 +0000 (14:00 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 10 Jun 2006 14:00:25 +0000 (14:00 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6456 d7cf8633-e32d-0410-b094-e92efae38249

snd_alsa.c
snd_main.c
snd_oss.c
snd_sdl.c

index c9065bd..e4a9ffe 100644 (file)
@@ -265,8 +265,6 @@ static qboolean SndSys_Recover (int err_num)
 
                return false;
        }
-       
-       Con_DPrint ("SndSys_Recover: recovered successfully\n");
 
        return true;
 }
@@ -284,15 +282,16 @@ static snd_pcm_sframes_t SndSys_Write (const unsigned char* buffer, unsigned int
        written = snd_pcm_writei (pcm_handle, buffer, nbframes);
        if (written < 0)
        {
-               Con_Printf ("SndSys_Write: audio write returned %ld (%s)!\n",
-                                       written, snd_strerror (written));
+               if (developer.integer >= 100)
+                       Con_Printf ("SndSys_Write: audio write returned %ld (%s)!\n",
+                                                written, snd_strerror (written));
 
                if (SndSys_Recover (written))
                {
                        written = snd_pcm_writei (pcm_handle, buffer, nbframes);
                        if (written < 0)
-                               Con_Printf ("SndSys_Write: audio write failed again (error %ld: %s)!\n",
-                                                       written, snd_strerror (written));
+                               Con_DPrintf ("SndSys_Write: audio write failed again (error %ld: %s)!\n",
+                                                        written, snd_strerror (written));
                }
        }
        
@@ -321,32 +320,26 @@ void SndSys_Submit (void)
        factor = snd_renderbuffer->format.width * snd_renderbuffer->format.channels;
        limit = snd_renderbuffer->maxframes - startoffset;
        nbframes = snd_renderbuffer->endframe - snd_renderbuffer->startframe;
-//Con_DPrintf(">> SndSys_Submit: startframe=%u, endframe=%u (%u frames), maxframes=%u, startoffset=%u\n",
-//                     snd_renderbuffer->startframe, snd_renderbuffer->endframe,
-//                     nbframes, snd_renderbuffer->maxframes, startoffset);
 
        if (nbframes > limit)
        {
-//Con_DPrintf(">> SndSys_Submit: 2 phases-submit\n");
                written = SndSys_Write (&snd_renderbuffer->ring[startoffset * factor], limit);
                if (written < 0)
                        return;
                snd_renderbuffer->startframe += written;
                expected_delay += written;
 
-//Con_DPrintf(">> SndSys_Submit: %ld/%ld frames written\n", written, limit);
                if ((snd_pcm_uframes_t)written != limit)
                        return;
                
                nbframes -= limit;
                startoffset = 0;
        }
-//else Con_DPrintf(">> SndSys_Submit: 1 phase-submit\n");
 
        written = SndSys_Write (&snd_renderbuffer->ring[startoffset * factor], nbframes);
        if (written < 0)
                return;
-//Con_DPrintf(">> SndSys_Submit: %ld/%ld frames written\n", written, nbframes);
+
        snd_renderbuffer->startframe += written;
        expected_delay += written;
 }
@@ -370,8 +363,9 @@ unsigned int SndSys_GetSoundTime (void)
        err = snd_pcm_delay (pcm_handle, &delay);
        if (err != 0)
        {
-               Con_DPrintf ("SndSys_GetSoundTime: can't get playback delay (%s)\n",
-                                        snd_strerror (err));
+               if (developer.integer >= 100)
+                       Con_DPrintf ("SndSys_GetSoundTime: can't get playback delay (%s)\n",
+                                                snd_strerror (err));
 
                if (! SndSys_Recover (err))
                        return 0;
@@ -385,12 +379,10 @@ unsigned int SndSys_GetSoundTime (void)
                }
        }
 
-//Con_DPrintf(">> SndSys_GetSoundTime: expected_delay=%ld, delay=%ld\n",
-//                     expected_delay, delay);
        if (expected_delay < delay)
        {
-               Con_Printf ("SndSys_GetSoundTime: expected_delay(%ld) < delay(%ld)\n",
-                                       expected_delay, delay);
+               Con_DPrintf ("SndSys_GetSoundTime: expected_delay(%ld) < delay(%ld)\n",
+                                        expected_delay, delay);
                timediff = 0;
        }
        else
index c9c79a3..86cb8e7 100644 (file)
@@ -1100,12 +1100,9 @@ int S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float f
 
        if (snd_renderbuffer == NULL || sfx == NULL || nosound.integer)
                return -1;
-       if (!sfx->fetcher)
-       {
-               // this is very annoying when it was precached but the file could not be loaded
-               //Con_DPrintf ("S_StartSound: \"%s\" hasn't been precached\n", sfx->name);
+
+       if (sfx->fetcher == NULL)
                return -1;
-       }
 
        if (entnum && entnum >= cl.max_entities)
                CL_ExpandEntities(entnum);
index ca17c05..2693e51 100644 (file)
--- a/snd_oss.c
+++ b/snd_oss.c
@@ -89,6 +89,8 @@ qboolean SndSys_Init (const snd_format_t* requested, snd_format_t* suggested)
        }
        else
                Con_Print("SndSys_Init: fcntl(F_GETFL) failed!\n");
+       
+       ioctl(audio_fd, SNDCTL_DSP_RESET, NULL);
 
        // Set the fragment size (up to "NB_FRAGMENTS" fragments of "fragmentsize" bytes)
        fragmentsize = requested->speed * requested->channels * requested->width / 5;
@@ -186,7 +188,7 @@ void SndSys_Shutdown (void)
        // Stop the sound and close the device
        if (audio_fd >= 0)
        {
-               ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
+               ioctl(audio_fd, SNDCTL_DSP_RESET, NULL);
                close(audio_fd);
                audio_fd = -1;
        }
index 90b5312..acd2ba3 100644 (file)
--- a/snd_sdl.c
+++ b/snd_sdl.c
@@ -62,7 +62,7 @@ static void Buffer_Callback (void *userdata, Uint8 *stream, int len)
 
        snd_renderbuffer->startframe += FrameCount;
 
-       if (FrameCount < RequestedFrames)
+       if (FrameCount < RequestedFrames && developer.integer >= 100)
                Con_DPrintf("SDL sound: %u sample frames missing\n", RequestedFrames - FrameCount);
 
        sdlaudiotime += RequestedFrames;