Add source:isPaused() (enhancement #141)

This commit is contained in:
Bart van Strien
2010-12-19 12:30:59 +01:00
parent acf94d0d6d
commit 9856fbc705
7 changed files with 31 additions and 2 deletions
+1
View File
@@ -55,6 +55,7 @@ namespace audio
virtual void resume() = 0;
virtual void rewind() = 0;
virtual bool isStopped() const = 0;
virtual bool isPaused() const = 0;
virtual bool isFinished() const = 0;
virtual void update() = 0;
+5
View File
@@ -67,6 +67,11 @@ namespace null
return true;
}
bool Source::isPaused() const
{
return false;
}
bool Source::isFinished() const
{
return true;
+1
View File
@@ -50,6 +50,7 @@ namespace null
virtual void resume();
virtual void rewind();
virtual bool isStopped() const;
virtual bool isPaused() const;
virtual bool isFinished() const;
virtual void update();
virtual void setPitch(float pitch);
+12
View File
@@ -112,6 +112,18 @@ namespace openal
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
{
return type == TYPE_STATIC ? isStopped() : isStopped() && !isLooping() && decoder->isFinished();
+2 -1
View File
@@ -76,7 +76,8 @@ namespace openal
virtual void pause();
virtual void resume();
virtual void rewind();
virtual bool isStopped() const;
virtual bool isStopped() const;
virtual bool isPaused() const;
virtual bool isFinished() const;
virtual void update();
virtual void setPitch(float pitch);
+9 -1
View File
@@ -181,6 +181,13 @@ namespace audio
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)
{
Source * t= luax_checksource(L, 1);
@@ -205,10 +212,11 @@ namespace audio
{ "getVelocity", w_Source_getVelocity },
{ "setDirection", w_Source_setDirection },
{ "getDirection", w_Source_getDirection },
{ "setLooping", w_Source_setLooping },
{ "isLooping", w_Source_isLooping },
{ "isStopped", w_Source_isStopped },
{ "isPaused", w_Source_isPaused },
{ "isStatic", w_Source_isStatic },
{ 0, 0 }
};
+1
View File
@@ -47,6 +47,7 @@ namespace audio
int w_Source_setLooping(lua_State * L);
int w_Source_isLooping(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 luaopen_source(lua_State * L);