- 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; extern bool nosound;
inline bool MusicEnabled() inline bool MusicEnabled()
{ {
return !nomusic; return mus_enabled && !nomusic;
} }
inline bool SoundEnabled() inline bool SoundEnabled()

View file

@ -110,10 +110,10 @@ static bool StreamCallbackFunc(SoundStream* stream, void* buff, int len, void* u
return true; return true;
} }
InterplayDecoder::InterplayDecoder() InterplayDecoder::InterplayDecoder(bool soundenabled)
{ {
bIsPlaying = false; bIsPlaying = false;
bAudioStarted = false; bAudioStarted = !soundenabled; // This prevents the stream from getting created
nWidth = 0; nWidth = 0;
nHeight = 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. kAudioBlocks = 20 // alloc a lot of blocks - need to store lots of audio data before video frames start.
}; };
InterplayDecoder(); InterplayDecoder(bool soundenabled);
~InterplayDecoder(); ~InterplayDecoder();
bool Open(FileReader &fr); bool Open(FileReader &fr);

View file

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