Added love.audio.set/getDopplerScale.

This commit is contained in:
Alex Szpakowski
2015-02-01 00:36:34 -04:00
parent ea2e45f4e2
commit 695ab41915
7 changed files with 45 additions and 0 deletions
+3
View File
@@ -185,6 +185,9 @@ public:
**/
virtual void setVelocity(float *v) = 0;
virtual void setDopplerScale(float scale) = 0;
virtual float getDopplerScale() const = 0;
/**
* Begins recording audio input from the microphone.
**/
+9
View File
@@ -132,6 +132,15 @@ void Audio::setVelocity(float *)
{
}
void Audio::setDopplerScale(float)
{
}
float Audio::getDopplerScale() const
{
return 1.0f;
}
void Audio::record()
{
}
+3
View File
@@ -67,6 +67,9 @@ public:
void getVelocity(float *v) const;
void setVelocity(float *v);
void setDopplerScale(float scale);
float getDopplerScale() const;
void record();
love::sound::SoundData *getRecordedData();
love::sound::SoundData *stopRecording(bool returnData);
+11
View File
@@ -256,6 +256,17 @@ void Audio::setVelocity(float *v)
alListenerfv(AL_VELOCITY, v);
}
void Audio::setDopplerScale(float scale)
{
if (scale >= 0.0f)
alDopplerFactor(scale);
}
float Audio::getDopplerScale() const
{
return alGetFloat(AL_DOPPLER_FACTOR);
}
void Audio::record()
{
if (!canRecord()) return;
+3
View File
@@ -85,6 +85,9 @@ public:
void getVelocity(float *v) const;
void setVelocity(float *v);
void setDopplerScale(float scale);
float getDopplerScale() const;
void record();
love::sound::SoundData *getRecordedData();
love::sound::SoundData *stopRecording(bool returnData);
+14
View File
@@ -218,6 +218,18 @@ int w_getVelocity(lua_State *L)
return 3;
}
int w_setDopplerScale(lua_State *L)
{
instance()->setDopplerScale(luax_checkfloat(L, 1));
return 0;
}
int w_getDopplerScale(lua_State *L)
{
lua_pushnumber(L, instance()->getDopplerScale());
return 1;
}
int w_record(lua_State *)
{
instance()->record();
@@ -299,6 +311,8 @@ static const luaL_Reg functions[] =
{ "getOrientation", w_getOrientation },
{ "setVelocity", w_setVelocity },
{ "getVelocity", w_getVelocity },
{ "setDopplerScale", w_setDopplerScale },
{ "getDopplerScale", w_getDopplerScale },
/*{ "record", w_record },
{ "getRecordedData", w_getRecordedData },
{ "stopRecording", w_stopRecording },*/
+2
View File
@@ -47,6 +47,8 @@ int w_setOrientation(lua_State *L);
int w_getOrientation(lua_State *L);
int w_setVelocity(lua_State *L);
int w_getVelocity(lua_State *L);
int w_setDopplerScale(lua_State *L);
int w_getDopplerScale(lua_State *L);
int w_record(lua_State *L);
int w_getRecordedData(lua_State *L);
int w_stopRecording(lua_State *L);