index bb12c810cc55dd61addc602e374148f08e742cda..8f4486481947f1cb956db2528e7e1b991f9dac00 100644 (file)
-(* Copyright (C) DooM 2D:Forever Developers
+(* Copyright (C) Doom 2D: Forever Developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, version 3 of the License ONLY.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
fmod,
fmodtypes,
fmoderrors,
- mempool,
+ {$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
e_log,
SysUtils;
nRefs: Integer;
end;
- TBasicSound = class(TPoolObject)
+ TBasicSound = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF}
private
FChannel: FMOD_CHANNEL;
function e_InitSoundSystem(NoOutput: Boolean = False): Boolean;
-function e_LoadSound(FileName: string; var ID: DWORD; bLoop: Boolean): Boolean;
-function e_LoadSoundMem(pData: Pointer; Length: Integer; var ID: DWORD; bLoop: Boolean): Boolean;
+function e_LoadSound(FileName: string; var ID: DWORD; isMusic: Boolean; ForceNoLoop: Boolean = False): Boolean;
+function e_LoadSoundMem(pData: Pointer; Length: Integer; var ID: DWORD; isMusic: Boolean; ForceNoLoop: Boolean = False): Boolean;
function e_PlaySound(ID: DWORD): Integer;
function e_PlaySoundPan(ID: DWORD; Pan: Single): Integer;
end;
end;
-function e_LoadSound(FileName: String; var ID: DWORD; bLoop: Boolean): Boolean;
+function e_LoadSound(FileName: String; var ID: DWORD; isMusic: Boolean; ForceNoLoop: Boolean = False): Boolean;
var
find_id: DWORD;
res: FMOD_RESULT;
find_id := FindESound();
- if bLoop then
+ if isMusic and not ForceNoLoop then
bt := FMOD_LOOP_NORMAL
else
bt := FMOD_LOOP_OFF;
- if not bLoop then
+ if not isMusic then
res := FMOD_System_CreateSound(F_System, PAnsiChar(FileName),
bt + FMOD_2D + FMOD_HARDWARE,
nil, e_SoundsArray[find_id].Sound)
end;
e_SoundsArray[find_id].Data := nil;
- e_SoundsArray[find_id].isMusic := bLoop;
+ e_SoundsArray[find_id].isMusic := isMusic;
e_SoundsArray[find_id].nRefs := 0;
ID := find_id;
Result := True;
end;
-function e_LoadSoundMem(pData: Pointer; Length: Integer; var ID: DWORD; bLoop: Boolean): Boolean;
+function e_LoadSoundMem(pData: Pointer; Length: Integer; var ID: DWORD; isMusic: Boolean; ForceNoLoop: Boolean = False): Boolean;
var
find_id: DWORD;
res: FMOD_RESULT;
soundExInfo.cbsize := sz;
soundExInfo.length := Length;
- if bLoop then
+ if isMusic and not ForceNoLoop then
bt := FMOD_LOOP_NORMAL
else
bt := FMOD_LOOP_OFF;
- if not bLoop then
+ if not isMusic then
res := FMOD_System_CreateSound(F_System, pData,
bt + FMOD_2D + FMOD_HARDWARE + FMOD_OPENMEMORY,
@soundExInfo, e_SoundsArray[find_id].Sound)
end;
e_SoundsArray[find_id].Data := pData;
- e_SoundsArray[find_id].isMusic := bLoop;
+ e_SoundsArray[find_id].isMusic := isMusic;
e_SoundsArray[find_id].nRefs := 0;
ID := find_id;