equal
deleted
inserted
replaced
337 procedure InitSound; |
337 procedure InitSound; |
338 const channels: LongInt = 2; |
338 const channels: LongInt = 2; |
339 var success: boolean; |
339 var success: boolean; |
340 begin |
340 begin |
341 if not (isSoundEnabled or isMusicEnabled) then |
341 if not (isSoundEnabled or isMusicEnabled) then |
342 exit; |
342 begin |
|
343 isAudioMuted:= true; |
|
344 cInitVolume:= 0; |
|
345 exit; |
|
346 end; |
343 WriteToConsole('Init sound...'); |
347 WriteToConsole('Init sound...'); |
344 success:= SDL_InitSubSystem(SDL_INIT_AUDIO) = 0; |
348 success:= SDL_InitSubSystem(SDL_INIT_AUDIO) = 0; |
345 |
349 |
346 if success then |
350 if success then |
347 begin |
351 begin |
355 else |
359 else |
356 begin |
360 begin |
357 WriteLnToConsole(msgFailed); |
361 WriteLnToConsole(msgFailed); |
358 isSoundEnabled:= false; |
362 isSoundEnabled:= false; |
359 isMusicEnabled:= false; |
363 isMusicEnabled:= false; |
|
364 isAudioMuted:= true; |
|
365 cInitVolume:= 0; |
360 end; |
366 end; |
361 |
367 |
362 WriteToConsole('Init SDL_mixer... '); |
368 WriteToConsole('Init SDL_mixer... '); |
363 if SDLCheck(Mix_Init(MIX_INIT_OGG) <> 0, 'Mix_Init', true) then exit; |
369 if SDLCheck(Mix_Init(MIX_INIT_OGG) <> 0, 'Mix_Init', true) then exit; |
364 WriteLnToConsole(msgOK); |
370 WriteLnToConsole(msgOK); |
|
371 |
|
372 // from uVariables to be used by other modules |
|
373 cIsSoundEnabled:= true; |
365 |
374 |
366 Mix_AllocateChannels(Succ(chanTPU)); |
375 Mix_AllocateChannels(Succ(chanTPU)); |
367 previousVolume:= cInitVolume; |
376 previousVolume:= cInitVolume; |
368 ChangeVolume(cInitVolume); |
377 ChangeVolume(cInitVolume); |
369 end; |
378 end; |