hedgewars/uSound.pas
changeset 2418 538a777f90c4
parent 2413 d921d13a8546
child 2443 fececcbc2189
equal deleted inserted replaced
2417:f7ed1ea25050 2418:538a777f90c4
    57 function ChangeVolume(voldelta: LongInt): LongInt;
    57 function ChangeVolume(voldelta: LongInt): LongInt;
    58 function AskForVoicepack(name: shortstring): PVoicepack;
    58 function AskForVoicepack(name: shortstring): PVoicepack;
    59 function soundFadeOut(snd: TSound; qt: LongInt; voicepack: PVoicepack): LongInt;
    59 function soundFadeOut(snd: TSound; qt: LongInt; voicepack: PVoicepack): LongInt;
    60 
    60 
    61 {*remember: LongInt = 32bit; integer = 16bit; byte = 8bit*}
    61 {*remember: LongInt = 32bit; integer = 16bit; byte = 8bit*}
    62 function openal_init		(hardware: LongInt; memsize: LongInt)	: boolean; cdecl; external OpenALBridge;
    62 function openal_init		(filename: PChar; hardware: boolean; memsize: LongInt)	: boolean; cdecl; external OpenALBridge;
    63 function openal_close							: boolean; cdecl; external OpenALBridge;
    63 function openal_close							: boolean; cdecl; external OpenALBridge;
    64 function openal_loadfile	(const filename: PChar)			: LongInt; cdecl; external OpenALBridge;
    64 function openal_loadfile	(const filename: PChar)			: LongInt; cdecl; external OpenALBridge;
    65 function openal_toggleloop	(index: LongInt)			: boolean; cdecl; external OpenALBridge;
    65 function openal_toggleloop	(index: LongInt)			: boolean; cdecl; external OpenALBridge;
    66 function openal_setvolume	(index: LongInt; percentage: byte)	: boolean; cdecl; external OpenALBridge;
    66 function openal_setvolume	(index: LongInt; percentage: byte)	: boolean; cdecl; external OpenALBridge;
    67 function openal_setglobalvolume	(percentage: byte)			: boolean; cdecl; external OpenALBridge;
    67 function openal_setglobalvolume	(percentage: byte)			: boolean; cdecl; external OpenALBridge;
   105 begin
   105 begin
   106 if not isSoundEnabled then exit;
   106 if not isSoundEnabled then exit;
   107 {*sound works in ipodtouch only if LAND_WIDTH  = 1024;   LAND_HEIGHT = 512; 
   107 {*sound works in ipodtouch only if LAND_WIDTH  = 1024;   LAND_HEIGHT = 512; 
   108 or if ogg are loaded in stream or if sound is loaded by demand*}
   108 or if ogg are loaded in stream or if sound is loaded by demand*}
   109 WriteToConsole('Init OpenAL sound...');
   109 WriteToConsole('Init OpenAL sound...');
   110 if isSoundHardware then isSoundEnabled:= openal_init(1, numSounds) else isSoundEnabled:= openal_init(0, numSounds);
   110 
       
   111 isSoundEnabled:= openal_init(str2pchar(ParamStr(0)), isSoundHardware, numSounds);
   111 if isSoundEnabled then WriteLnToConsole(msgOK)
   112 if isSoundEnabled then WriteLnToConsole(msgOK)
   112                   else WriteLnToConsole(msgFailed);
   113                   else WriteLnToConsole(msgFailed);
   113 
   114 
   114 Volume:=0;
   115 Volume:=0;
   115 ChangeVolume(cInitVolume);
   116 ChangeVolume(cInitVolume);