1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-15 13:33:36 +02:00

lower background music while campaign audio plays

This commit is contained in:
Laserlicht 2024-10-14 20:47:06 +02:00
parent 604e3b5c67
commit cb6fa74cc4

View File

@ -48,6 +48,7 @@ CPrologEpilogVideo::CPrologEpilogVideo(CampaignScenarioPrologEpilog _spe, std::f
if (videoPlayer->pos.h == 400)
videoPlayer->moveBy(Point(0, 100));
CCS->musich->setVolume(CCS->musich->getVolume() / 2); // background volume is too loud by default
CCS->musich->playMusic(spe.prologMusic, true, true);
voiceDurationMilliseconds = CCS->soundh->getSoundDurationMilliseconds(spe.prologVoice);
voiceSoundHandle = CCS->soundh->playSound(spe.prologVoice);
@ -88,6 +89,7 @@ void CPrologEpilogVideo::show(Canvas & to)
void CPrologEpilogVideo::clickPressed(const Point & cursorPosition)
{
CCS->musich->setVolume(CCS->musich->getVolume() * 2); // restore background volume
close();
CCS->soundh->resetCallback(voiceSoundHandle); // reset callback to avoid memory corruption since 'this' will be destroyed
CCS->soundh->stopSound(voiceSoundHandle);