# HG changeset patch # User unc0rr # Date 1125868759 0 # Node ID b64d67d222b9e3e902fd12c69f823ff544c6654b # Parent edf56dca15873f7a4b2c70a2764c3e023f562e15 Fix some issues with sound diff -r edf56dca1587 -r b64d67d222b9 hedgewars/SDLh.pas --- a/hedgewars/SDLh.pas Sat Sep 03 16:01:28 2005 +0000 +++ b/hedgewars/SDLh.pas Sun Sep 04 21:19:19 2005 +0000 @@ -75,6 +75,8 @@ SDL_QUITEV = 12; SDL_INIT_VIDEO = $00000020; + SDL_INIT_AUDIO = $00000010; + type PSDL_Rect = ^TSDL_Rect; TSDL_Rect = record x, y: SmallInt; @@ -305,6 +307,7 @@ function Mix_VolumeMusic(volume: integer): integer; cdecl; external SDL_MixerLibName; +function Mix_AllocateChannels(numchans: integer): integer; cdecl; external SDL_MixerLibName; procedure Mix_FreeChunk(chunk: PMixChunk); cdecl; external SDL_MixerLibName; procedure Mix_FreeMusic(music: PMixMusic); cdecl; external SDL_MixerLibName; diff -r edf56dca1587 -r b64d67d222b9 hedgewars/uSound.pas --- a/hedgewars/uSound.pas Sat Sep 03 16:01:28 2005 +0000 +++ b/hedgewars/uSound.pas Sun Sep 04 21:19:19 2005 +0000 @@ -51,9 +51,12 @@ begin if not isSoundEnabled then exit; WriteToConsole('Init sound...'); -isSoundEnabled:= Mix_OpenAudio(22050, $8010, 2, 512) = 0; +isSoundEnabled:= SDL_Init(SDL_INIT_AUDIO) >= 0; +if isSoundEnabled then + isSoundEnabled:= Mix_OpenAudio(22050, $8010, 2, 512) = 0; if isSoundEnabled then WriteLnToConsole(msgOK) else WriteLnToConsole(msgFailed); +Mix_AllocateChannels(Succ(ord(High(TSound)))); Mix_VolumeMusic(48) end;