Sys_Error("SDL sound: invalid buffer length passed to Buffer_Callback (%d bytes)\n", len);
RequestedFrames = (unsigned int)len / factor;
-
+
// Transfert up to a chunk of samples from snd_renderbuffer to stream
MaxFrames = snd_renderbuffer->endframe - snd_renderbuffer->startframe;
if (MaxFrames > RequestedFrames)
PartialLength1 = (snd_renderbuffer->maxframes - StartOffset) * factor;
memcpy(stream, &snd_renderbuffer->ring[StartOffset * factor], PartialLength1);
-
+
PartialLength2 = FrameCount * factor - PartialLength1;
memcpy(&stream[PartialLength1], &snd_renderbuffer->ring[0], PartialLength2);
}
snd_renderbuffer->startframe += FrameCount;
- if (FrameCount < RequestedFrames)
+ if (FrameCount < RequestedFrames && developer.integer >= 1000 && vid_activewindow)
Con_DPrintf("SDL sound: %u sample frames missing\n", RequestedFrames - FrameCount);
sdlaudiotime += RequestedFrames;
wantspec.channels, wantspec.format, wantspec.freq, wantspec.samples);
if( SDL_OpenAudio( &wantspec, &obtainspec ) )
- {
+ {
Con_Printf( "Failed to open the audio device! (%s)\n", SDL_GetError() );
return false;
}
}
snd_renderbuffer = Snd_CreateRingBuffer(requested, 0, NULL);
+ if (snd_channellayout.integer == SND_CHANNELLAYOUT_AUTO)
+ {
+ int newlayout;
+
+#ifdef __linux__
+ newlayout = SND_CHANNELLAYOUT_ALSA;
+#else
+ newlayout = SND_CHANNELLAYOUT_STANDARD;
+#endif
+ Cvar_SetValueQuick (&snd_channellayout, newlayout);
+ }
sdlaudiotime = 0;
SDL_PauseAudio( false );
-
+
return true;
}