Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit b777d03

Browse files
committed
Added better handling for when the Audio system fails to start for some reason. Should avoid crashing the game now.
Fixed actor death sounds not being affected by global pitch Changed SoundContainer AddSound to default to not aborting on errors (instead printing to lua console) so it's easier to access with lua. Updated GUISound accordingly. Also added AddSound methods that let you specify things like sound set index, offset and attenuation Added software channel setting to AudioMan so we can up that to whatever number we want (currently 128). Also added AudioMan PlaySound that just takes filePath and position Added various audio constants
1 parent 5c8d214 commit b777d03

File tree

10 files changed

+123
-55
lines changed

10 files changed

+123
-55
lines changed

Entities/Actor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ ENTITYALLOCATION(Actor)
13191319
m_DeathSound.Reset();
13201320
} else {
13211321
SoundContainer newDeathSound;
1322-
newDeathSound.Create(samplePath, false);
1322+
newDeathSound.Create(samplePath);
13231323
m_DeathSound = newDeathSound;
13241324
}
13251325
}

Entities/SoundContainer.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,20 @@ namespace RTE {
7070

7171
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7272

73-
void SoundContainer::AddSound(std::string const soundPath, bool abortGameForInvalidSound) {
74-
ContentFile newFile(soundPath.c_str());
75-
76-
FMOD::Sound *newSample = newFile.GetAsSample(abortGameForInvalidSound);
77-
if (newSample) {
78-
FMOD_RESULT result = newSample->setMode((m_Loops == 0) ? FMOD_LOOP_OFF : FMOD_LOOP_NORMAL);
79-
result = (result == FMOD_OK) ? newSample->setLoopCount(m_Loops) : result;
80-
m_Sounds.push_back(std::pair<ContentFile, FMOD::Sound *>(newFile, newSample));
73+
void SoundContainer::AddSound(std::string const &soundFilePath, unsigned int soundSetIndex, const Vector &offset, float attenuationStartDistance, bool abortGameForInvalidSound) {
74+
vector<SoundData> soundSet;
75+
if (soundSetIndex < m_SoundSets.size()) { soundSet = m_SoundSets[soundSetIndex]; }
76+
77+
ContentFile soundFile(soundFilePath.c_str());
78+
FMOD::Sound *soundObject = soundFile.GetAsSample(abortGameForInvalidSound);
79+
if (!soundObject) {
80+
return;
8181
}
82+
83+
soundSet.push_back({soundFile, soundObject, offset, attenuationStartDistance});
84+
if (soundSetIndex >= m_SoundSets.size()) { m_SoundSets.push_back(soundSet); }
85+
86+
m_AllSoundPropertiesUpToDate = false;
8287
}
8388

8489
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Entities/SoundContainer.h

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,40 @@ namespace RTE {
5858
int Create(std::string const soundPath, int loops = 0, bool affectedByGlobalPitch = true, float attenuationStartDistance = 1, bool immobile = false) { int result = Create(loops, affectedByGlobalPitch, attenuationStartDistance, immobile); AddSound(soundPath); return result; }
5959

6060
/// <summary>
61-
/// Adds a new Sound to this SoundContainer, loaded from a file.
61+
/// Adds a new sound to this SoundContainer, spitting out a lua error if it fails.
62+
/// The Sound will have default configuration and be added to a new SoundSet.
6263
/// </summary>
63-
/// <param name="soundPath">A path to the new sound to add. This will be handled through PresetMan.</param>
64-
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error. Default true.</param>
65-
void AddSound(std::string const soundPath, bool abortGameForInvalidSound = true);
64+
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
65+
void AddSound(std::string const &soundFilePath) { return AddSound(soundFilePath, false); }
66+
67+
/// <summary>
68+
/// Adds a new sound to this SoundContainer, either spitting out a lua error or aborting if it fails.
69+
/// The sound will have default configuration and be added to a new SoundSet.
70+
/// </summary>
71+
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
72+
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error.</param>
73+
void AddSound(std::string const &soundFilePath, bool abortGameForInvalidSound) { return AddSound(soundFilePath, Vector(), c_DefaultAttenuationStartDistance, abortGameForInvalidSound); }
74+
75+
/// <summary>
76+
/// Adds a new sound to this SoundContainer, either spitting out a lua error or aborting if it fails.
77+
/// The sound will be configured based on parameters, and be added to a new SoundSet.
78+
/// </summary>
79+
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
80+
/// <param name="offset">The offset position to play this sound at, where (0, 0) is no offset.</param>
81+
/// <param name="attenuationStartDistance">The attenuation start distance for this sound, -1 is default.</param>
82+
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error.</param>
83+
void AddSound(std::string const &soundFilePath, const Vector &offset, float attenuationStartDistance, bool abortGameForInvalidSound) { return AddSound(soundFilePath, m_SoundSets.size() + 1, Vector(), c_DefaultAttenuationStartDistance, abortGameForInvalidSound); }
84+
85+
/// <summary>
86+
/// Adds a new sound to this SoundContainer, either spitting out a lua error or aborting if it fails.
87+
/// The sound will be configured based on parameters, and be added to the SoundSet at the given index, or a new one if there is none at that index.
88+
/// </summary>
89+
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
90+
/// <param name="soundSetIndex">The SoundSet index to add this new Sound to. If it's not an existing index, a new SoundSet will be added with this Sound.</param>
91+
/// <param name="offset">The offset position to play this sound at, where (0, 0) is no offset.</param>
92+
/// <param name="attenuationStartDistance">The attenuation start distance for this sound, -1 is default.</param>
93+
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error.</param>
94+
void AddSound(std::string const &soundFilePath, unsigned int soundSetIndex, const Vector &offset, float attenuationStartDistance, bool abortGameForInvalidSound);
6695
#pragma endregion
6796

6897
#pragma region Destruction

GUI/GUISound.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace RTE {
4444
m_EnterMenuSound.Create("Base.rte/Sounds/GUIs/MenuEnter.wav", 0, false, 0, true);
4545

4646
m_ExitMenuSound.Create("Base.rte/Sounds/GUIs/MenuExit1.wav", 0, false, 0, true);
47-
m_ExitMenuSound.AddSound("Base.rte/Sounds/GUIs/MenuExit2.wav");
47+
m_ExitMenuSound.AddSound("Base.rte/Sounds/GUIs/MenuExit2.wav", true);
4848

4949
m_FocusChangeSound.Create("Base.rte/Sounds/GUIs/FocusChange.wav", 0, false, 0, true);
5050

@@ -78,19 +78,19 @@ namespace RTE {
7878
m_DisabledPickedSound = m_PieMenuExitSound;
7979

8080
m_FundsChangedSound.Create("Base.rte/Sounds/GUIs/FundsChanged1.wav", 0, false, 0, true);
81-
m_FundsChangedSound.AddSound("Base.rte/Sounds/GUIs/FundsChanged2.wav");
82-
m_FundsChangedSound.AddSound("Base.rte/Sounds/GUIs/FundsChanged3.wav");
83-
m_FundsChangedSound.AddSound("Base.rte/Sounds/GUIs/FundsChanged4.wav");
84-
m_FundsChangedSound.AddSound("Base.rte/Sounds/GUIs/FundsChanged5.wav");
85-
m_FundsChangedSound.AddSound("Base.rte/Sounds/GUIs/FundsChanged6.wav");
81+
m_FundsChangedSound.AddSound("Base.rte/Sounds/GUIs/FundsChanged2.wav", true);
82+
m_FundsChangedSound.AddSound("Base.rte/Sounds/GUIs/FundsChanged3.wav", true);
83+
m_FundsChangedSound.AddSound("Base.rte/Sounds/GUIs/FundsChanged4.wav", true);
84+
m_FundsChangedSound.AddSound("Base.rte/Sounds/GUIs/FundsChanged5.wav", true);
85+
m_FundsChangedSound.AddSound("Base.rte/Sounds/GUIs/FundsChanged6.wav", true);
8686

8787
m_ActorSwitchSound.Create("Base.rte/Sounds/GUIs/ActorSwitch.wav", 0, false, 0, true);
8888

8989
m_BrainSwitchSound.Create("Base.rte/Sounds/GUIs/BrainSwitch.wav", 0, false, 0, true);
9090

9191
m_CameraTravelSound.Create("Base.rte/Sounds/GUIs/CameraTravel1.wav", 0, false, 0, true);
92-
m_CameraTravelSound.AddSound("Base.rte/Sounds/GUIs/CameraTravel2.wav");
93-
m_CameraTravelSound.AddSound("Base.rte/Sounds/GUIs/CameraTravel3.wav");
92+
m_CameraTravelSound.AddSound("Base.rte/Sounds/GUIs/CameraTravel2.wav", true);
93+
m_CameraTravelSound.AddSound("Base.rte/Sounds/GUIs/CameraTravel3.wav", true);
9494

9595
// m_AreaPickedSound.Create("Base.rte/Sounds/GUIs/MenuEnter.wav", 0, false, 0, true);
9696
m_AreaPickedSound = m_ConfirmSound;
@@ -104,12 +104,12 @@ namespace RTE {
104104
m_PlacementBlip.Create("Base.rte/Sounds/GUIs/PlacementBlip.wav", 0, false, 0, true);
105105

106106
m_PlacementThud.Create("Base.rte/Sounds/GUIs/PlacementThud1.wav", 0, false, 0, true);
107-
m_PlacementThud.AddSound("Base.rte/Sounds/GUIs/PlacementThud2.wav");
107+
m_PlacementThud.AddSound("Base.rte/Sounds/GUIs/PlacementThud2.wav", true);
108108

109109
m_PlacementGravel.Create("Base.rte/Sounds/GUIs/PlacementGravel1.wav", 0, false, 0, true);
110-
m_PlacementGravel.AddSound("Base.rte/Sounds/GUIs/PlacementGravel2.wav");
111-
m_PlacementGravel.AddSound("Base.rte/Sounds/GUIs/PlacementGravel3.wav");
112-
m_PlacementGravel.AddSound("Base.rte/Sounds/GUIs/PlacementGravel4.wav");
110+
m_PlacementGravel.AddSound("Base.rte/Sounds/GUIs/PlacementGravel2.wav", true);
111+
m_PlacementGravel.AddSound("Base.rte/Sounds/GUIs/PlacementGravel3.wav", true);
112+
m_PlacementGravel.AddSound("Base.rte/Sounds/GUIs/PlacementGravel4.wav", true);
113113

114114
return 0;
115115
}

Main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,8 +1907,10 @@ int main(int argc, char *argv[]) {
19071907
g_TimerMan.Create();
19081908
g_PresetMan.Create();
19091909
g_FrameMan.Create();
1910-
g_AudioMan.Create(); //NOTE: By necessity of when things can be instantiated, this internally does: new GUISound()
1911-
g_GUISound.Create();
1910+
//NOTE: By necessity of when things can be instantiated, this internally does: new GUISound()
1911+
if (g_AudioMan.Create() >= 0) {
1912+
g_GUISound.Create();
1913+
}
19121914
g_UInputMan.Create();
19131915
if (g_NetworkServer.IsServerModeEnabled()) { g_UInputMan.SetMultiplayerMode(true); }
19141916
g_ConsoleMan.Create();

Managers/AudioMan.cpp

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,31 @@ namespace RTE {
3434
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
3535

3636
int AudioMan::Create() {
37-
FMOD_RESULT soundSystemSetupResult = FMOD::System_Create(&m_AudioSystem);
38-
soundSystemSetupResult = (soundSystemSetupResult == FMOD_OK) ? m_AudioSystem->set3DSettings(1, g_FrameMan.GetPPM(), 1) : soundSystemSetupResult;
39-
40-
soundSystemSetupResult = (soundSystemSetupResult == FMOD_OK) ? m_AudioSystem->init(c_MaxAudioChannels, FMOD_INIT_NORMAL, 0) : soundSystemSetupResult;
41-
soundSystemSetupResult = (soundSystemSetupResult == FMOD_OK) ? m_AudioSystem->getMasterChannelGroup(&m_MasterChannelGroup) : soundSystemSetupResult;
42-
soundSystemSetupResult = (soundSystemSetupResult == FMOD_OK) ? m_AudioSystem->createChannelGroup("Music", &m_MusicChannelGroup) : soundSystemSetupResult;
43-
soundSystemSetupResult = (soundSystemSetupResult == FMOD_OK) ? m_AudioSystem->createChannelGroup("Sounds", &m_SoundChannelGroup) : soundSystemSetupResult;
44-
soundSystemSetupResult = (soundSystemSetupResult == FMOD_OK) ? m_MasterChannelGroup->addGroup(m_MusicChannelGroup) : soundSystemSetupResult;
45-
soundSystemSetupResult = (soundSystemSetupResult == FMOD_OK) ? m_MasterChannelGroup->addGroup(m_SoundChannelGroup) : soundSystemSetupResult;
37+
FMOD_RESULT audioSystemSetupResult = FMOD::System_Create(&m_AudioSystem);
38+
audioSystemSetupResult = (audioSystemSetupResult == FMOD_OK) ? m_AudioSystem->set3DSettings(1, g_FrameMan.GetPPM(), 1) : audioSystemSetupResult;
39+
audioSystemSetupResult = (audioSystemSetupResult == FMOD_OK) ? m_AudioSystem->setSoftwareChannels(c_MaxSoftwareChannels) : audioSystemSetupResult;
40+
41+
audioSystemSetupResult = (audioSystemSetupResult == FMOD_OK) ? m_AudioSystem->init(c_MaxVirtualChannels, FMOD_INIT_NORMAL, 0) : audioSystemSetupResult;
42+
audioSystemSetupResult = (audioSystemSetupResult == FMOD_OK) ? m_AudioSystem->getMasterChannelGroup(&m_MasterChannelGroup) : audioSystemSetupResult;
43+
audioSystemSetupResult = (audioSystemSetupResult == FMOD_OK) ? m_AudioSystem->createChannelGroup("Music", &m_MusicChannelGroup) : audioSystemSetupResult;
44+
audioSystemSetupResult = (audioSystemSetupResult == FMOD_OK) ? m_AudioSystem->createChannelGroup("Sounds", &m_SoundChannelGroup) : audioSystemSetupResult;
45+
audioSystemSetupResult = (audioSystemSetupResult == FMOD_OK) ? m_MasterChannelGroup->addGroup(m_MusicChannelGroup) : audioSystemSetupResult;
46+
audioSystemSetupResult = (audioSystemSetupResult == FMOD_OK) ? m_MasterChannelGroup->addGroup(m_SoundChannelGroup) : audioSystemSetupResult;
4647

47-
m_AudioEnabled = true;
48-
if (soundSystemSetupResult != FMOD_OK) {
49-
m_AudioEnabled = false;
48+
m_AudioEnabled = audioSystemSetupResult == FMOD_OK;
49+
50+
// NOTE: Anything that instantiates SoundContainers needs to wait until the Audio System is up and running before they start doing that. It'll fail safely even if Audio is not enabled.
51+
new GUISound();
52+
53+
if (!m_AudioEnabled) {
54+
g_ConsoleMan.PrintString("ERROR: Failed to enable audio: " + std::string(FMOD_ErrorString(audioSystemSetupResult)));
5055
return -1;
51-
}
56+
}
57+
5258
SetGlobalPitch(m_GlobalPitch);
5359
SetSoundsVolume(m_SoundsVolume);
5460
SetMusicVolume(m_MusicVolume);
5561

56-
// NOTE: Anything that instantiates SoundContainers needs to wait until the Audio System is up and running before they start doing that. It'll fail safely even if Audio is not enabled.
57-
new GUISound();
58-
5962
return 0;
6063
}
6164

@@ -573,7 +576,7 @@ namespace RTE {
573576
NetworkSoundData soundData;
574577
soundData.State = state;
575578

576-
std::fill_n(soundData.Channels, c_MaxPlayingSoundsPerContainer, c_MaxAudioChannels + 1);
579+
std::fill_n(soundData.Channels, c_MaxPlayingSoundsPerContainer, c_MaxVirtualChannels + 1);
577580
if (channels) { std::copy(channels->begin(), channels->end(), soundData.Channels); }
578581

579582
std::fill_n(soundData.SoundFileHashes, c_MaxPlayingSoundsPerContainer, 0);
@@ -616,7 +619,7 @@ namespace RTE {
616619
void *userData;
617620
result = (result == FMOD_OK) ? channel->getUserData(&userData) : result;
618621
SoundContainer *channelSoundContainer = (SoundContainer *)userData;
619-
if (channelSoundContainer->GetPlayingSoundCount() > 0) { channelSoundContainer->RemovePlayingChannel(channelIndex); }
622+
if (channelSoundContainer->IsBeingPlayed()) { channelSoundContainer->RemovePlayingChannel(channelIndex); }
620623
result = (result == FMOD_OK) ? channel->setUserData(NULL) : result;
621624

622625
if (result != FMOD_OK) {
@@ -627,13 +630,20 @@ namespace RTE {
627630
return FMOD_OK;
628631
}
629632

633+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
634+
635+
630636
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
631637

632638
FMOD_VECTOR AudioMan::GetAsFMODVector(const Vector &vector, float zValue) {
633639
Vector sceneDimensions = g_SceneMan.GetSceneDim();
634-
if (sceneDimensions.IsZero()) {
635-
return FMOD_VECTOR{ 0, 0, zValue };
636-
}
637-
return FMOD_VECTOR{ vector.m_X, sceneDimensions.m_Y - vector.m_Y, zValue };
640+
return sceneDimensions.IsZero() ? FMOD_VECTOR{0, 0, zValue} : FMOD_VECTOR{vector.m_X, sceneDimensions.m_Y - vector.m_Y, zValue};
641+
}
642+
643+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
644+
645+
Vector AudioMan::GetAsVector(FMOD_VECTOR fmodVector) {
646+
Vector sceneDimensions = g_SceneMan.GetSceneDim();
647+
return sceneDimensions.IsZero() ? Vector() : Vector(fmodVector.x, sceneDimensions.m_Y - fmodVector.y);
638648
}
639649
}

Managers/AudioMan.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,14 @@ namespace RTE {
280280
SoundContainer *PlaySound(const char *filePath) { return PlaySound(filePath, Vector(), -1); }
281281

282282
/// <summary>
283-
/// Starts playing a certain sound file with a certain attenuation for a certain player.
283+
/// Starts playing a certain sound file at a certain position for all players.
284+
/// </summary>
285+
/// <param name="filePath">The path to the sound file to play.</param>
286+
/// <returns>The new SoundContainer being played. OWNERSHIP IS TRANSFERRED!</returns>
287+
SoundContainer *PlaySound(const char *filePath, const Vector &position) { return PlaySound(filePath, position, -1); }
288+
289+
/// <summary>
290+
/// Starts playing a certain sound file at a certain position for a certain player.
284291
/// </summary>
285292
/// <param name="filePath">The path to the sound file to play.</param>
286293
/// <param name="position">The position at which to play the SoundContainer's sounds.</param>
@@ -394,6 +401,7 @@ namespace RTE {
394401
#pragma endregion
395402

396403
protected:
404+
397405
static Entity::ClassInfo m_sClass; //!< ClassInfo for this class.
398406
static const std::string m_ClassName; //!< A string with the friendly-formatted type name of this object.
399407

@@ -434,13 +442,21 @@ namespace RTE {
434442
/// </summary>
435443
static FMOD_RESULT F_CALLBACK SoundChannelEndedCallback(FMOD_CHANNELCONTROL *channelControl, FMOD_CHANNELCONTROL_TYPE channelControlType, FMOD_CHANNELCONTROL_CALLBACK_TYPE callbackType, void *commandData1, void *commandData2);
436444

445+
/// <summary>
437446
/// <summary>
438447
/// Gets the corresponding FMOD_VECTOR for a given RTE Vector.
439448
/// </summary>
440-
/// <param name="vector">The vector to get as an FMOD_VECTOR.</param>
441-
/// <returns>The FMOD_VECTOR that corresponds to the given RTE Vector</returns>
449+
/// <param name="vector">The RTE Vector to get as an FMOD_VECTOR.</param>
450+
/// <returns>The FMOD_VECTOR that corresponds to the given RTE Vector.</returns>
442451
FMOD_VECTOR GetAsFMODVector(const Vector &vector, float zValue = 0);
443452

453+
/// <summary>
454+
/// Gets the corresponding RTE Vector for a given FMOD_VECTOR.
455+
/// </summary>
456+
/// <param name="fmodVector">The FMOD_VECTOR to get as an RTE Vector.</param>
457+
/// <returns>The RTE Vector that corresponds to the given FMOD_VECTOR.</returns>
458+
Vector GetAsVector(FMOD_VECTOR fmodVector);
459+
444460
/// <summary>
445461
/// Clears all the member variables of this AudioMan, effectively resetting the members of this abstraction level only.
446462
/// </summary>

Managers/LuaMan.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,9 @@ int LuaMan::Create()
559559
.def("Play", (bool (SoundContainer:: *)(const Vector &position, int player)) &SoundContainer::Play)
560560
.def("Stop", (bool (SoundContainer:: *)()) &SoundContainer::Stop)
561561
.def("Stop", (bool (SoundContainer:: *)(int player)) &SoundContainer::Stop)
562-
.def("AddSound", &SoundContainer::AddSound)
562+
.def("AddSound", (void (SoundContainer:: *)(std::string const &soundFilePath)) &SoundContainer::AddSound)
563+
.def("AddSound", (void (SoundContainer:: *)(std::string const &soundFilePath, const Vector &offset, float attenuationStartDistance, bool abortGameForInvalidSound)) &SoundContainer::AddSound)
564+
.def("AddSound", (void (SoundContainer:: *)(std::string const &soundFilePath, unsigned int soundSetIndex, const Vector &offset, float attenuationStartDistance, bool abortGameForInvalidSound)) &SoundContainer::AddSound)
563565
.def("SetPosition", &SoundContainer::SetPosition)
564566
.property("Loops", &SoundContainer::GetLoopSetting, &SoundContainer::SetLoopSetting)
565567
.property("Priority", &SoundContainer::GetPriority, &SoundContainer::SetPriority)
@@ -1498,6 +1500,7 @@ int LuaMan::Create()
14981500
.def("QueueSilence", &AudioMan::QueueSilence)
14991501
.def("ClearMusicQueue", &AudioMan::ClearMusicQueue)
15001502
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath)) &AudioMan::PlaySound)
1503+
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath, const Vector &position)) &AudioMan::PlaySound)
15011504
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath, const Vector &position, int player)) &AudioMan::PlaySound)
15021505
.def("PlaySound", (SoundContainer *(AudioMan:: *)(const char *filePath, const Vector &position, int player, int loops, int priority, double pitchOrAffectedByGlobalPitch, float attenuationStartDistance, bool immobile)) &AudioMan::PlaySound)
15031506
.def("StopSound", (bool (AudioMan:: *)(SoundContainer *soundContainer)) &AudioMan::StopSound)

System/Constants.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ namespace RTE {
3434
#pragma endregion
3535

3636
#pragma region Audio Constants
37-
static constexpr unsigned short c_MaxAudioChannels = 512;
37+
static constexpr unsigned short c_MaxSoftwareChannels = 128;
38+
static constexpr unsigned short c_MaxVirtualChannels = 1024;
3839
static constexpr unsigned short c_MaxPlayingSoundsPerContainer = 64;
40+
static constexpr short c_ListenerZOffset = 0; //!< The Z offset for Audio listeners. Can be used to lessen harsh panning if panning effect strength is at max.
41+
static constexpr short c_DefaultAttenuationStartDistance = 100; //!< The default start distance for attenuating sounds. Individual sounds can have different values for this.
3942
#pragma endregion
4043

4144
#pragma region Network Constants

0 commit comments

Comments
 (0)