summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0e101bd)
raw | patch | inline | side by side (parent: 0e101bd)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 6 Oct 2019 09:58:15 +0000 (12:58 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 13 Oct 2019 14:19:20 +0000 (17:19 +0300) |
src/engine/e_sound.pas | patch | blob | history | |
src/engine/e_sound_stub.inc | [new file with mode: 0644] | patch | blob |
src/game/Doom2DF.lpr | patch | blob | history |
diff --git a/src/engine/e_sound.pas b/src/engine/e_sound.pas
index 75e1e57b3470395f03d5d55781431f4ce825232c..790dc0a65d41a6cadbacadce2a7055f9b2648602 100644 (file)
--- a/src/engine/e_sound.pas
+++ b/src/engine/e_sound.pas
{$INCLUDE ../shared/a_modes.inc}
unit e_sound;
-{$IFDEF USE_SDLMIXER}
+{$IF DEFINED(USE_SDLMIXER)}
{$I e_sound_sdl.inc}
+{$ELSEIF DEFINED(USE_OPENAL)}
+ {$I e_sound_al.inc}
+{$ELSEIF DEFINED(USE_FMOD)}
+ {$I e_sound_fmod.inc}
+{$ELSEIF DEFINED(USE_SOUNDSTUB)}
+ {$I e_sound_stub.inc}
{$ELSE}
- {$IFDEF USE_OPENAL}
- {$I e_sound_al.inc}
- {$ELSE}
- {$I e_sound_fmod.inc}
- {$ENDIF}
+ {$ERROR e_sound driver not implemented?}
{$ENDIF}
diff --git a/src/engine/e_sound_stub.inc b/src/engine/e_sound_stub.inc
--- /dev/null
@@ -0,0 +1,226 @@
+(* 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, 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *)
+interface
+
+ uses
+ {$IFDEF USE_MEMPOOL}mempool,{$ENDIF}
+ SysUtils;
+
+ type
+ TSoundRec = record
+ nRefs: Integer;
+ end;
+
+ TBasicSound = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF}
+ private
+ protected
+ FMusic: Boolean;
+ FPosition: DWORD;
+ function RawPlay(Pan: Single; Volume: Single; aPos: DWORD): Boolean;
+ public
+ constructor Create;
+ destructor Destroy; override;
+ procedure SetID (ID: DWORD);
+ procedure FreeSound;
+ function IsPlaying (): Boolean;
+ procedure Stop;
+ function IsPaused (): Boolean;
+ procedure Pause (Enable: Boolean);
+ function GetVolume (): Single;
+ procedure SetVolume (Volume: Single);
+ function GetPan (): Single;
+ procedure SetPan (Pan: Single);
+ function IsMuted (): Boolean;
+ procedure Mute (Enable: Boolean);
+ function GetPosition (): DWORD;
+ procedure SetPosition (aPos: DWORD);
+ procedure SetPriority (priority: Integer);
+ end;
+
+ const
+ NO_SOUND_ID = DWORD(-1);
+
+ function e_InitSoundSystem (NoOutput: Boolean = False): 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;
+ function e_PlaySoundVolume (ID: DWORD; Volume: Single): Integer;
+ function e_PlaySoundPanVolume (ID: DWORD; Pan, Volume: Single): Integer;
+
+ procedure e_ModifyChannelsVolumes (SoundMod: Single; setMode: Boolean);
+ procedure e_MuteChannels (Enable: Boolean);
+ procedure e_StopChannels;
+
+ procedure e_DeleteSound (ID: DWORD);
+ procedure e_RemoveAllSounds;
+ procedure e_ReleaseSoundSystem;
+ procedure e_SoundUpdate;
+
+ var
+ e_SoundsArray: array of TSoundRec = nil;
+
+implementation
+
+ function e_InitSoundSystem(NoOutput: Boolean = False): Boolean;
+ begin
+ result := false
+ end;
+
+ function e_LoadSound(FileName: String; var ID: DWORD; isMusic: Boolean; ForceNoLoop: Boolean = False): Boolean;
+ begin
+ ID := NO_SOUND_ID;
+ result := false
+ end;
+
+ function e_LoadSoundMem(pData: Pointer; Length: Integer; var ID: DWORD; isMusic: Boolean; ForceNoLoop: Boolean = False): Boolean;
+ begin
+ ID := NO_SOUND_ID;
+ result := false
+ end;
+
+ function e_PlaySound (ID: DWORD): Integer;
+ begin
+ Result := -1
+ end;
+
+ function e_PlaySoundPan(ID: DWORD; Pan: Single): Integer;
+ begin
+ result := -1
+ end;
+
+ function e_PlaySoundVolume(ID: DWORD; Volume: Single): Integer;
+ begin
+ result := -1
+ end;
+
+ function e_PlaySoundPanVolume(ID: DWORD; Pan, Volume: Single): Integer;
+ begin
+ result := -1
+ end;
+
+ procedure e_DeleteSound(ID: DWORD);
+ begin
+ end;
+
+ procedure e_ModifyChannelsVolumes(SoundMod: Single; setMode: Boolean);
+ begin
+ end;
+
+ procedure e_MuteChannels(Enable: Boolean);
+ begin
+ end;
+
+ procedure e_StopChannels();
+ begin
+ end;
+
+ procedure e_RemoveAllSounds();
+ begin
+ end;
+
+ procedure e_ReleaseSoundSystem();
+ begin
+ end;
+
+ procedure e_SoundUpdate();
+ begin
+ end;
+
+ (* --------- TBasicSound --------- *)
+
+ constructor TBasicSound.Create;
+ begin
+ end;
+
+ destructor TBasicSound.Destroy;
+ begin
+ inherited;
+ end;
+
+ procedure TBasicSound.FreeSound;
+ begin
+ end;
+
+ function TBasicSound.RawPlay (Pan: Single; Volume: Single; aPos: DWORD): Boolean;
+ begin
+ result := false
+ end;
+
+ procedure TBasicSound.SetID (ID: DWORD);
+ begin
+ end;
+
+ function TBasicSound.IsPlaying (): Boolean;
+ begin
+ result := false
+ end;
+
+ procedure TBasicSound.Stop;
+ begin
+ end;
+
+ function TBasicSound.IsPaused (): Boolean;
+ begin
+ result := false
+ end;
+
+ procedure TBasicSound.Pause (Enable: Boolean);
+ begin
+ end;
+
+ function TBasicSound.GetVolume (): Single;
+ begin
+ result := 0.0
+ end;
+
+ procedure TBasicSound.SetVolume (Volume: Single);
+ begin
+ end;
+
+ function TBasicSound.GetPan (): Single;
+ begin
+ result := 1.0
+ end;
+
+ procedure TBasicSound.SetPan (Pan: Single);
+ begin
+ end;
+
+ function TBasicSound.IsMuted (): Boolean;
+ begin
+ result := false
+ end;
+
+ procedure TBasicSound.Mute (Enable: Boolean);
+ begin
+ end;
+
+ function TBasicSound.GetPosition (): DWORD;
+ begin
+ result := 0
+ end;
+
+ procedure TBasicSound.SetPosition (aPos: DWORD);
+ begin
+ end;
+
+ procedure TBasicSound.SetPriority(priority: Integer);
+ begin
+ end;
+
+end.
diff --git a/src/game/Doom2DF.lpr b/src/game/Doom2DF.lpr
index 18f1f21ac854c050c2d928da10d4ebf4e874f437..7934ed1d97d51ae066cb963c295423364cd71a75 100644 (file)
--- a/src/game/Doom2DF.lpr
+++ b/src/game/Doom2DF.lpr
{$ERROR System driver not selected. Use -dUSE_SYSSTUB or -dUSE_SDL or -dUSE_SDL2}
{$ENDIF}
-{$IF DEFINED(USE_SDLMIXER)}
- {$IF DEFINED(USE_FMOD) OR DEFINED(USE_OPENAL)}
+{$IF DEFINED(USE_SOUNDSTUB)}
+ {$IF DEFINED(USE_SDLMIXER) OR DEFINED(USE_FMOD) OR DEFINED(USE_OPENAL)}
+ {$ERROR Only one sound driver must be selected!}
+ {$ENDIF}
+{$ELSEIF DEFINED(USE_SDLMIXER)}
+ {$IF DEFINED(USE_SOUNDSTUB) OR DEFINED(USE_FMOD) OR DEFINED(USE_OPENAL)}
{$ERROR Only one sound driver must be selected!}
{$ENDIF}
{$ELSEIF DEFINED(USE_FMOD)}
- {$IF DEFINED(USE_SDLMIXER) OR DEFINED(USE_OPENAL)}
+ {$IF DEFINED(USE_SOUNDSTUB) OR DEFINED(USE_SDLMIXER) OR DEFINED(USE_OPENAL)}
{$ERROR Only one sound driver must be selected!}
{$ENDIF}
{$ELSEIF DEFINED(USE_OPENAL)}
- {$IF DEFINED(USE_SDLMIXER) OR DEFINED(USE_FMOD)}
+ {$IF DEFINED(USE_SOUNDSTUB) OR DEFINED(USE_SDLMIXER) OR DEFINED(USE_FMOD)}
{$ERROR Only one sound driver must be selected!}
{$ENDIF}
{$ELSE}
- {$ERROR Sound driver not selected. Use -dUSE_SDLMIXER or -dUSE_FMOD or -dUSE_OPENAL}
+ {$ERROR Sound driver not selected. Use -dUSE_SOUNDSTUB or -dUSE_SDLMIXER or -dUSE_FMOD or -dUSE_OPENAL}
{$ENDIF}
uses