You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
ContentFile now opens sounds in 3D
Changed SoundContainer attenuation to a position Vector that gets used to handle panning.
Added the ability to set a SoundContainer's attenuation start distance, i.e. the distance at which it will start attenuating away.
Added immobile property for sounds that should always be played at the player's position (i.e. no 3D effects)
Split SoundContainer getters and setters into 2 regions cause it was getting too big
Added a flag for whether a SoundContainer's sounds are all up-to-date with its member variable settings, and method to update accordingly. The latter will be used in AudioMan::PlaySound and avoids problems when loading SoundContainers from ini
Copy file name to clipboardExpand all lines: Entities/SoundContainer.h
+75-18Lines changed: 75 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@
6
6
#include"AudioMan.h"
7
7
8
8
namespaceRTE {
9
+
classVector;
9
10
10
11
/// <summary>
11
12
/// A container for sounds that represent a specific sound effect.
@@ -40,17 +41,21 @@ namespace RTE {
40
41
/// </summary>
41
42
/// <param name="loops">The number of times this SoundContainer's sounds will loop. 0 means play once. -1 means play infinitely until stopped.</param>
42
43
/// <param name="affectedByGlobalPitch">Whether this SoundContainer's sounds' frequency will be affected by the global pitch.</param>
44
+
/// <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>
43
46
/// <returns>An error return value signaling success or any particular failure. Anything below 0 is an error signal.</returns>
/// Creates a SoundContainer and gives it a path to its first sound.
48
51
/// </summary>
49
52
/// <param name="soundPath">A path to the sound for this sound to have.</param>
50
53
/// <param name="loops">The number of times this SoundContainer's sounds will loop. 0 means play once. -1 means play infinitely until stopped.</param>
51
54
/// <param name="affectedByGlobalPitch">Whether this SoundContainer's sounds' frequency will be affected by the global pitch.</param>
55
+
/// <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>
52
57
/// <returns>An error return value signaling success or any particular failure. Anything below 0 is an error signal.</returns>
53
-
intCreate(std::string const soundPath, int loops = 0, bool affectedByGlobalPitch = true) { int result = Create(loops, affectedByGlobalPitch); AddSound(soundPath); return result; }
/// Updates the distance attenuation of the SoundContainer's sounds while they're playing.
172
+
/// Updates the position of the SoundContainer's sounds while they're playing.
166
173
/// </summary>
167
-
/// <param name="attenuation">How much distance attenuation to apply to the sound. 0 = full volume 1.0 = max distant, but still won't be completely inaudible.</param>
174
+
/// <param name="position">The new position to play the SoundContainer's sounds.</param>
168
175
/// <returns>Whether this SoundContainer's attenuation setting was successful.</returns>
/// Gets whether the sounds in this SoundContainer have all had all their properties set appropriately. Used to account for issues with ordering in INI loading.
241
+
/// </summary>
242
+
/// <returns>Whether or not the sounds in this SoundContainer have their properties set appropriately.</returns>
/// Updates all sound properties to match this SoundContainer's settings.
303
+
/// Necessary because sounds loaded from ini seem to be used directly instead of loaded from PresetMan, so their correctness can't be guaranteed when they're played.
304
+
/// </summary>
305
+
/// <returns>The FMOD_RESULT for updating all of the SoundContainer's sounds' properties. If it's not FMOD_OK, something went wrong.</returns>
306
+
FMOD_RESULT UpdateSoundProperties();
307
+
#pragma endregion
308
+
256
309
protected:
257
310
258
311
static Entity::ClassInfo m_sClass; //!< ClassInfo for this class.
@@ -262,9 +315,13 @@ namespace RTE {
262
315
263
316
std::unordered_set<unsignedshortint> m_PlayingChannels; //!< The channels this SoundContainer is currently using
264
317
318
+
float m_AttenuationStartDistance; //!< The distance away from the AudioSystem listenter to start attenuating this sound. Attenuation follows FMOD 3D Inverse Rolloff model.
265
319
int m_Loops; //!< Number of loops (repeats) the SoundContainer's sounds should play when played. 0 means it plays once, -1 means it plays until stopped
266
320
int m_Priority; //!< The mixing priority of this SoundContainer's sounds. Higher values are more likely to be heard
267
321
bool m_AffectedByGlobalPitch; //!< Whether this SoundContainer's sounds should be able to be altered by global pitch changes
322
+
bool m_Immobile; //!< Whether this SoundContainer's sounds should be treated as immobile, i.e. not affected by 3D sound effects. Mostly used for GUI sounds and the like.
323
+
324
+
bool m_AllSoundPropertiesUpToDate; //!< Whether this SoundContainer's sounds' modes and properties are up to date. Used primarily to handle discrepancies that can occur when loading from ini if the line ordering isn't ideal.
0 commit comments