summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authorRoman Masanin <36927roma@gmail.com>2020-10-25 22:16:46 +0100
committerRoman Masanin <36927roma@gmail.com>2020-10-25 22:16:46 +0100
commit44bbcbd14ac86e22c1514b78bbc2fad2f0f9cf24 (patch)
tree285278bf5fda41d6a528a7912153a892746262ed /src/audio
parentcleanup processVehicleOneShots, processVehicleX done (diff)
parentsmall glass fix (diff)
downloadre3-44bbcbd14ac86e22c1514b78bbc2fad2f0f9cf24.tar
re3-44bbcbd14ac86e22c1514b78bbc2fad2f0f9cf24.tar.gz
re3-44bbcbd14ac86e22c1514b78bbc2fad2f0f9cf24.tar.bz2
re3-44bbcbd14ac86e22c1514b78bbc2fad2f0f9cf24.tar.lz
re3-44bbcbd14ac86e22c1514b78bbc2fad2f0f9cf24.tar.xz
re3-44bbcbd14ac86e22c1514b78bbc2fad2f0f9cf24.tar.zst
re3-44bbcbd14ac86e22c1514b78bbc2fad2f0f9cf24.zip
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/AudioLogic.cpp244
-rw-r--r--src/audio/AudioManager.h6
-rw-r--r--src/audio/DMAudio.cpp13
-rw-r--r--src/audio/DMAudio.h10
-rw-r--r--src/audio/MusicManager.cpp2
-rw-r--r--src/audio/soundlist.h11
6 files changed, 166 insertions, 120 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index 436c5ba9..40e0ba6c 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -4899,7 +4899,7 @@ cAudioManager::SetPedTalkingStatus(CPed *ped, uint8 status)
}
void
-cAudioManager::SetPlayersMood(uint8 mood, int32 time)
+cAudioManager::SetPlayersMood(uint8 mood, uint32 time)
{
if (!m_bIsInitialised) return;
@@ -5907,18 +5907,21 @@ cAudioManager::ProcessFrontEnd()
bool stereo;
bool processedPickup;
bool processedMission;
- bool frontendBank;
+ bool staticFreq;
+ bool center;
int16 sample;
static uint8 iSound = 0;
static uint32 cPickupNextFrame = 0;
static uint32 cPartMisComNextFrame = 0;
+ static uint32 radioDial = SFX_RADIO_DIAL_1;
for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) {
+ staticFreq = false;
processedPickup = false;
- stereo = false;
+ center = false;
processedMission = false;
- frontendBank = false;
+ stereo = false;
switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]) {
case SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM:
m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_RIFLE;
@@ -5926,102 +5929,124 @@ cAudioManager::ProcessFrontEnd()
case SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM:
m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_ROCKET_LAUNCHER;
break;
- //case SOUND_GARAGE_NO_MONEY:
- //case SOUND_GARAGE_BAD_VEHICLE:
- //case SOUND_GARAGE_BOMB_ALREADY_SET:
- // m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT;
- // stereo = true;
- // break;
- //case SOUND_GARAGE_OPENING:
- //case SOUND_GARAGE_BOMB1_SET:
- //case SOUND_GARAGE_BOMB2_SET:
- //case SOUND_GARAGE_BOMB3_SET:
- //case SOUND_41:
- //case SOUND_GARAGE_VEHICLE_DECLINED:
- //case SOUND_GARAGE_VEHICLE_ACCEPTED:
- //case SOUND_PICKUP_HEALTH:
- //case SOUND_4B:
- //case SOUND_PICKUP_ADRENALINE:
- //case SOUND_PICKUP_ARMOUR:
- //case SOUND_EVIDENCE_PICKUP:
- //case SOUND_UNLOAD_GOLD:
- // m_sQueueSample.m_nSampleIndex = SFX_PICKUP_2_LEFT;
- // processedPickup = true;
- // stereo = true;
- // break;
- //case SOUND_PICKUP_WEAPON_BOUGHT:
- //case SOUND_PICKUP_WEAPON:
- // m_sQueueSample.m_nSampleIndex = SFX_PICKUP_1_LEFT;
- // processedPickup = true;
- // stereo = true;
- // break;
- //case SOUND_PICKUP_ERROR:
- // m_sQueueSample.m_nSampleIndex = SFX_PICKUP_ERROR_LEFT;
- // processedPickup = true;
- // stereo = true;
- // break;
- //case SOUND_PICKUP_BONUS:
- //case SOUND_PICKUP_MONEY:
- //case SOUND_PICKUP_HIDDEN_PACKAGE:
- //case SOUND_PICKUP_PACMAN_PILL:
- //case SOUND_PICKUP_PACMAN_PACKAGE:
- //case SOUND_PICKUP_FLOAT_PACKAGE:
- // m_sQueueSample.m_nSampleIndex = SFX_PICKUP_3_LEFT;
- // processedPickup = true;
- // stereo = true;
- // break;
- //case SOUND_PAGER:
- // m_sQueueSample.m_nSampleIndex = SFX_PAGER;
- // break;
- case SOUND_RACE_START_3:
- case SOUND_RACE_START_2:
- case SOUND_RACE_START_1:
- case SOUND_CLOCK_TICK:
- m_sQueueSample.m_nSampleIndex = SFX_TIMER_BEEP;
+ case SOUND_GARAGE_NO_MONEY:
+ case SOUND_GARAGE_BAD_VEHICLE:
+ case SOUND_GARAGE_BOMB_ALREADY_SET:
+ m_sQueueSample.m_nSampleIndex = SFX_WEAPON_LEFT;
+ stereo = true;
+ staticFreq = true;
+ center = true;
break;
- case SOUND_RACE_START_GO:
+ case SOUND_GARAGE_OPENING:
+ case SOUND_71: //case SOUND_41:
+ case SOUND_GARAGE_VEHICLE_DECLINED:
+ case SOUND_GARAGE_VEHICLE_ACCEPTED:
+ case SOUND_EVIDENCE_PICKUP:
+ case SOUND_UNLOAD_GOLD:
+ stereo = true;
+ processedPickup = true;
+ m_sQueueSample.m_nSampleIndex = SFX_MONEY_LEFT;
+ break;
+ case SOUND_GARAGE_BOMB1_SET:
+ case SOUND_GARAGE_BOMB2_SET:
+ case SOUND_GARAGE_BOMB3_SET:
+ center = true;
+ processedPickup = true;
+ m_sQueueSample.m_nSampleIndex = SFX_WEAPON_LEFT;
+ stereo = true;
+ break;
+ case SOUND_PICKUP_HEALTH:
+ case SOUND_81: //case SOUND_4B:
+ case SOUND_PICKUP_ADRENALINE:
+ case SOUND_PICKUP_ARMOUR:
+ stereo = true;
+ processedPickup = true;
+ m_sQueueSample.m_nSampleIndex = SFX_MONEY_LEFT;
+ break;
+ case SOUND_80:
+ stereo = true;
+ processedPickup = true;
+ m_sQueueSample.m_nSampleIndex = SFX_WEAPON_LEFT;
+ center = true;
+ staticFreq = true;
+ break;
+ case SOUND_PICKUP_BONUS:
+ case SOUND_FRONTEND_MENU_STARTING:
+ case SOUND_HUD_SOUND:
+ stereo = true;
+ m_sQueueSample.m_nSampleIndex = SFX_INFO_LEFT;
+ center = true;
+ break;
+ case SOUND_PICKUP_MONEY:
+ stereo = true;
+ processedPickup = true;
+ m_sQueueSample.m_nSampleIndex = SFX_MONEY_LEFT;
+ break;
+ case SOUND_PICKUP_HIDDEN_PACKAGE:
+ case SOUND_PICKUP_PACMAN_PILL:
+ case SOUND_PICKUP_PACMAN_PACKAGE:
+ case SOUND_PICKUP_FLOAT_PACKAGE:
+ center = true;
+ processedPickup = true;
m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE_LEFT;
+ stereo = true;
break;
+ case SOUND_RACE_START_3:
+ case SOUND_RACE_START_2:
+ case SOUND_RACE_START_1:
case SOUND_PART_MISSION_COMPLETE:
+ stereo = true;
m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE_LEFT;
processedMission = true;
+ center = true;
break;
- case SOUND_FRONTEND_MENU_STARTING:
- m_sQueueSample.m_nSampleIndex = SFX_FE_HIGHLIGHT_LEFT;
+ case SOUND_RACE_START_GO:
stereo = true;
+ m_sQueueSample.m_nSampleIndex = SFX_GO_LEFT;
+ center = true;
break;
- case SOUND_FRONTEND_MENU_NEW_PAGE:
- m_sQueueSample.m_nSampleIndex = SFX_FE_HIGHLIGHT_LEFT;
+ case SOUND_CLOCK_TICK:
+ m_sQueueSample.m_nSampleIndex = SFX_TIMER;
+ break;
+ case SOUND_FRONTEND_NO_RADIO:
+ case SOUND_FRONTEND_RADIO_CHANGE:
+ m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK;
+ break;
+ case SOUND_FRONTEND_RADIO_CHANGE_2:
+ m_sQueueSample.m_nSampleIndex = SFX_HURRICANE_MA;
+ break;
+ case SOUND_BULLETTRACE_1:
+ case SOUND_BULLETTRACE_2:
+ m_sQueueSample.m_nSampleIndex = (m_anRandomTable[0] % 2) + SFX_BULLET_PASS_1;
+ break;
+ case SOUND_AMMUNATION_IMRAN_ARM_BOMB:
+ m_sQueueSample.m_nSampleIndex = SFX_ARM_BOMB;
+ break;
+ case SOUND_RADIO_CHANGE:
+ m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] % 2) ? radioDial + 1 : radioDial + 2;
+ if (m_sQueueSample.m_nSampleIndex > SFX_RADIO_DIAL_12)
+ m_sQueueSample.m_nSampleIndex -= 12;
+ radioDial = m_sQueueSample.m_nSampleIndex;
+ break;
+ case SOUND_FRONTEND_HIGHLIGHT_OPTION:
stereo = true;
- frontendBank = true;
- frontendBank = true;
+ m_sQueueSample.m_nSampleIndex = SFX_FE_HIGHLIGHT_LEFT;
break;
- case SOUND_FRONTEND_MENU_SETTING_CHANGE:
+ case SOUND_FRONTEND_ENTER_OR_ADJUST:
+ stereo = true;
m_sQueueSample.m_nSampleIndex = SFX_FE_SELECT_LEFT;
+ break;
+ case SOUND_FRONTEND_BACK:
stereo = true;
- frontendBank = true;
-
-
+ m_sQueueSample.m_nSampleIndex = SFX_FE_BACK_LEFT;
break;
- //case SOUND_FRONTEND_EXIT:
- // m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT;
- // stereo = true;
- // break;
- //case SOUND_FRONTEND_AUDIO_TEST:
- // m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 3 + SFX_NOISE_BURST_1;
- // break;
case SOUND_FRONTEND_FAIL:
- m_sQueueSample.m_nSampleIndex = SFX_FE_ERROR_LEFT;
- frontendBank = true;
stereo = true;
+ m_sQueueSample.m_nSampleIndex = SFX_FE_ERROR_LEFT;
break;
- case SOUND_FRONTEND_NO_RADIO:
- case SOUND_FRONTEND_RADIO_CHANGE:
- m_sQueueSample.m_nSampleIndex = SFX_RADIO_CLICK;
+ case SOUND_FRONTEND_AUDIO_TEST:
+ m_sQueueSample.m_nSampleIndex = m_anRandomTable[0] % 3 + SFX_FE_NOISE_BURST_1;
break;
- //case SOUND_HUD_SOUND:
- // m_sQueueSample.m_nSampleIndex = SFX_INFO;
- // break;
default:
continue;
}
@@ -6037,37 +6062,64 @@ cAudioManager::ProcessFrontEnd()
}
sample = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
- if (sample == SFX_RAIN) {
+
+ if (sample == SOUND_FRONTEND_NO_RADIO)
m_sQueueSample.m_nFrequency = 28509;
- /*} else if (sample == SFX_PICKUP_1_LEFT) {
- if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i] == 1.0f)
- m_sQueueSample.m_nFrequency = 32000;
- else
- m_sQueueSample.m_nFrequency = 48000;*/
- } else {
+ else if (sample == SOUND_FRONTEND_RADIO_CHANGE)
+ m_sQueueSample.m_nFrequency = 32000;
+ else if (sample == SOUND_BULLETTRACE_1 || sample == SOUND_BULLETTRACE_2) {
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
- }
- m_sQueueSample.m_nVolume = 110;
+ m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
+ } else if (staticFreq)
+ m_sQueueSample.m_nFrequency = 5382;
+ else
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
+
+ m_sQueueSample.m_nVolume = 127;
+ if (m_sQueueSample.m_nSampleIndex == SFX_HURRICANE_MA && CWeather::Wind > 1.0f)
+ m_sQueueSample.m_nVolume = (CWeather::Wind - 1.0f) * m_sQueueSample.m_nVolume;
m_sQueueSample.m_nCounter = iSound++;
m_sQueueSample.m_nLoopCount = 1;
m_sQueueSample.m_bReleasingSoundFlag = true;
- m_sQueueSample.m_nBankIndex = frontendBank ? SFX_BANK_FRONT_END_MENU : SFX_BANK_0;
+ m_sQueueSample.m_nBankIndex = SFX_BANK_FRONT_END_MENU;
m_sQueueSample.m_nReleasingVolumeModificator = 0;
m_sQueueSample.m_bIs2D = true;
m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
m_sQueueSample.m_nLoopStart = 0;
m_sQueueSample.m_nLoopEnd = -1;
- if (stereo)
- m_sQueueSample.m_nOffset = m_anRandomTable[0] & 31;
- else
+ m_sQueueSample.m_fDistance = 1.0f;
+ if (stereo)
+ m_sQueueSample.m_nOffset = 0;
+ else {
+ sample = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i];
+ if (sample == SOUND_BULLETTRACE_1) {
+ m_sQueueSample.m_nOffset = 20;
+ m_sQueueSample.m_nVolume = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
+ m_sQueueSample.m_nReleasingVolumeModificator = 10;
+ m_sQueueSample.m_fDistance = 100.0f;
+ }
+ if (sample == SOUND_BULLETTRACE_2) {
+ m_sQueueSample.m_nOffset = 107;
+ m_sQueueSample.m_nVolume = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i];
+ m_sQueueSample.m_nReleasingVolumeModificator = 10;
+ m_sQueueSample.m_fDistance = 100.0f;
+ }
m_sQueueSample.m_nOffset = 63;
+ }
m_sQueueSample.m_bReverbFlag = false;
m_sQueueSample.m_bRequireReflection = false;
AddSampleToRequestedQueue();
if (stereo) {
++m_sQueueSample.m_nSampleIndex;
m_sQueueSample.m_nCounter = iSound++;
- m_sQueueSample.m_nOffset = MAX_VOLUME - m_sQueueSample.m_nOffset;
+ m_sQueueSample.m_nOffset = 127 - m_sQueueSample.m_nOffset;
+ AddSampleToRequestedQueue();
+ }
+ if (center) {
+ ++m_sQueueSample.m_nSampleIndex;
+ m_sQueueSample.m_nCounter = iSound++;
+ m_sQueueSample.m_nOffset = 63;
+ m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
AddSampleToRequestedQueue();
}
}
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 3c4b2116..eb8c0bf2 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -321,8 +321,8 @@ public:
void ProcessEntity(int32 sound); // done
void ProcessExplosions(int32 explosion); // done
void ProcessFireHydrant(); // done
- void ProcessFires(int32 entity); // done
- void ProcessFrontEnd(); //
+ void ProcessFires(int32 entity); //
+ void ProcessFrontEnd(); // done
void ProcessGarages(); //
void ProcessCarHeli(cVehicleParams* params); // done
void ProcessVehicleFlatTyre(cVehicleParams* params); // done
@@ -418,7 +418,7 @@ public:
CVehicle *FindVehicleOfPlayer(); //done
void SetPedTalkingStatus(CPed *ped, uint8 status);
- void SetPlayersMood(uint8 mood, int32 time);
+ void SetPlayersMood(uint8 mood, uint32 time);
#ifdef GTA_PC
// only used in pc
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp
index ade53d9b..7c99e89f 100644
--- a/src/audio/DMAudio.cpp
+++ b/src/audio/DMAudio.cpp
@@ -5,9 +5,6 @@
#include "AudioManager.h"
#include "AudioScriptObject.h"
#include "sampman.h"
-#include "Font.h"
-#include "Text.h"
-#include "crossplatform.h"
cDMAudio DMAudio;
@@ -241,13 +238,13 @@ cDMAudio::PlayFrontEndSound(uint16 frontend, uint32 volume)
}
void
-cDMAudio::PlayRadioAnnouncement(uint8 announcement)
+cDMAudio::PlayRadioAnnouncement(uint32 announcement)
{
MusicManager.PlayAnnouncement(announcement);
}
void
-cDMAudio::PlayFrontEndTrack(uint8 track, uint8 frontendFlag)
+cDMAudio::PlayFrontEndTrack(uint32 track, uint8 frontendFlag)
{
MusicManager.PlayFrontEndTrack(track, frontendFlag);
}
@@ -271,7 +268,7 @@ cDMAudio::ChangeMusicMode(uint8 mode)
}
void
-cDMAudio::PreloadCutSceneMusic(uint8 track)
+cDMAudio::PreloadCutSceneMusic(uint32 track)
{
MusicManager.PreloadCutSceneMusic(track);
}
@@ -337,7 +334,7 @@ cDMAudio::SetRadioInCar(uint32 radio)
}
void
-cDMAudio::SetRadioChannel(int8 radio, int32 pos)
+cDMAudio::SetRadioChannel(uint32 radio, int32 pos)
{
MusicManager.SetRadioChannelByScript(radio, pos);
}
@@ -373,7 +370,7 @@ cDMAudio::SetPedTalkingStatus(CPed *ped, uint8 status)
}
void
-cDMAudio::SetPlayersMood(uint8 mood, int32 time)
+cDMAudio::SetPlayersMood(uint8 mood, uint32 time)
{
return AudioManager.SetPlayersMood(mood, time);
}
diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h
index ef62294e..2c10043f 100644
--- a/src/audio/DMAudio.h
+++ b/src/audio/DMAudio.h
@@ -69,15 +69,15 @@ public:
void ReportCollision(CEntity *entityA, CEntity *entityB, uint8 surfaceTypeA, uint8 surfaceTypeB, float collisionPower, float velocity);
void PlayFrontEndSound(uint16 frontend, uint32 volume);
- void PlayRadioAnnouncement(uint8 announcement);
- void PlayFrontEndTrack(uint8 track, uint8 frontendFlag);
+ void PlayRadioAnnouncement(uint32 announcement);
+ void PlayFrontEndTrack(uint32 track, uint8 frontendFlag);
void StopFrontEndTrack(void);
void ResetTimers(uint32 time);
void ChangeMusicMode(uint8 mode);
- void PreloadCutSceneMusic(uint8 track);
+ void PreloadCutSceneMusic(uint32 track);
void PlayPreloadedCutSceneMusic(void);
void StopCutSceneMusic(void);
@@ -90,14 +90,14 @@ public:
uint8 GetRadioInCar(void);
void SetRadioInCar(uint32 radio);
- void SetRadioChannel(int8 radio, int32 pos);
+ void SetRadioChannel(uint32 radio, int32 pos);
void SetStartingTrackPositions(uint8 isStartGame);
float *GetListenTimeArray();
uint32 GetFavouriteRadioStation();
int32 GetRadioPosition(uint32 station);
void SetPedTalkingStatus(class CPed *ped, uint8 status);
- void SetPlayersMood(uint8 mood, int32 time);
+ void SetPlayersMood(uint8 mood, uint32 time);
void ShutUpPlayerTalking(uint8 state);
};
extern cDMAudio DMAudio;
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index adae2708..8aedf306 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -618,7 +618,7 @@ cMusicManager::ServiceGameMode()
}
if (RadioStaticCounter < 2 && CTimer::GetTimeInMilliseconds() > RadioStaticTimer + 800)
{
- AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_194, 0.0f);
+ AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_RADIO_CHANGE, 0.0f);
RadioStaticCounter++;
RadioStaticTimer = CTimer::GetTimeInMilliseconds();
}
diff --git a/src/audio/soundlist.h b/src/audio/soundlist.h
index 44056d55..a4235d2b 100644
--- a/src/audio/soundlist.h
+++ b/src/audio/soundlist.h
@@ -193,15 +193,12 @@ enum eSound : uint16
SOUND_WEAPON_MINIGUN_2,
SOUND_WEAPON_MINIGUN_3,
SOUND_AMMUNATION_IMRAN_ARM_BOMB,
- SOUND_194,
-
- // TODO(Miami): They're frontend sounds but names are copy-paste and incorrect
- SOUND_FRONTEND_MENU_NEW_PAGE,
+ SOUND_RADIO_CHANGE,
+ SOUND_FRONTEND_HIGHLIGHT_OPTION,
+ SOUND_FRONTEND_ENTER_OR_ADJUST,
+ SOUND_FRONTEND_BACK,
SOUND_FRONTEND_FAIL,
- SOUND_FRONTEND_MENU_SETTING_CHANGE,
- SOUND_FRONTEND_MENU_BACK,
SOUND_FRONTEND_AUDIO_TEST,
-
SOUND_INJURED_PED_MALE_OUCH,
SOUND_INJURED_PED_FEMALE,
SOUND_SET_202,