mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-20 18:42:26 +00:00
- ported Exhumed sound to OpenAL.
The regular sounds are not a big deal, but this game contains two special effects that were problematic to port. We'll have to wait and see if they work as intended - the original panning effect is not 3D compatible so I had to redo it.
This commit is contained in:
parent
e180d9afd3
commit
e3084cd1b1
15 changed files with 539 additions and 616 deletions
|
@ -63,7 +63,7 @@ int sfx_empty = -1;
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void SoundEngine::Init(TArray<uint8_t> &curve)
|
||||
void SoundEngine::Init(TArray<uint8_t> &curve, int factor)
|
||||
{
|
||||
// Free all channels for use.
|
||||
while (Channels != NULL)
|
||||
|
@ -71,6 +71,7 @@ void SoundEngine::Init(TArray<uint8_t> &curve)
|
|||
ReturnChannel(Channels);
|
||||
}
|
||||
S_SoundCurve = std::move(curve);
|
||||
SndCurveFactor = (uint8_t)factor;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1330,7 +1331,7 @@ float SoundEngine::GetRolloff(const FRolloffInfo* rolloff, float distance)
|
|||
|
||||
if (rolloff->RolloffType == ROLLOFF_Custom && S_SoundCurve.Size() > 0)
|
||||
{
|
||||
return S_SoundCurve[int(S_SoundCurve.Size() * (1.f - volume))] / 127.f;
|
||||
return S_SoundCurve[int(S_SoundCurve.Size() * (1.f - volume))] / (float)SndCurveFactor;
|
||||
}
|
||||
return (powf(10.f, volume) - 1.f) / 9.f;
|
||||
}
|
||||
|
|
|
@ -217,6 +217,8 @@ enum // This cannot be remain as this, but for now it has to suffice.
|
|||
SOURCE_Ambient, // Sound is coming from a blood ambient definition.
|
||||
SOURCE_Unattached, // Sound is not attached to any particular emitter.
|
||||
SOURCE_Player, // SW player sound (player in SW maintains its own position separately from the sprite so needs to be special.)
|
||||
SOURCE_Swirly, // Special stuff for Exhumed. (local sound with custom panning)
|
||||
SOURCE_EXBoss, // Another special case for Exhumed.
|
||||
};
|
||||
|
||||
|
||||
|
@ -234,6 +236,7 @@ class SoundEngine
|
|||
{
|
||||
protected:
|
||||
bool SoundPaused = false; // whether sound is paused
|
||||
uint8_t SndCurveFactor = 127;
|
||||
int RestartEvictionsAt = 0; // do not restart evicted channels before this time
|
||||
SoundListener listener{};
|
||||
|
||||
|
@ -281,7 +284,7 @@ public:
|
|||
// Sets channels, SFX and music volume,
|
||||
// allocates channel buffer, sets S_sfx lookup.
|
||||
//
|
||||
void Init(TArray<uint8_t> &sndcurve);
|
||||
void Init(TArray<uint8_t> &sndcurve, int factor = 127);
|
||||
void InitData();
|
||||
void Clear();
|
||||
void Shutdown();
|
||||
|
|
|
@ -7,15 +7,13 @@ endif()
|
|||
include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/../../build/include" )
|
||||
|
||||
if (WIN32)
|
||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../../platform/windows/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../platform/windows/include/vpx" "${CMAKE_CURRENT_SOURCE_DIR}/../../platform/windows/include/sdl2" )
|
||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/../../platform/windows/include" "${CMAKE_CURRENT_SOURCE_DIR}/../../platform/windows/include/vpx" "${CMAKE_CURRENT_SOURCE_DIR}/../../platform/windows/include/sdl2" )
|
||||
else ()
|
||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GDTOA_INCLUDE_DIR}")
|
||||
include_directories( "${ZLIB_INCLUDE_DIR}" "${ZMUSIC_INCLUDE_DIR}" "${BZIP2_INCLUDE_DIR}" "${LZMA_INCLUDE_DIR}" "${JPEG_INCLUDE_DIR}" "${GDTOA_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../build/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../mact/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../audiolib/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../libsmackerdec/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../common
|
||||
|
@ -25,8 +23,8 @@ include_directories(
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/../common/fonts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../common/2d
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../common/music
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../platform
|
||||
)
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../common/input
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../platform )
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "compat.h"
|
||||
#include "baselayer.h"
|
||||
#include "cd.h"
|
||||
#include "fx_man.h"
|
||||
#include "sound.h"
|
||||
#include "exhumed.h"
|
||||
#include <stdio.h>
|
||||
|
@ -41,13 +40,6 @@ Currently playing music must keep playing on return to map screen or exit from t
|
|||
|
||||
*/
|
||||
|
||||
void setCDaudiovolume(int val)
|
||||
{
|
||||
if (trackhandle > 0) {
|
||||
FX_SetPan(trackhandle, val, val, val);
|
||||
}
|
||||
}
|
||||
|
||||
bool playCDtrack(int nTrack, bool bLoop)
|
||||
{
|
||||
if (nTrack < 2) {
|
||||
|
@ -93,4 +85,8 @@ void StopCD()
|
|||
Mus_Stop();
|
||||
}
|
||||
|
||||
void FadeSong()
|
||||
{
|
||||
}
|
||||
|
||||
END_PS_NS
|
||||
|
|
|
@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#define __cd_h__
|
||||
|
||||
BEGIN_PS_NS
|
||||
void setCDaudiovolume(int val);
|
||||
bool playCDtrack(int nTrack, bool bLoop);
|
||||
void StartfadeCDaudio();
|
||||
int StepFadeCDaudio();
|
||||
|
|
|
@ -19,11 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "ns.h"
|
||||
#include "compat.h"
|
||||
#include "renderlayer.h"
|
||||
#include "_control.h"
|
||||
#include "build.h"
|
||||
#include "cache1d.h"
|
||||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
#include "exhumed.h"
|
||||
#include "typedefs.h"
|
||||
#include "view.h"
|
||||
|
|
|
@ -21,8 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "renderlayer.h"
|
||||
#include "typedefs.h"
|
||||
#include "common.h"
|
||||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
#include "engine.h"
|
||||
#include "exhumed.h"
|
||||
#include "osdcmds.h"
|
||||
|
@ -807,7 +805,7 @@ void ShutDown(void)
|
|||
|
||||
RemoveEngine();
|
||||
UnInitNet();
|
||||
UnInitFX();
|
||||
//UnInitFX();
|
||||
}
|
||||
|
||||
void I_Error(const char *fmt, ...)
|
||||
|
@ -1383,6 +1381,7 @@ void FinishLevel()
|
|||
EraseScreen(4);
|
||||
SetLocalChan(1);
|
||||
PlayLocalSound(StaticSound[59], 0);
|
||||
SetLocalChan(0);
|
||||
videoNextPage();
|
||||
WaitTicks(12);
|
||||
WaitVBL();
|
||||
|
@ -1912,11 +1911,7 @@ void CheckCommandLine(int argc, char const* const* argv, int &doTitle)
|
|||
|
||||
int GameInterface::app_main()
|
||||
{
|
||||
char tempbuf[256];
|
||||
|
||||
int i;
|
||||
|
||||
|
||||
//int esi = 1;
|
||||
//int edi = esi;
|
||||
int doTitle = kTrue; // REVERT kTrue;
|
||||
|
@ -2047,7 +2042,6 @@ int GameInterface::app_main()
|
|||
InitView();
|
||||
myloadconfig();
|
||||
InitFX();
|
||||
LoadFX();
|
||||
seq_LoadSequences();
|
||||
InitStatus();
|
||||
InitTimer();
|
||||
|
@ -2285,13 +2279,11 @@ LOOP3:
|
|||
|
||||
//int edi = totalclock;
|
||||
tclocks2 = totalclock;
|
||||
CONTROL_BindsEnabled = 1;
|
||||
// Game Loop
|
||||
while (1)
|
||||
{
|
||||
if (levelnew >= 0)
|
||||
{
|
||||
CONTROL_BindsEnabled = 0;
|
||||
goto LOOP1;
|
||||
}
|
||||
|
||||
|
@ -2340,7 +2332,6 @@ LOOP3:
|
|||
fclose(vcrfp);
|
||||
}
|
||||
|
||||
CONTROL_BindsEnabled = 0;
|
||||
goto MENU;
|
||||
}
|
||||
}
|
||||
|
@ -2480,7 +2471,6 @@ LOOP3:
|
|||
{
|
||||
inputState.ClearKeyStatus(sc_Escape);
|
||||
// MENU2:
|
||||
CONTROL_BindsEnabled = 0;
|
||||
bInMove = kTrue;
|
||||
nMenu = menu_Menu(1);
|
||||
|
||||
|
@ -2510,7 +2500,6 @@ LOOP3:
|
|||
|
||||
totalclock = ototalclock = tclocks;
|
||||
bInMove = kFalse;
|
||||
CONTROL_BindsEnabled = 1;
|
||||
RefreshStatus();
|
||||
}
|
||||
else if (buttonMap.ButtonDown(gamefunc_Map)) // e.g. TAB (to show 2D map)
|
||||
|
|
|
@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#define __exhumed_h__
|
||||
|
||||
#include "compat.h"
|
||||
#include "cache1d.h"
|
||||
#include "baselayer.h"
|
||||
#include "v_text.h"
|
||||
#include "printf.h"
|
||||
#include "gamecvars.h"
|
||||
|
|
|
@ -17,8 +17,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
//-------------------------------------------------------------------------
|
||||
#include "ns.h"
|
||||
#include "compat.h"
|
||||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
#include "init.h"
|
||||
#include "runlist.h"
|
||||
#include "switch.h"
|
||||
|
|
|
@ -22,8 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "player.h"
|
||||
#include "serial.h"
|
||||
#include "network.h"
|
||||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
#include "config.h"
|
||||
#include "input.h"
|
||||
#include <string.h>
|
||||
|
|
|
@ -27,8 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "baselayer.h"
|
||||
#include "typedefs.h"
|
||||
#include "keyboard.h"
|
||||
#include "cache1d.h"
|
||||
#include "fx_man.h"
|
||||
#include "sound.h"
|
||||
#include "mutex.h"
|
||||
|
||||
|
@ -232,8 +230,12 @@ void PlayMovie(const char* fileName)
|
|||
// Read a frame in first
|
||||
if (ReadFrame(fp))
|
||||
{
|
||||
// start audio playback
|
||||
// start audio playback (fixme)
|
||||
#if 0
|
||||
hFx = FX_StartDemandFeedPlayback(ServeSample, kSampleRate, 0, snd_fxvolume, snd_fxvolume, snd_fxvolume, FX_MUSIC_PRIORITY, fix16_one, -1);
|
||||
#else
|
||||
hFx = -1;
|
||||
#endif
|
||||
|
||||
while (!inputState.keyBufferWaiting())
|
||||
{
|
||||
|
@ -273,7 +275,7 @@ void PlayMovie(const char* fileName)
|
|||
}
|
||||
|
||||
if (hFx > 0) {
|
||||
FX_StopSound(hFx);
|
||||
//FX_StopSound(hFx);
|
||||
}
|
||||
|
||||
if (inputState.keyBufferWaiting()) {
|
||||
|
|
|
@ -23,8 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "compat.h"
|
||||
#include "build.h"
|
||||
#include "common.h"
|
||||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
#include "exhumed.h"
|
||||
#include "config.h"
|
||||
#include "osdcmds.h"
|
||||
|
|
|
@ -34,9 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "ps_input.h"
|
||||
#include "light.h"
|
||||
#include "status.h"
|
||||
#include "mouse.h"
|
||||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
#include "config.h"
|
||||
#include "sound.h"
|
||||
#include "init.h"
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,8 +17,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
//-------------------------------------------------------------------------
|
||||
#include "ns.h"
|
||||
#include "compat.h"
|
||||
#include "keyboard.h"
|
||||
#include "control.h"
|
||||
#include "engine.h"
|
||||
#include "config.h"
|
||||
#include "names.h"
|
||||
|
@ -31,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "light.h"
|
||||
#include "init.h"
|
||||
#include "menu.h"
|
||||
#include "keyboard.h"
|
||||
#include "cd.h"
|
||||
#include "cdaudio.h"
|
||||
#include "typedefs.h"
|
||||
|
|
Loading…
Reference in a new issue