DEADSOFTWARE

sdlmixer: added hidden config options to setup sampling rate and buffer size
[d2df-sdl.git] / src / game / g_options.pas
index fab30284a197d776eb4908364ff89ea9e618631c..3f134305da197592e652a1958cda9e74fd2a4b6d 100644 (file)
@@ -52,6 +52,7 @@ var
   gFullscreen: Boolean        = False;
   gWinMaximized: Boolean      = False;
   gVSync: Boolean             = False;
+  glLegacyNPOT: Boolean       = False;
   gTextureFilter: Boolean     = True;
   gNoSound: Boolean           = False;
   gSoundLevel: Byte           = 75;
@@ -91,6 +92,8 @@ var
   gnWeaponStay: Boolean       = False;
   gnMonsters: Boolean         = False;
   gnBotsVS: String            = 'Everybody';
+  gsSDLSampleRate: Integer    = 44100;
+  gsSDLBufferSize: Integer    = 2048;
 
 implementation
 
@@ -207,7 +210,7 @@ begin
     gBPP := 32;
     gVSync := False;
     gTextureFilter := True;
-    fUseMipmaps := False;
+    glLegacyNPOT := False;
 
     Exit;
   end;
@@ -232,7 +235,7 @@ begin
   gFreq := config.ReadInt('Video', 'Freq', 0);
   gVSync := config.ReadBool('Video', 'VSync', True);
   gTextureFilter := config.ReadBool('Video', 'TextureFilter', True);
-  fUseMipmaps := config.ReadBool('Video', 'LegacyCompatible', False);
+  glLegacyNPOT := config.ReadBool('Video', 'LegacyCompatible', False);
 
   gNoSound := config.ReadBool('Sound', 'NoSound', False);
   gSoundLevel := Min(config.ReadInt('Sound', 'SoundLevel', 75), 255);
@@ -241,6 +244,8 @@ begin
   gMuteWhenInactive := config.ReadBool('Sound', 'MuteInactive', False);
   gAnnouncer := Min(Max(config.ReadInt('Sound', 'Announcer', ANNOUNCE_MEPLUS), ANNOUNCE_NONE), ANNOUNCE_ALL);
   gSoundEffectsDF := config.ReadBool('Sound', 'SoundEffectsDF', True);
+  gsSDLSampleRate := Min(Max(config.ReadInt('Sound', 'SDLSampleRate', 44100), 11025), 96000);
+  gsSDLBufferSize := Min(Max(config.ReadInt('Sound', 'SDLBufferSize', 2048), 64), 16384);
 
   with gGameControls.GameControls do
   begin
@@ -441,7 +446,7 @@ begin
   config.WriteInt('Video', 'BPP', gBPP);
   config.WriteBool('Video', 'VSync', gVSync);
   config.WriteBool('Video', 'TextureFilter', gTextureFilter);
-  config.WriteBool('Video', 'LegacyCompatible', fUseMipmaps);
+  config.WriteBool('Video', 'LegacyCompatible', glLegacyNPOT);
 
   config.WriteBool('Sound', 'NoSound', gNoSound);
   config.WriteInt('Sound', 'SoundLevel', gSoundLevel);
@@ -450,6 +455,8 @@ begin
   config.WriteBool('Sound', 'MuteInactive', gMuteWhenInactive);
   config.WriteInt('Sound', 'Announcer', gAnnouncer);
   config.WriteBool('Sound', 'SoundEffectsDF', gSoundEffectsDF);
+  config.WriteInt('Sound', 'SDLSampleRate', gsSDLSampleRate);
+  config.WriteInt('Sound', 'SDLBufferSize', gsSDLBufferSize);
 
   with config, gGameControls.GameControls do
   begin