1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-08 22:26:51 +02:00

Merge pull request #4777 from Laserlicht/backround_voice

fix: lower background music while campaign audio plays
This commit is contained in:
Ivan Savenko
2024-10-15 18:01:17 +03:00
committed by GitHub

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