Skip to content

Commit bb6c033

Browse files
committed
even more temporary fix for rapid music switching, comment prints
1 parent 69095fe commit bb6c033

File tree

2 files changed

+27
-25
lines changed

2 files changed

+27
-25
lines changed

Data/Browncoats.rte/Activities/RefineryAssault.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ function RefineryAssault:StartActivity(newGame)
184184
SceneMan.Scene:AddNavigatableArea("Mission Stage Area 4");
185185

186186
self.musicGraceTimer = Timer();
187+
self.musicGraceTime = 4000;
187188

188189
if newGame then
189190

@@ -566,7 +567,8 @@ function RefineryAssault:UpdateActivity()
566567
if self.forcedGameIntensity then
567568
gameIntensity = self.forcedGameIntensity;
568569
end
569-
if self.saveTable.musicState ~= "Boss" and self.musicGraceTimer:IsPastRealMS(20000) then
570+
if self.saveTable.musicState ~= "Boss" and self.musicGraceTimer:IsPastRealMS(self.musicGraceTime) then
571+
self.musicGraceTimer:Reset();
570572
if gameIntensity > 0.67 then
571573
if self.saveTable.musicState ~= "Intense" then
572574
self.saveTable.musicState = "Intense";

Source/Managers/MusicMan.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include "NetworkClient.h"
44
#include "AudioMan.h"
5-
#include "ConsoleMan.h"
5+
//#include "ConsoleMan.h"
66
#include "PresetMan.h"
77

88
using namespace RTE;
@@ -54,14 +54,14 @@ void MusicMan::Update() {
5454
if (m_PreviousSoundContainerSetToFade && m_MusicFadeTimer.IsPastRealTimeLimit()) {
5555
m_PreviousSoundContainerSetToFade = false;
5656
if (m_PreviousSoundContainer) {
57-
g_ConsoleMan.PrintString("MusicMan: Faded PreviousSoundContainer due to SetToFade.");
57+
//g_ConsoleMan.PrintString("MusicMan: Faded PreviousSoundContainer due to SetToFade.");
5858
const int musicFadeOutTimeMs = 250;
5959
m_PreviousSoundContainer->FadeOut(musicFadeOutTimeMs);
6060
}
6161
}
6262
}
6363
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());
6565
m_PreviousSoundContainer = nullptr;
6666
}
6767
if (m_CurrentSoundContainer && m_CurrentSoundContainer->GetAudibleVolume() == 0.0F) {
@@ -108,7 +108,7 @@ bool MusicMan::PlayDynamicSong(const std::string& songName, const std::string& s
108108
// If this isn't the case, then the MusicTimer's existing setup should make it play properly anyway, even if it's just instant
109109
if (playImmediately) {
110110
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.");
112112
if (m_PreviousSoundContainer) {
113113
m_PreviousSoundContainer->Stop();
114114
m_PreviousSoundContainer = nullptr;
@@ -125,13 +125,13 @@ bool MusicMan::PlayDynamicSong(const std::string& songName, const std::string& s
125125
}
126126

127127
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);
135135

136136
if (!m_IsPlayingDynamicMusic) {
137137
return false;
@@ -140,9 +140,9 @@ bool MusicMan::SetNextDynamicSongSection(const std::string& newSongSectionType,
140140
SelectNextSongSection();
141141
SelectNextSoundContainer(playTransition);
142142
if (playImmediately) {
143-
g_ConsoleMan.PrintString("Playing new song section immediately!");
143+
//g_ConsoleMan.PrintString("Playing new song section immediately!");
144144
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.");
146146
m_PreviousSoundContainerSetToFade = false;
147147
m_PreviousSoundContainer->Stop();
148148
m_PreviousSoundContainer = nullptr;
@@ -153,35 +153,35 @@ bool MusicMan::SetNextDynamicSongSection(const std::string& newSongSectionType,
153153
}
154154

155155
bool MusicMan::CyclePlayingSoundContainers(bool smoothFade) {
156-
g_ConsoleMan.PrintString("MusicMan: Cycling SoundContainers...");
156+
//g_ConsoleMan.PrintString("MusicMan: Cycling SoundContainers...");
157157
std::string currentSoundContainer = "None";
158158
if (m_CurrentSoundContainer) {
159159
currentSoundContainer = m_CurrentSoundContainer->GetPresetName();
160160
}
161-
g_ConsoleMan.PrintString("Current sound container: " + currentSoundContainer);
162-
g_ConsoleMan.PrintString("Next sound container: " + m_NextSoundContainer->GetPresetName());
163-
std::string previousSoundContainer = "None";
164-
if (m_PreviousSoundContainer) {
165-
previousSoundContainer = m_PreviousSoundContainer->GetPresetName();
166-
}
167-
g_ConsoleMan.PrintString("Previous sound container: " + previousSoundContainer);
161+
//g_ConsoleMan.PrintString("Current sound container: " + currentSoundContainer);
162+
//g_ConsoleMan.PrintString("Next sound container: " + m_NextSoundContainer->GetPresetName());
163+
//std::string previousSoundContainer = "None";
164+
//if (m_PreviousSoundContainer) {
165+
// previousSoundContainer = m_PreviousSoundContainer->GetPresetName();
166+
//}
167+
//g_ConsoleMan.PrintString("Previous sound container: " + previousSoundContainer);
168168

169169
if (m_CurrentSoundContainer && m_CurrentSoundContainer->IsBeingPlayed()) {
170170
if (smoothFade) {
171171
m_CurrentSoundContainer->FadeOut(static_cast<int>(m_NextSoundContainer->GetMusicPreEntryTime()));
172172
} else {
173-
g_ConsoleMan.PrintString("No smoothFade means upcoming PreviousSoundContainer will be faded out at entry point.");
173+
//g_ConsoleMan.PrintString("No smoothFade means upcoming PreviousSoundContainer will be faded out at entry point.");
174174
m_PreviousSoundContainerSetToFade = true;
175175
m_MusicFadeTimer.Reset();
176176
m_MusicFadeTimer.SetRealTimeLimitMS(static_cast<int>(m_NextSoundContainer->GetMusicPreEntryTime()));
177177
}
178178
if (m_PreviousSoundContainer) {
179-
g_ConsoleMan.PrintString("Found unfaded PreviousSoundContainer. Stopping: " + m_PreviousSoundContainer->GetPresetName());
179+
//g_ConsoleMan.PrintString("Found unfaded PreviousSoundContainer. Stopping: " + m_PreviousSoundContainer->GetPresetName());
180180
m_PreviousSoundContainer->Stop();
181181
m_PreviousSoundContainer = nullptr;
182182
}
183183
m_PreviousSoundContainer = std::unique_ptr<SoundContainer>(m_CurrentSoundContainer.release());
184-
g_ConsoleMan.PrintString("Moved CurrentSoundContainer to PreviousSoundContainer while cycling, it is now: " + m_PreviousSoundContainer->GetPresetName());
184+
//g_ConsoleMan.PrintString("Moved CurrentSoundContainer to PreviousSoundContainer while cycling, it is now: " + m_PreviousSoundContainer->GetPresetName());
185185
}
186186

187187
// Clone instead of just point to because we might wanna keep this around even if the DynamicSong is gone

0 commit comments

Comments
 (0)