Fix source reset, specifically audio wasn't always updating the AL_LOOPING flag

This commit is contained in:
Bart van Strien
2013-06-30 17:29:55 +02:00
parent 2ad7562e6b
commit ad8e0da351
2 changed files with 7 additions and 15 deletions
+6 -14
View File
@@ -113,9 +113,6 @@ void Source::play()
}
valid = pool->play(this, source);
if (valid)
reset(source);
}
void Source::stop()
@@ -440,16 +437,10 @@ void Source::playAtomic()
alSourceQueueBuffers(source, usedBuffers, buffers);
}
// Set these properties. These may have changed while we've
// been without an AL source.
alSourcef(source, AL_PITCH, pitch);
alSourcef(source, AL_GAIN, volume);
alSourcef(source, AL_MIN_GAIN, minVolume);
alSourcef(source, AL_MAX_GAIN, maxVolume);
alSourcef(source, AL_REFERENCE_DISTANCE, referenceDistance);
alSourcef(source, AL_ROLLOFF_FACTOR, rolloffFactor);
alSourcef(source, AL_MAX_DISTANCE, maxDistance);
alSourcei(source, AL_LOOPING, isLooping() ? AL_TRUE : AL_FALSE);
// This Source may now be associated with an OpenAL source that still has
// the properties of another love Source. Let's reset it to the settings
// of the new one.
reset();
alSourcePlay(source);
@@ -531,7 +522,7 @@ void Source::rewindAtomic()
}
}
void Source::reset(ALenum source)
void Source::reset()
{
alSourcefv(source, AL_POSITION, position);
alSourcefv(source, AL_VELOCITY, velocity);
@@ -543,6 +534,7 @@ void Source::reset(ALenum source)
alSourcef(source, AL_REFERENCE_DISTANCE, referenceDistance);
alSourcef(source, AL_ROLLOFF_FACTOR, rolloffFactor);
alSourcef(source, AL_MAX_DISTANCE, maxDistance);
alSourcei(source, AL_LOOPING, isStatic() && isLooping() ? AL_TRUE : AL_FALSE);
}
void Source::setFloatv(float *dst, const float *src) const
+1 -1
View File
@@ -100,7 +100,7 @@ public:
private:
void reset(ALenum source);
void reset();
void setFloatv(float *dst, const float *src) const;