mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Added love.audio.set/getDopplerScale.
This commit is contained in:
@@ -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.
|
||||
**/
|
||||
|
||||
@@ -132,6 +132,15 @@ void Audio::setVelocity(float *)
|
||||
{
|
||||
}
|
||||
|
||||
void Audio::setDopplerScale(float)
|
||||
{
|
||||
}
|
||||
|
||||
float Audio::getDopplerScale() const
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
void Audio::record()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 },*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user