summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-12-19 01:21:04 +0100
committerNikolay Korolev <nickvnuk@gmail.com>2020-12-19 01:21:04 +0100
commit8d1996833bd73271ca14a3df46633d9b2ed13052 (patch)
treedaedb1622096e5bb6b8b9ec15882769b827506e1 /src/audio
parentget rid of all PED_SKIN defines (diff)
parentlittle cleanup of templates (diff)
downloadre3-8d1996833bd73271ca14a3df46633d9b2ed13052.tar
re3-8d1996833bd73271ca14a3df46633d9b2ed13052.tar.gz
re3-8d1996833bd73271ca14a3df46633d9b2ed13052.tar.bz2
re3-8d1996833bd73271ca14a3df46633d9b2ed13052.tar.lz
re3-8d1996833bd73271ca14a3df46633d9b2ed13052.tar.xz
re3-8d1996833bd73271ca14a3df46633d9b2ed13052.tar.zst
re3-8d1996833bd73271ca14a3df46633d9b2ed13052.zip
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/AudioLogic.cpp16
-rw-r--r--src/audio/AudioSamples.h3
-rw-r--r--src/audio/oal/oal_utils.cpp11
-rw-r--r--src/audio/oal/oal_utils.h7
-rw-r--r--src/audio/oal/stream.cpp6
-rw-r--r--src/audio/sampman_miles.cpp4
6 files changed, 34 insertions, 13 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 1ce30755..69c17c28 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -3193,7 +3193,7 @@ AddSample:
#ifdef GTA_TRAIN
bool
-cAudioManager::ProcessTrainNoise(cVehicleParams *params)
+cAudioManager::ProcessTrainNoise(cVehicleParams& params)
{
const float SOUND_INTENSITY = 300.0f;
@@ -3201,12 +3201,12 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
uint8 emittingVol;
float speedMultipler;
- if (params->m_fDistance >= SQR(SOUND_INTENSITY))
+ if (params.m_fDistance >= SQR(SOUND_INTENSITY))
return false;
- if (params->m_fVelocityChange > 0.0f) {
- CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
- train = (CTrain *)params->m_pVehicle;
+ if (params.m_fVelocityChange > 0.0f) {
+ CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance);
+ train = (CTrain *)params.m_pVehicle;
speedMultipler = Min(1.0f, train->m_fSpeed * 250.f / 51.f);
emittingVol = (75.f * speedMultipler);
if (train->m_fWagonPosition == 0.0f) {
@@ -3232,7 +3232,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams *params)
}
}
const float SOUND_INTENSITY = 70.0f;
- if (params->m_fDistance < SQR(SOUND_INTENSITY)) {
+ if (params.m_fDistance < SQR(SOUND_INTENSITY)) {
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance);
if (m_sQueueSample.m_nVolume != 0) {
m_sQueueSample.m_nCounter = 33;
@@ -8229,14 +8229,14 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound)
male.m_pPed = nil;
male.m_bDistanceCalculated = false;
male.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
- SetupPedComments(&male, SOUND_INJURED_PED_MALE_OUCH);
+ SetupPedComments(male, SOUND_INJURED_PED_MALE_OUCH);
return;
case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S:
case SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L:
female.m_pPed = nil;
female.m_bDistanceCalculated = false;
female.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos);
- SetupPedComments(&female, SOUND_INJURED_PED_FEMALE);
+ SetupPedComments(female, SOUND_INJURED_PED_FEMALE);
return;
case SCRIPT_SOUND_GATE_START_CLUNK:
case SCRIPT_SOUND_GATE_STOP_CLUNK:
diff --git a/src/audio/AudioSamples.h b/src/audio/AudioSamples.h
index 20159b31..a68cf768 100644
--- a/src/audio/AudioSamples.h
+++ b/src/audio/AudioSamples.h
@@ -2,7 +2,8 @@
#include "common.h"
-enum eSfxSample {
+enum eSfxSample
+{
SFX_CAR_HORN_JEEP = 0,
SFX_CAR_HORN_BMW328,
SFX_CAR_HORN_BUS,
diff --git a/src/audio/oal/oal_utils.cpp b/src/audio/oal/oal_utils.cpp
index e16de572..e4cb0b77 100644
--- a/src/audio/oal/oal_utils.cpp
+++ b/src/audio/oal/oal_utils.cpp
@@ -3,6 +3,14 @@
#ifdef AUDIO_OAL
+/*
+ * When linking to a static openal-soft library,
+ * the extension function inside the openal library conflict with the variables here.
+ * Therefore declare these re3 owned symbols in a private namespace.
+ */
+
+namespace re3_openal {
+
LPALGENEFFECTS alGenEffects;
LPALDELETEEFFECTS alDeleteEffects;
LPALISEFFECT alIsEffect;
@@ -37,6 +45,9 @@ LPALGETFILTERIV alGetFilteriv;
LPALGETFILTERF alGetFilterf;
LPALGETFILTERFV alGetFilterfv;
+}
+
+using namespace re3_openal;
void EFXInit()
{
diff --git a/src/audio/oal/oal_utils.h b/src/audio/oal/oal_utils.h
index b89ccf36..f0fa090a 100644
--- a/src/audio/oal/oal_utils.h
+++ b/src/audio/oal/oal_utils.h
@@ -11,6 +11,8 @@ void EFX_Set(ALuint effect, const EAXLISTENERPROPERTIES *props);
void EAX3_SetReverbMix(ALuint filter, float mix);
void SetEffectsLevel(ALuint uiFilter, float level);
+namespace re3_openal {
+
extern LPALGENEFFECTS alGenEffects;
extern LPALDELETEEFFECTS alDeleteEffects;
extern LPALISEFFECT alIsEffect;
@@ -44,4 +46,9 @@ extern LPALGETFILTERI alGetFilteri;
extern LPALGETFILTERIV alGetFilteriv;
extern LPALGETFILTERF alGetFilterf;
extern LPALGETFILTERFV alGetFilterfv;
+
+}
+
+using namespace re3_openal;
+
#endif
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index 06a38c29..3a1f748f 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -10,13 +10,15 @@
#ifdef _WIN32
#pragma comment( lib, "libsndfile-1.lib" )
#pragma comment( lib, "libmpg123-0.lib" )
-#else
-#include "crossplatform.h"
#endif
#include <sndfile.h>
#include <mpg123.h>
#endif
+#ifndef _WIN32
+#include "crossplatform.h"
+#endif
+
#ifndef AUDIO_OPUS
class CSndFile : public IDecoder
{
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index f7c4d7a6..3fc43a6e 100644
--- a/src/audio/sampman_miles.cpp
+++ b/src/audio/sampman_miles.cpp
@@ -1380,7 +1380,7 @@ cSampleManager::Terminate(void)
bool
cSampleManager::CheckForAnAudioFileOnCD(void)
{
-#if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
+#if !defined(NO_CDCHECK) // TODO: figure out defines
char filepath[MAX_PATH];
strcpy(filepath, m_MiscomPath);
@@ -1406,7 +1406,7 @@ cSampleManager::CheckForAnAudioFileOnCD(void)
#else
return true;
-#endif // #if !defined(GTA3_STEAM_PATCH) && !defined(NO_CDCHECK)
+#endif // #if !defined(NO_CDCHECK)
}
char