@@ -19,13 +19,17 @@ namespace RTE {
19
19
20
20
m_PlayingChannels.clear ();
21
21
22
+ m_Immobile = false ;
22
23
m_AttenuationStartDistance = c_DefaultAttenuationStartDistance;
23
24
m_Loops = 0 ;
25
+ m_SoundPropertiesUpToDate = false ;
26
+
24
27
m_Priority = AudioMan::PRIORITY_NORMAL;
25
28
m_AffectedByGlobalPitch = true ;
26
- m_Immobile = false ;
27
29
28
- m_AllSoundPropertiesUpToDate = false ;
30
+ m_Pos = Vector ();
31
+ m_Volume = 1 .0F ;
32
+ m_Pitch = 1 .0F ;
29
33
}
30
34
31
35
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -45,11 +49,16 @@ namespace RTE {
45
49
46
50
m_PlayingChannels.clear ();
47
51
52
+ m_Immobile = reference.m_Immobile ;
48
53
m_AttenuationStartDistance = reference.m_AttenuationStartDistance ;
49
54
m_Loops = reference.m_Loops ;
55
+
50
56
m_Priority = reference.m_Priority ;
51
57
m_AffectedByGlobalPitch = reference.m_AffectedByGlobalPitch ;
52
- m_Immobile = reference.m_Immobile ;
58
+
59
+ m_Pos = reference.m_Pos ;
60
+ m_Volume = reference.m_Volume ;
61
+ m_Pitch = reference.m_Pitch ;
53
62
54
63
return 0 ;
55
64
}
@@ -66,6 +75,8 @@ namespace RTE {
66
75
} else {
67
76
reader.ReportError (" Cycle mode " + cycleModeString + " is invalid." );
68
77
}
78
+ } else if (propName == " Immobile" ) {
79
+ reader >> m_Immobile;
69
80
} else if (propName == " AttenuationStartDistance" ) {
70
81
reader >> m_AttenuationStartDistance;
71
82
} else if (propName == " LoopSetting" ) {
@@ -75,8 +86,12 @@ namespace RTE {
75
86
if (m_Priority < 0 || m_Priority > 256 ) { reader.ReportError (" SoundContainer priority must be between 256 (lowest priority) and 0 (highest priority)." ); }
76
87
} else if (propName == " AffectedByGlobalPitch" ) {
77
88
reader >> m_AffectedByGlobalPitch;
78
- } else if (propName == " Immobile" ) {
79
- reader >> m_Immobile;
89
+ } else if (propName == " Position" ) {
90
+ reader >> m_Pos;
91
+ } else if (propName == " Volume" ) {
92
+ reader >> m_Volume;
93
+ } else if (propName == " Pitch" ) {
94
+ reader >> m_Pitch;
80
95
} else {
81
96
return Entity::ReadProperty (propName, reader);
82
97
}
@@ -166,7 +181,7 @@ namespace RTE {
166
181
soundSet.push_back ({soundFile, soundObject, offset, minimumAudibleDistance, attenuationStartDistance});
167
182
if (soundSetIndex >= m_SoundSets.size ()) { m_SoundSets.push_back (soundSet); }
168
183
169
- m_AllSoundPropertiesUpToDate = false ;
184
+ m_SoundPropertiesUpToDate = false ;
170
185
}
171
186
172
187
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -250,7 +265,7 @@ namespace RTE {
250
265
result = (result == FMOD_OK) ? soundData.SoundObject ->setMode (soundMode) : result;
251
266
result = (result == FMOD_OK) ? soundData.SoundObject ->setLoopCount (m_Loops) : result;
252
267
if (m_Immobile) {
253
- result = (result == FMOD_OK) ? soundData.SoundObject ->set3DMinMaxDistance (m_AttenuationStartDistance, c_SoundMaxAudibleDistance) : result;
268
+ result = (result == FMOD_OK) ? soundData.SoundObject ->set3DMinMaxDistance (std::max ( 0 . 0F , m_AttenuationStartDistance) , c_SoundMaxAudibleDistance) : result;
254
269
} else {
255
270
// FMOD_VECTOR customRolloffPoints[10];
256
271
// CalculateCustomRolloffPoints(soundData, customRolloffPoints, 10);
@@ -262,7 +277,7 @@ namespace RTE {
262
277
}
263
278
}
264
279
}
265
- m_AllSoundPropertiesUpToDate = result == FMOD_OK;
280
+ m_SoundPropertiesUpToDate = result == FMOD_OK;
266
281
267
282
return result;
268
283
}
@@ -271,7 +286,7 @@ namespace RTE {
271
286
272
287
// TODO this needs to be used or be deleted
273
288
void SoundContainer::CalculateCustomRolloffPoints (const SoundData &soundDataToCalculateFor, FMOD_VECTOR *rolloffPoints, int numRolloffPoints) {
274
- int attenuationStartDistance = (soundDataToCalculateFor.AttenuationStartDistance < 0 ) ? m_AttenuationStartDistance : soundDataToCalculateFor.AttenuationStartDistance ;
289
+ float attenuationStartDistance = (soundDataToCalculateFor.AttenuationStartDistance < 0 ) ? m_AttenuationStartDistance : soundDataToCalculateFor.AttenuationStartDistance ;
275
290
float currentDistance = attenuationStartDistance;
276
291
float currentVolumeLevel = 1 ;
277
292
0 commit comments