mirror of
https://github.com/love2d/love.git
synced 2026-08-20 20:49:54 +02:00
Add source:isPaused() (enhancement #141)
This commit is contained in:
@@ -55,6 +55,7 @@ namespace audio
|
|||||||
virtual void resume() = 0;
|
virtual void resume() = 0;
|
||||||
virtual void rewind() = 0;
|
virtual void rewind() = 0;
|
||||||
virtual bool isStopped() const = 0;
|
virtual bool isStopped() const = 0;
|
||||||
|
virtual bool isPaused() const = 0;
|
||||||
virtual bool isFinished() const = 0;
|
virtual bool isFinished() const = 0;
|
||||||
virtual void update() = 0;
|
virtual void update() = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,11 @@ namespace null
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Source::isPaused() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Source::isFinished() const
|
bool Source::isFinished() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ namespace null
|
|||||||
virtual void resume();
|
virtual void resume();
|
||||||
virtual void rewind();
|
virtual void rewind();
|
||||||
virtual bool isStopped() const;
|
virtual bool isStopped() const;
|
||||||
|
virtual bool isPaused() const;
|
||||||
virtual bool isFinished() const;
|
virtual bool isFinished() const;
|
||||||
virtual void update();
|
virtual void update();
|
||||||
virtual void setPitch(float pitch);
|
virtual void setPitch(float pitch);
|
||||||
|
|||||||
@@ -112,6 +112,18 @@ namespace openal
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Source::isPaused() const
|
||||||
|
{
|
||||||
|
if(valid)
|
||||||
|
{
|
||||||
|
ALenum state;
|
||||||
|
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
||||||
|
return (state == AL_PAUSED);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool Source::isFinished() const
|
bool Source::isFinished() const
|
||||||
{
|
{
|
||||||
return type == TYPE_STATIC ? isStopped() : isStopped() && !isLooping() && decoder->isFinished();
|
return type == TYPE_STATIC ? isStopped() : isStopped() && !isLooping() && decoder->isFinished();
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ namespace openal
|
|||||||
virtual void resume();
|
virtual void resume();
|
||||||
virtual void rewind();
|
virtual void rewind();
|
||||||
virtual bool isStopped() const;
|
virtual bool isStopped() const;
|
||||||
|
virtual bool isPaused() const;
|
||||||
virtual bool isFinished() const;
|
virtual bool isFinished() const;
|
||||||
virtual void update();
|
virtual void update();
|
||||||
virtual void setPitch(float pitch);
|
virtual void setPitch(float pitch);
|
||||||
|
|||||||
@@ -181,6 +181,13 @@ namespace audio
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int w_Source_isPaused(lua_State * L)
|
||||||
|
{
|
||||||
|
Source * t = luax_checksource(L, 1);
|
||||||
|
luax_pushboolean(L, t->isPaused());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int w_Source_isStatic(lua_State * L)
|
int w_Source_isStatic(lua_State * L)
|
||||||
{
|
{
|
||||||
Source * t= luax_checksource(L, 1);
|
Source * t= luax_checksource(L, 1);
|
||||||
@@ -209,6 +216,7 @@ namespace audio
|
|||||||
{ "setLooping", w_Source_setLooping },
|
{ "setLooping", w_Source_setLooping },
|
||||||
{ "isLooping", w_Source_isLooping },
|
{ "isLooping", w_Source_isLooping },
|
||||||
{ "isStopped", w_Source_isStopped },
|
{ "isStopped", w_Source_isStopped },
|
||||||
|
{ "isPaused", w_Source_isPaused },
|
||||||
{ "isStatic", w_Source_isStatic },
|
{ "isStatic", w_Source_isStatic },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ namespace audio
|
|||||||
int w_Source_setLooping(lua_State * L);
|
int w_Source_setLooping(lua_State * L);
|
||||||
int w_Source_isLooping(lua_State * L);
|
int w_Source_isLooping(lua_State * L);
|
||||||
int w_Source_isStopped(lua_State * L);
|
int w_Source_isStopped(lua_State * L);
|
||||||
|
int w_Source_isPaused(lua_State * L);
|
||||||
int w_Source_isStatic(lua_State * L);
|
int w_Source_isStatic(lua_State * L);
|
||||||
int luaopen_source(lua_State * L);
|
int luaopen_source(lua_State * L);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user