From: DeaDDooMER Date: Sun, 6 Oct 2019 09:58:15 +0000 (+0300) Subject: add stub sound driver X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=8b7a40b1a145f53e80098e0faf139c942d2509e5;p=d2df-sdl.git add stub sound driver --- diff --git a/src/engine/e_sound.pas b/src/engine/e_sound.pas index 75e1e57..790dc0a 100644 --- a/src/engine/e_sound.pas +++ b/src/engine/e_sound.pas @@ -15,12 +15,14 @@ {$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 new file mode 100644 index 0000000..7e3349f --- /dev/null +++ b/src/engine/e_sound_stub.inc @@ -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 . + *) +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 18f1f21..7934ed1 100644 --- a/src/game/Doom2DF.lpr +++ b/src/game/Doom2DF.lpr @@ -37,20 +37,24 @@ {$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