DEADSOFTWARE

put "{$MODE ...}" directive in each source file; removed trailing spaces, and convert...
[d2df-sdl.git] / src / engine / e_sound_sdl.inc
index ce644a70a77c70f10a23deaf6d654544beefd43a..4808dbd34eb65b600f41b54ee3dfa98c361035d5 100644 (file)
@@ -53,7 +53,7 @@ type
 const
   NO_SOUND_ID = DWORD(-1);
 
-function e_InitSoundSystem(): Boolean;
+function e_InitSoundSystem(NoOutput: Boolean = False): Boolean;
 
 function e_LoadSound(FileName: string; var ID: DWORD; isMusic: Boolean): Boolean;
 function e_LoadSoundMem(pData: Pointer; Length: Integer; var ID: DWORD; isMusic: Boolean): Boolean;
@@ -152,7 +152,7 @@ begin
   end;
 end;
 
-function e_InitSoundSystem(): Boolean;
+function e_InitSoundSystem(NoOutput: Boolean = False): Boolean;
 var
   res, i: Integer;
   rfreq: Integer;
@@ -164,6 +164,8 @@ begin
   Result := False;
   SoundInitialized := False;
 
+  if NoOutput then begin Result := true; Exit end;
+
   // wow, this is actually MIDI player!
   // we need module player
   res := Mix_Init(MIX_INIT_FLAC or MIX_INIT_MOD or MIX_INIT_MODPLUG or MIX_INIT_MP3 or MIX_INIT_OGG or MIX_INIT_FLUIDSYNTH);
@@ -175,7 +177,8 @@ begin
   if (res and MIX_INIT_OGG) <> 0 then e_WriteLog('SDL: OGG playback is active', MSG_NOTIFY);
   if (res and MIX_INIT_FLUIDSYNTH) <> 0 then e_WriteLog('SDL: FLUIDSYNTH playback is active', MSG_NOTIFY);
 
-  res := Mix_OpenAudio(44100, AUDIO_S16LSB, 2, 2048);
+  e_WriteLog(Format('SDL: initializing mixer at %d with buffer %d', [gsSDLSampleRate, gsSDLBufferSize]), MSG_NOTIFY);
+  res := Mix_OpenAudio(gsSDLSampleRate, AUDIO_S16LSB, 2, gsSDLBufferSize);
   if res = -1 then
   begin
     e_WriteLog('Error initializing SDL mixer:', MSG_FATALERROR);