2
2
3
3
#include " NetworkClient.h"
4
4
#include " AudioMan.h"
5
- // #include "ConsoleMan.h"
5
+ #include " ConsoleMan.h"
6
6
#include " PresetMan.h"
7
7
8
8
using namespace RTE ;
@@ -54,14 +54,14 @@ void MusicMan::Update() {
54
54
if (m_PreviousSoundContainerSetToFade && m_MusicFadeTimer.IsPastRealTimeLimit ()) {
55
55
m_PreviousSoundContainerSetToFade = false ;
56
56
if (m_PreviousSoundContainer) {
57
- // g_ConsoleMan.PrintString("MusicMan: Faded PreviousSoundContainer due to SetToFade.");
57
+ g_ConsoleMan.PrintString (" MusicMan: Faded PreviousSoundContainer due to SetToFade." );
58
58
const int musicFadeOutTimeMs = 250 ;
59
59
m_PreviousSoundContainer->FadeOut (musicFadeOutTimeMs);
60
60
}
61
61
}
62
62
}
63
63
if (m_PreviousSoundContainer && m_PreviousSoundContainer->GetAudibleVolume () == 0 .0F ) {
64
- // g_ConsoleMan.PrintString("MusicMan: Inaudible PreviousSoundContainer is about to be deleted: " + m_PreviousSoundContainer->GetPresetName());
64
+ g_ConsoleMan.PrintString (" MusicMan: Inaudible PreviousSoundContainer is about to be deleted: " + m_PreviousSoundContainer->GetPresetName ());
65
65
m_PreviousSoundContainer = nullptr ;
66
66
}
67
67
if (m_CurrentSoundContainer && m_CurrentSoundContainer->GetAudibleVolume () == 0 .0F ) {
@@ -108,7 +108,7 @@ bool MusicMan::PlayDynamicSong(const std::string& songName, const std::string& s
108
108
// If this isn't the case, then the MusicTimer's existing setup should make it play properly anyway, even if it's just instant
109
109
if (playImmediately) {
110
110
if (m_IsPlayingDynamicMusic) {
111
- // g_ConsoleMan.PrintString("MusicMan: Immediately played DynamicSong has stopped PreviousSoundContainer.");
111
+ g_ConsoleMan.PrintString (" MusicMan: Immediately played DynamicSong has stopped PreviousSoundContainer." );
112
112
if (m_PreviousSoundContainer) {
113
113
m_PreviousSoundContainer->Stop ();
114
114
m_PreviousSoundContainer = nullptr ;
@@ -125,13 +125,13 @@ bool MusicMan::PlayDynamicSong(const std::string& songName, const std::string& s
125
125
}
126
126
127
127
bool MusicMan::SetNextDynamicSongSection (const std::string& newSongSectionType, bool playImmediately, bool playTransition, bool smoothFade) {
128
- // g_ConsoleMan.PrintString("MusicMan: Attempting to set next DynamicSongSection...");
129
- // std::string currentDynamicSongSection = "None";
130
- // if (m_NextSongSection) {
131
- // currentDynamicSongSection = m_NextSongSection->GetPresetName();
132
- // }
133
- // g_ConsoleMan.PrintString("Current DynamicSongSection: " + currentDynamicSongSection);
134
- // g_ConsoleMan.PrintString("Desired new DynamicSongSection: " + newSongSectionType);
128
+ g_ConsoleMan.PrintString (" MusicMan: Attempting to set next DynamicSongSection..." );
129
+ std::string currentDynamicSongSection = " None" ;
130
+ if (m_NextSongSection) {
131
+ currentDynamicSongSection = m_NextSongSection->GetPresetName ();
132
+ }
133
+ g_ConsoleMan.PrintString (" Current DynamicSongSection: " + currentDynamicSongSection);
134
+ g_ConsoleMan.PrintString (" Desired new DynamicSongSection: " + newSongSectionType);
135
135
136
136
if (!m_IsPlayingDynamicMusic) {
137
137
return false ;
@@ -140,9 +140,9 @@ bool MusicMan::SetNextDynamicSongSection(const std::string& newSongSectionType,
140
140
SelectNextSongSection ();
141
141
SelectNextSoundContainer (playTransition);
142
142
if (playImmediately) {
143
- // g_ConsoleMan.PrintString("Playing new song section immediately!");
143
+ g_ConsoleMan.PrintString (" Playing new song section immediately!" );
144
144
if (m_PreviousSoundContainerSetToFade) {
145
- // g_ConsoleMan.PrintString("MusicMan: Immediately played new song section has stopped PreviousSoundContainer.");
145
+ g_ConsoleMan.PrintString (" MusicMan: Immediately played new song section has stopped PreviousSoundContainer." );
146
146
m_PreviousSoundContainerSetToFade = false ;
147
147
if (m_PreviousSoundContainer) {
148
148
m_PreviousSoundContainer->Stop ();
@@ -155,42 +155,43 @@ bool MusicMan::SetNextDynamicSongSection(const std::string& newSongSectionType,
155
155
}
156
156
157
157
bool MusicMan::CyclePlayingSoundContainers (bool smoothFade) {
158
- // g_ConsoleMan.PrintString("MusicMan: Cycling SoundContainers...");
158
+ g_ConsoleMan.PrintString (" MusicMan: Cycling SoundContainers..." );
159
159
std::string currentSoundContainer = " None" ;
160
160
if (m_CurrentSoundContainer) {
161
161
currentSoundContainer = m_CurrentSoundContainer->GetPresetName ();
162
162
}
163
- // g_ConsoleMan.PrintString("Current sound container: " + currentSoundContainer);
164
- // g_ConsoleMan.PrintString("Next sound container: " + m_NextSoundContainer->GetPresetName());
165
- // std::string previousSoundContainer = "None";
166
- // if (m_PreviousSoundContainer) {
167
- // previousSoundContainer = m_PreviousSoundContainer->GetPresetName();
168
- // }
169
- // g_ConsoleMan.PrintString("Previous sound container: " + previousSoundContainer);
163
+ g_ConsoleMan.PrintString (" Current sound container: " + currentSoundContainer);
164
+ g_ConsoleMan.PrintString (" Next sound container: " + m_NextSoundContainer->GetPresetName ());
165
+ std::string previousSoundContainer = " None" ;
166
+ if (m_PreviousSoundContainer) {
167
+ previousSoundContainer = m_PreviousSoundContainer->GetPresetName ();
168
+ }
169
+ g_ConsoleMan.PrintString (" Previous sound container: " + previousSoundContainer);
170
170
171
171
if (m_CurrentSoundContainer && m_CurrentSoundContainer->IsBeingPlayed ()) {
172
172
if (smoothFade) {
173
173
m_CurrentSoundContainer->FadeOut (static_cast <int >(m_NextSoundContainer->GetMusicPreEntryTime ()));
174
174
} else {
175
- // g_ConsoleMan.PrintString("No smoothFade means upcoming PreviousSoundContainer will be faded out at entry point.");
175
+ g_ConsoleMan.PrintString (" No smoothFade means upcoming PreviousSoundContainer will be faded out at entry point." );
176
176
m_PreviousSoundContainerSetToFade = true ;
177
177
m_MusicFadeTimer.Reset ();
178
178
m_MusicFadeTimer.SetRealTimeLimitMS (static_cast <int >(m_NextSoundContainer->GetMusicPreEntryTime ()));
179
179
}
180
180
if (m_PreviousSoundContainer) {
181
- // g_ConsoleMan.PrintString("Found unfaded PreviousSoundContainer. Stopping: " + m_PreviousSoundContainer->GetPresetName());
181
+ g_ConsoleMan.PrintString (" Found unfaded PreviousSoundContainer. Stopping: " + m_PreviousSoundContainer->GetPresetName ());
182
182
m_PreviousSoundContainer->Stop ();
183
183
m_PreviousSoundContainer = nullptr ;
184
184
}
185
185
m_PreviousSoundContainer = std::unique_ptr<SoundContainer>(m_CurrentSoundContainer.release ());
186
- // g_ConsoleMan.PrintString("Moved CurrentSoundContainer to PreviousSoundContainer while cycling, it is now: " + m_PreviousSoundContainer->GetPresetName());
186
+ g_ConsoleMan.PrintString (" Moved CurrentSoundContainer to PreviousSoundContainer while cycling, it is now: " + m_PreviousSoundContainer->GetPresetName ());
187
187
}
188
188
189
189
// Clone instead of just point to because we might wanna keep this around even if the DynamicSong is gone
190
190
m_CurrentSoundContainer = std::unique_ptr<SoundContainer>(dynamic_cast <SoundContainer*>(m_NextSoundContainer->Clone ()));
191
191
SelectNextSoundContainer ();
192
192
m_MusicTimer.Reset ();
193
- double timeUntilNextShouldBePlayed = m_CurrentSoundContainer->GetMusicExitTime () - m_NextSoundContainer->GetMusicPreEntryTime ();
193
+ double timeUntilNextShouldBePlayed = std::max (0 .0F , m_CurrentSoundContainer->GetMusicExitTime () - m_NextSoundContainer->GetMusicPreEntryTime ());
194
+ g_ConsoleMan.PrintString (" Time until next should be played:" + std::to_string (timeUntilNextShouldBePlayed));
194
195
m_MusicTimer.SetRealTimeLimitMS (timeUntilNextShouldBePlayed);
195
196
m_CurrentSoundContainer->Play ();
196
197
m_CurrentSongSectionType = m_NextSongSectionType;
0 commit comments