mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Source:play now returns false if alSourcePlay failed
This commit is contained in:
@@ -161,9 +161,7 @@ bool Pool::play(Source *source, ALuint &out)
|
||||
|
||||
source->retain();
|
||||
|
||||
source->playAtomic();
|
||||
|
||||
ok = true;
|
||||
ok = source->playAtomic();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -513,7 +513,7 @@ bool Source::isLooping() const
|
||||
return looping;
|
||||
}
|
||||
|
||||
void Source::playAtomic()
|
||||
bool Source::playAtomic()
|
||||
{
|
||||
if (type == TYPE_STATIC)
|
||||
{
|
||||
@@ -540,10 +540,19 @@ void Source::playAtomic()
|
||||
// of the new one.
|
||||
reset();
|
||||
|
||||
// Clear errors.
|
||||
alGetError();
|
||||
|
||||
alSourcePlay(source);
|
||||
|
||||
// alSourcePlay may fail if the system has reached its limit of simultaneous
|
||||
// playing sources.
|
||||
bool success = alGetError() == AL_NO_ERROR;
|
||||
|
||||
valid = true; //if it fails it will be set to false again
|
||||
//but this prevents a horrible, horrible bug
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void Source::stopAtomic()
|
||||
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
virtual float getMaxDistance() const;
|
||||
virtual int getChannels() const;
|
||||
|
||||
void playAtomic();
|
||||
bool playAtomic();
|
||||
void stopAtomic();
|
||||
void pauseAtomic();
|
||||
void resumeAtomic();
|
||||
|
||||
Reference in New Issue
Block a user