mirror of
https://github.com/love2d/love.git
synced 2026-08-20 12:40:20 +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->retain();
|
||||||
|
|
||||||
source->playAtomic();
|
ok = source->playAtomic();
|
||||||
|
|
||||||
ok = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -513,7 +513,7 @@ bool Source::isLooping() const
|
|||||||
return looping;
|
return looping;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Source::playAtomic()
|
bool Source::playAtomic()
|
||||||
{
|
{
|
||||||
if (type == TYPE_STATIC)
|
if (type == TYPE_STATIC)
|
||||||
{
|
{
|
||||||
@@ -540,10 +540,19 @@ void Source::playAtomic()
|
|||||||
// of the new one.
|
// of the new one.
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
|
// Clear errors.
|
||||||
|
alGetError();
|
||||||
|
|
||||||
alSourcePlay(source);
|
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
|
valid = true; //if it fails it will be set to false again
|
||||||
//but this prevents a horrible, horrible bug
|
//but this prevents a horrible, horrible bug
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Source::stopAtomic()
|
void Source::stopAtomic()
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public:
|
|||||||
virtual float getMaxDistance() const;
|
virtual float getMaxDistance() const;
|
||||||
virtual int getChannels() const;
|
virtual int getChannels() const;
|
||||||
|
|
||||||
void playAtomic();
|
bool playAtomic();
|
||||||
void stopAtomic();
|
void stopAtomic();
|
||||||
void pauseAtomic();
|
void pauseAtomic();
|
||||||
void resumeAtomic();
|
void resumeAtomic();
|
||||||
|
|||||||
Reference in New Issue
Block a user