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

Commit 8a1b9b1

Browse files
committed
Reorganized SoundContainer - added region for sound addition and moved all that stuff below INI handling so cpp and header files now line up
1 parent 8f28ee1 commit 8a1b9b1

File tree

1 file changed

+39
-37
lines changed

1 file changed

+39
-37
lines changed

Entities/SoundContainer.h

Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -76,43 +76,6 @@ namespace RTE {
7676
/// <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>
7777
/// <returns>An error return value signaling success or any particular failure. Anything below 0 is an error signal.</returns>
7878
int Create(const std::string soundFilePath, int loops = 0, bool affectedByGlobalPitch = true, float attenuationStartDistance = -1, bool immobile = false) { int result = Create(loops, affectedByGlobalPitch, attenuationStartDistance, immobile); AddSound(soundFilePath); return result; }
79-
80-
/// <summary>
81-
/// Adds a new sound to this SoundContainer, spitting out a lua error if it fails.
82-
/// The Sound will have default configuration and be added to a new SoundSet.
83-
/// </summary>
84-
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
85-
void AddSound(const std::string &soundFilePath) { return AddSound(soundFilePath, false); }
86-
87-
/// <summary>
88-
/// Adds a new sound to this SoundContainer, either spitting out a lua error or aborting if it fails.
89-
/// The sound will have default configuration and be added to a new SoundSet.
90-
/// </summary>
91-
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
92-
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error.</param>
93-
void AddSound(const std::string &soundFilePath, bool abortGameForInvalidSound) { return AddSound(soundFilePath, Vector(), c_DefaultAttenuationStartDistance, abortGameForInvalidSound); }
94-
95-
/// <summary>
96-
/// Adds a new sound to this SoundContainer, either spitting out a lua error or aborting if it fails.
97-
/// The sound will be configured based on parameters, and be added to a new SoundSet.
98-
/// </summary>
99-
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
100-
/// <param name="offset">The offset position to play this sound at, where (0, 0) is no offset.</param>
101-
/// <param name="attenuationStartDistance">The attenuation start distance for this sound, -1 is default.</param>
102-
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error.</param>
103-
void AddSound(const std::string &soundFilePath, const Vector &offset, float attenuationStartDistance, bool abortGameForInvalidSound) { return AddSound(soundFilePath, m_SoundSets.size() + 1, Vector(), 0, c_DefaultAttenuationStartDistance, abortGameForInvalidSound); }
104-
105-
/// <summary>
106-
/// Adds a new sound to this SoundContainer, either spitting out a lua error or aborting if it fails.
107-
/// 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.
108-
/// </summary>
109-
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
110-
/// <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>
111-
/// <param name="offset">The offset position to play this sound at, where (0, 0) is no offset.</param>
112-
/// <param name="minimumAudibleDistance">The minimum distance at which this sound will be audible. 0 means there is none, which is normally the case.</param>
113-
/// <param name="attenuationStartDistance">The attenuation start distance for this sound, -1 sets it to default.</param>
114-
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error.</param>
115-
void AddSound(const std::string &soundFilePath, unsigned int soundSetIndex, const Vector &offset, float minimumAudibleDistance, float attenuationStartDistance, bool abortGameForInvalidSound);
11679
#pragma endregion
11780

11881
#pragma region Destruction
@@ -170,6 +133,45 @@ namespace RTE {
170133
virtual int Save(Writer &writer) const { return 0; }
171134
#pragma endregion
172135

136+
#pragma region Sound Addition
137+
/// <summary>
138+
/// Adds a new sound to this SoundContainer, spitting out a lua error if it fails.
139+
/// The Sound will have default configuration and be added to a new SoundSet.
140+
/// </summary>
141+
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
142+
void AddSound(const std::string &soundFilePath) { return AddSound(soundFilePath, false); }
143+
144+
/// <summary>
145+
/// Adds a new sound to this SoundContainer, either spitting out a lua error or aborting if it fails.
146+
/// The sound will have default configuration and be added to a new SoundSet.
147+
/// </summary>
148+
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
149+
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error.</param>
150+
void AddSound(const std::string &soundFilePath, bool abortGameForInvalidSound) { return AddSound(soundFilePath, Vector(), c_DefaultAttenuationStartDistance, abortGameForInvalidSound); }
151+
152+
/// <summary>
153+
/// Adds a new sound to this SoundContainer, either spitting out a lua error or aborting if it fails.
154+
/// The sound will be configured based on parameters, and be added to a new SoundSet.
155+
/// </summary>
156+
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
157+
/// <param name="offset">The offset position to play this sound at, where (0, 0) is no offset.</param>
158+
/// <param name="attenuationStartDistance">The attenuation start distance for this sound, -1 is default.</param>
159+
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error.</param>
160+
void AddSound(const std::string &soundFilePath, const Vector &offset, float attenuationStartDistance, bool abortGameForInvalidSound) { return AddSound(soundFilePath, m_SoundSets.size() + 1, Vector(), 0, c_DefaultAttenuationStartDistance, abortGameForInvalidSound); }
161+
162+
/// <summary>
163+
/// Adds a new sound to this SoundContainer, either spitting out a lua error or aborting if it fails.
164+
/// 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.
165+
/// </summary>
166+
/// <param name="soundFilePath">A path to the new sound to add. This will be handled through PresetMan.</param>
167+
/// <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>
168+
/// <param name="offset">The offset position to play this sound at, where (0, 0) is no offset.</param>
169+
/// <param name="minimumAudibleDistance">The minimum distance at which this sound will be audible. 0 means there is none, which is normally the case.</param>
170+
/// <param name="attenuationStartDistance">The attenuation start distance for this sound, -1 sets it to default.</param>
171+
/// <param name="abortGameForInvalidSound">Whether to abort the game if the sound couldn't be added, or just show a console error.</param>
172+
void AddSound(const std::string &soundFilePath, unsigned int soundSetIndex, const Vector &offset, float minimumAudibleDistance, float attenuationStartDistance, bool abortGameForInvalidSound);
173+
#pragma endregion
174+
173175
#pragma region Sound Management Getters and Setters
174176
/// <summary>
175177
/// Gets the current list of sounds in the SoundContainer.

0 commit comments

Comments
 (0)