- let all video players respect the SoundEnabled setting.

Fixes #164.
This commit is contained in:
Christoph Oelckers 2020-08-11 19:52:54 +02:00
parent e083f78f8e
commit 85364c2bb6
4 changed files with 6 additions and 6 deletions

View file

@ -82,7 +82,7 @@ extern int nomusic;
extern bool nosound;
inline bool MusicEnabled()
{
return !nomusic;
return mus_enabled && !nomusic;
}
inline bool SoundEnabled()

View file

@ -110,10 +110,10 @@ static bool StreamCallbackFunc(SoundStream* stream, void* buff, int len, void* u
return true;
}
InterplayDecoder::InterplayDecoder()
InterplayDecoder::InterplayDecoder(bool soundenabled)
{
bIsPlaying = false;
bAudioStarted = false;
bAudioStarted = !soundenabled; // This prevents the stream from getting created
nWidth = 0;
nHeight = 0;

View file

@ -98,7 +98,7 @@ public:
kAudioBlocks = 20 // alloc a lot of blocks - need to store lots of audio data before video frames start.
};
InterplayDecoder();
InterplayDecoder(bool soundenabled);
~InterplayDecoder();
bool Open(FileReader &fr);

View file

@ -194,7 +194,7 @@ class DMvePlayer : public DScreenJob
public:
bool isvalid() { return !failed; }
DMvePlayer(FileReader& fr)
DMvePlayer(FileReader& fr) : decoder(SoundEnabled())
{
failed = !decoder.Open(fr);
}
@ -302,7 +302,7 @@ public:
int sound = animSnd[i].soundnum;
if (sound == -1)
soundEngine->StopAllChannels();
else
else if (SoundEnabled())
soundEngine->StartSound(SOURCE_None, nullptr, nullptr, CHAN_AUTO, CHANF_UI, sound, 1.f, ATTN_NONE);
}
}