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

Commit f7a7036

Browse files
committed
Added SoundPanningEffectStrength to SettingsMan and made it read and print
Fixed some comments and default values in SoundContainer
1 parent 8a1cf9e commit f7a7036

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

Entities/SoundContainer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace RTE {
1111
m_Sounds.clear();
1212
m_SelectedSounds.clear();
1313
m_PlayingChannels.clear();
14-
m_AttenuationStartDistance = 0;
14+
m_AttenuationStartDistance = 1;
1515
m_Loops = 0;
1616
m_Priority = AudioMan::PRIORITY_NORMAL;
1717
m_AffectedByGlobalPitch = true;

Entities/SoundContainer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ namespace RTE {
4242
/// <param name="loops">The number of times this SoundContainer's sounds will loop. 0 means play once. -1 means play infinitely until stopped.</param>
4343
/// <param name="affectedByGlobalPitch">Whether this SoundContainer's sounds' frequency will be affected by the global pitch.</param>
4444
/// <param name="attenuationStartDistance">The distance at which this SoundContainer's sounds should start attenuating away.</param>
45-
/// <param name="immobile">Whether this SoundContainer's sounds' positions will be treated as immobile, i.e. they won't be affected by 3D sound manipulation.</param>
45+
/// <param name="immobile">Whether this SoundContainer's sounds will be treated as immobile, i.e. they won't be affected by 3D sound manipulation.</param>
4646
/// <returns>An error return value signaling success or any particular failure. Anything below 0 is an error signal.</returns>
47-
int Create(int loops = 0, bool affectedByGlobalPitch = true, float attenuationStartDistance = 0, bool immobile = false) { SetLoopSetting(loops); m_AffectedByGlobalPitch = affectedByGlobalPitch; m_AttenuationStartDistance = attenuationStartDistance; m_Immobile = immobile; return 0; }
47+
int Create(int loops = 0, bool affectedByGlobalPitch = true, float attenuationStartDistance = 1, bool immobile = false) { SetLoopSetting(loops); m_AffectedByGlobalPitch = affectedByGlobalPitch; m_AttenuationStartDistance = attenuationStartDistance; m_Immobile = immobile; return 0; }
4848

4949
/// <summary>
5050
/// Creates a SoundContainer and gives it a path to its first sound.
@@ -53,9 +53,9 @@ namespace RTE {
5353
/// <param name="loops">The number of times this SoundContainer's sounds will loop. 0 means play once. -1 means play infinitely until stopped.</param>
5454
/// <param name="affectedByGlobalPitch">Whether this SoundContainer's sounds' frequency will be affected by the global pitch.</param>
5555
/// <param name="attenuationStartDistance">The distance at which this SoundContainer's sounds should start attenuating away.</param>
56-
/// <param name="immobile">Whether this SoundContainer's sounds' positions will be treated as immobile, i.e. they won't be affected by 3D sound manipulation.</param>
56+
/// <param name="immobile">Whether this SoundContainer's sounds will be treated as immobile, i.e. they won't be affected by 3D sound manipulation.</param>
5757
/// <returns>An error return value signaling success or any particular failure. Anything below 0 is an error signal.</returns>
58-
int Create(std::string const soundPath, int loops = 0, bool affectedByGlobalPitch = true, float attenuationStartDistance = 0, bool immobile = false) { int result = Create(loops, affectedByGlobalPitch, attenuationStartDistance, immobile); AddSound(soundPath); return result; }
58+
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>
6161
/// Adds a new Sound to this SoundContainer, loaded from a file.

Managers/SettingsMan.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void SettingsMan::Clear()
5656
m_ForceNonOverlayedWindowGfxDriver = false;
5757
m_AllowSavingToBase = false;
5858
m_RecommendedMOIDCount = 240;
59+
m_SoundPanningEffectStrength = 0.5;
5960
m_NetworkServerName = "";
6061
m_PlayerNetworkName = "";
6162

@@ -233,6 +234,8 @@ int SettingsMan::ReadProperty(std::string propName, Reader &reader)
233234
reader >> m_PrintDebugInfo;
234235
else if (propName == "RecommendedMOIDCount")
235236
reader >> m_RecommendedMOIDCount;
237+
else if (propName == "SoundPanningEffectStrength")
238+
reader >> m_SoundPanningEffectStrength;
236239
else if (propName == "PlayerNetworkName")
237240
reader >> m_PlayerNetworkName;
238241
else if (propName == "NetworkServerName")
@@ -403,6 +406,8 @@ int SettingsMan::Save(Writer &writer) const
403406
writer << m_PrintDebugInfo;
404407
writer.NewProperty("RecommendedMOIDCount");
405408
writer << m_RecommendedMOIDCount;
409+
writer.NewProperty("SoundPanningEffectStrength");
410+
writer << m_SoundPanningEffectStrength;
406411
writer.NewProperty("PlayerNetworkName");
407412
if (m_PlayerNetworkName == "")
408413
writer << "Dummy";

Managers/SettingsMan.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,11 @@ class SettingsMan:
409409

410410
void SetPrintDebugInfo(bool printDebugInfo) { m_PrintDebugInfo = printDebugInfo; }
411411

412+
/// <summary>
413+
/// The strength of the sound panning effect. 0 - 1, where 0 is no panning and 1 is fully panned
414+
/// </summary>
415+
float SoundPanningEffectStrength() const { return m_SoundPanningEffectStrength; }
416+
412417

413418
//////////////////////////////////////////////////////////////////////////////////////////
414419
// Method: ForceSoftwareGfxDriver
@@ -596,6 +601,8 @@ class SettingsMan:
596601
bool m_EndlessMode;
597602
// Print some debug info in console
598603
bool m_PrintDebugInfo;
604+
// The strength of the sound panning effect, 0 (no panning) - 1 (full panning)
605+
float m_SoundPanningEffectStrength;
599606
//Whether CC uses additional Draws during MO's PreTravel and PostTravel to
600607
//update MO layer this frame with more precision(true), or it just uses data from the last frame with less precision(false)
601608
bool m_PreciseCollisions;

0 commit comments

Comments
 (0)