Commit 498f4624 authored by Gerhard Stein's avatar Gerhard Stein

Haltchannel fixes

parent 54ba75f2
......@@ -245,10 +245,12 @@ void Audio::stopSound(const GameSound snd)
{
if (snd_chnl->isPlaying())
{
CSoundSlot *pSlotToStop = mpAudioRessources->getSlotPtrAt(snd);
if( snd_chnl->getCurrentSoundPtr() == pSlotToStop )
snd_chnl->stopSound();
}
CSoundSlot *pSlotToStop = mpAudioRessources->getSlotPtrAt(snd);
if( snd_chnl->getCurrentSoundPtr() == pSlotToStop )
{
snd_chnl->stopSound();
}
}
}
}
......
......@@ -23,7 +23,6 @@ CSoundChannel(const SDL_AudioSpec &AudioSpec) :
m_AudioSpec(AudioSpec)
{
mId = mTotNumChannels;
stopSound();
mTotNumChannels++;
}
......@@ -32,7 +31,6 @@ CSoundChannel(const CSoundChannel &chnl)
{
*this = chnl;
mId = mTotNumChannels;
stopSound();
mTotNumChannels++;
}
......@@ -41,8 +39,6 @@ CSoundChannel::
{
mTotNumChannels--;
stopSound();
if(mTotNumChannels < 0)
{
assert(0);
......@@ -59,7 +55,10 @@ stopSound()
mSoundPaused = true;
mSoundPlaying = false;
Mix_HaltChannel(mId);
if(Mix_Playing(mId))
{
Mix_HaltChannel(mId);
}
}
void CSoundChannel::setupSound( CSoundSlot &SndSlottoPlay,
......
......@@ -84,11 +84,11 @@ public:
private:
bool mSoundPlaying; // true = a sound is currently playing
CSoundSlot *mpCurrentSndSlot = nullptr; // Pointer to the slot of the currently playing sound
Uint32 mSoundPtr; // position within sound that we're at
bool mSoundPaused; // true = pause playback
bool mSoundForced;
Uint32 mSoundPtr = 0; // position within sound that we're at
bool mSoundPaused = true; // true = pause playback
bool mSoundForced = false;
short mBalance; // This variable is used for stereo sound, and to calculate where the sound must be played!
short mBalance = 0; // This variable is used for stereo sound, and to calculate where the sound must be played!
SDL_AudioSpec m_AudioSpec;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment