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.
Fixed AudioMan create and GUISound handling, and moved SoundEventsListMutex to header
Fixed extraneous includes in MOSprite and ContentFile
Fixed bad argument ordering in a few places, and some other little bugs
Fixed some stuff in SoundContainer and moved some things in it and AudioMan into header
Fixed inlines, casts, typos
Copy file name to clipboardExpand all lines: Entities/SoundContainer.h
+22-24Lines changed: 22 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ namespace RTE {
40
40
/// </summary>
41
41
/// <param name="soundPath">A path to the sound for this sound to have.</param>
42
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>
43
-
/// <param name="affectedByGlobalPitch">Whether this SoundContainer's sounds' frequency will be affected by the global pitch</param>
43
+
/// <param name="affectedByGlobalPitch">Whether this SoundContainer's sounds' frequency will be affected by the global pitch.</param>
44
44
/// <returns>An error return value signaling success or any particular failure. Anything below 0 is an error signal.</returns>
45
45
intCreate(std::string soundPath, int loops = 0, bool affectedByGlobalPitch = true);
46
46
@@ -51,6 +51,24 @@ namespace RTE {
51
51
voidAddSound(std::string soundPath);
52
52
#pragma endregion
53
53
54
+
#pragma region Destruction
55
+
/// <summary>
56
+
/// Destructor method used to clean up a SoundContainer object before deletion from system memory.
57
+
/// </summary>
58
+
virtual~SoundContainer() { Destroy(true); }
59
+
60
+
/// <summary>
61
+
/// Destroys and resets (through Clear()) the SoundContainer object. It doesn't delete the Sound files, since they're owned by ContentFile static maps.
62
+
/// </summary>
63
+
/// <param name="notInherited">Whether to only destroy the members defined in this derived class, or to destroy all inherited members also.</param>
Copy file name to clipboardExpand all lines: Main.cpp
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1880,8 +1880,6 @@ int main(int argc, char *argv[]) {
1880
1880
newPresetMan();
1881
1881
newFrameMan();
1882
1882
newAudioMan();
1883
-
g_AudioMan.Create();
1884
-
newGUISound(); //NOTE: Due to being unable to check if the fmod sound system actually exists and is up and running, AudioMan create should happen before anything that uses audio comes into existence
1885
1883
newUInputMan();
1886
1884
newActivityMan();
1887
1885
newMovableMan();
@@ -1909,7 +1907,7 @@ int main(int argc, char *argv[]) {
1909
1907
g_TimerMan.Create();
1910
1908
g_PresetMan.Create();
1911
1909
g_FrameMan.Create();
1912
-
g_AudioMan.Create();
1910
+
g_AudioMan.Create();//NOTE: By necessity of when things can be instantiated, this internally does: new GUISound()
1913
1911
g_GUISound.Create();
1914
1912
g_UInputMan.Create();
1915
1913
if (g_NetworkServer.IsServerModeEnabled()) { g_UInputMan.SetMultiplayerMode(true); }
if (channelControlType == FMOD_CHANNELCONTROL_CHANNEL && callbackType == FMOD_CHANNELCONTROL_CALLBACK_END) {
@@ -33,7 +33,7 @@ namespace RTE {
33
33
}
34
34
35
35
if (result != FMOD_OK) {
36
-
g_ConsoleMan.PrintString("ERROR: An error occured when Ending a sound in SoundContainer " + channelSoundContainer->GetPresetName() + ": " + std::string(FMOD_ErrorString(result)));
36
+
g_ConsoleMan.PrintString("ERROR: An error occurred when Ending a sound in SoundContainer " + channelSoundContainer->GetPresetName() + ": " + std::string(FMOD_ErrorString(result)));
37
37
return result;
38
38
}
39
39
}
@@ -86,6 +86,8 @@ namespace RTE {
86
86
SetSoundsVolume(m_SoundsVolume);
87
87
SetMusicVolume(m_MusicVolume);
88
88
89
+
newGUISound(); //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.
90
+
89
91
return0;
90
92
}
91
93
@@ -106,9 +108,7 @@ namespace RTE {
106
108
m_AudioSystem->update();
107
109
108
110
// Done waiting for silence
109
-
if (!IsMusicPlaying() && m_SilenceTimer.IsPastRealTimeLimit()) {
110
-
PlayNextStream();
111
-
}
111
+
if (!IsMusicPlaying() && m_SilenceTimer.IsPastRealTimeLimit()) { PlayNextStream(); }
g_ConsoleMan.PrintString("ERROR: Failed to set vollume override for music file: " + std::string(filePath) + ". This means it will stay at " + std::to_string(m_MusicVolume) + ": " + std::string(FMOD_ErrorString(result)));
306
+
g_ConsoleMan.PrintString("ERROR: Failed to set volume override for music file: " + std::string(filePath) + ". This means it will stay at " + std::to_string(m_MusicVolume) + ": " + std::string(FMOD_ErrorString(result)));
/// Starts playing a certain sound file with various configuration settings.
@@ -304,7 +304,7 @@ namespace RTE {
304
304
/// <param name="priority">The priority of this sound - higher priority sounds are more likely to be heard. -1 means it'll use the SoundContainer's value. Defaults to -1.</param>
305
305
/// <param name="pitch">/// The pitch to play this SoundContainer's at where 1 is unmodified frequency and each multiple of 2 is an octave up or down. Defaults to 1.</param>
306
306
/// <returns>Whether or not playback of the Sound was successful.</returns>
307
-
boolPlaySound(SoundContainer *pSoundContainer, float attenuation = 0.0, int player = -1, int priority = -1, double pitch = 1);
307
+
boolPlaySound(SoundContainer *pSoundContainer, float attenuation = 0, int player = -1, int priority = -1, double pitch = 1);
308
308
309
309
/// <summary>
310
310
/// Stops playing all sounds in a given SoundContainer.
0 commit comments