mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Rename love.audio.getEffectsList and Source:getEffectsList to getActiveEffects. They now return an empty table instead of nil when there are no active effects, as well.
--HG-- branch : minor
This commit is contained in:
@@ -236,7 +236,7 @@ public:
|
||||
* @param list List of EFX names to fill.
|
||||
* @return true if effect was present, false otherwise.
|
||||
*/
|
||||
virtual bool getEffectsList(std::vector<std::string> &list) = 0;
|
||||
virtual bool getActiveEffects(std::vector<std::string> &list) const = 0;
|
||||
|
||||
/**
|
||||
* Gets maximum number of scene EFX effects.
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
virtual bool setEffect(const char *effect, const std::map<Filter::Parameter, float> ¶ms) = 0;
|
||||
virtual bool unsetEffect(const char *effect) = 0;
|
||||
virtual bool getEffect(const char *effect, std::map<Filter::Parameter, float> ¶ms) = 0;
|
||||
virtual bool getEffectsList(std::vector<std::string> &list) = 0;
|
||||
virtual bool getActiveEffects(std::vector<std::string> &list) const = 0;
|
||||
|
||||
virtual int getFreeBufferCount() const = 0;
|
||||
virtual bool queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels) = 0;
|
||||
|
||||
@@ -183,7 +183,7 @@ bool Audio::getEffect(const char *, std::map<Effect::Parameter, float> &)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Audio::getEffectsList(std::vector<std::string> &list)
|
||||
bool Audio::getActiveEffects(std::vector<std::string> &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
bool setEffect(const char *, std::map<Effect::Parameter, float> ¶ms);
|
||||
bool unsetEffect(const char *);
|
||||
bool getEffect(const char *, std::map<Effect::Parameter, float> ¶ms);
|
||||
bool getEffectsList(std::vector<std::string> &list);
|
||||
bool getActiveEffects(std::vector<std::string> &list) const;
|
||||
int getMaxSceneEffects() const;
|
||||
int getMaxSourceEffects() const;
|
||||
bool isEFXsupported() const;
|
||||
|
||||
@@ -274,7 +274,7 @@ bool Source::getEffect(const char *, std::map<Filter::Parameter, float> &)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Source::getEffectsList(std::vector<std::string> &)
|
||||
bool Source::getActiveEffects(std::vector<std::string> &) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
virtual bool setEffect(const char *effect, const std::map<Filter::Parameter, float> ¶ms);
|
||||
virtual bool unsetEffect(const char *effect);
|
||||
virtual bool getEffect(const char *effect, std::map<Filter::Parameter, float> ¶ms);
|
||||
virtual bool getEffectsList(std::vector<std::string> &list);
|
||||
virtual bool getActiveEffects(std::vector<std::string> &list) const;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -543,7 +543,7 @@ bool Audio::getEffect(const char *name, std::map<Effect::Parameter, float> ¶
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Audio::getEffectsList(std::vector<std::string> &list)
|
||||
bool Audio::getActiveEffects(std::vector<std::string> &list) const
|
||||
{
|
||||
if (effectmap.empty())
|
||||
return false;
|
||||
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
bool setEffect(const char *name, std::map<Effect::Parameter, float> ¶ms);
|
||||
bool unsetEffect(const char *name);
|
||||
bool getEffect(const char *name, std::map<Effect::Parameter, float> ¶ms);
|
||||
bool getEffectsList(std::vector<std::string> &list);
|
||||
bool getActiveEffects(std::vector<std::string> &list) const;
|
||||
int getMaxSceneEffects() const;
|
||||
int getMaxSourceEffects() const;
|
||||
bool isEFXsupported() const;
|
||||
|
||||
@@ -1488,7 +1488,7 @@ bool Source::getEffect(const char *name, std::map<Filter::Parameter, float> &par
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Source::getEffectsList(std::vector<std::string> &list)
|
||||
bool Source::getActiveEffects(std::vector<std::string> &list) const
|
||||
{
|
||||
if (effectmap.empty())
|
||||
return false;
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
virtual bool setEffect(const char *effect, const std::map<Filter::Parameter, float> ¶ms);
|
||||
virtual bool unsetEffect(const char *effect);
|
||||
virtual bool getEffect(const char *effect, std::map<Filter::Parameter, float> ¶ms);
|
||||
virtual bool getEffectsList(std::vector<std::string> &list);
|
||||
virtual bool getActiveEffects(std::vector<std::string> &list) const;
|
||||
|
||||
virtual int getFreeBufferCount() const;
|
||||
virtual bool queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels);
|
||||
|
||||
@@ -488,14 +488,13 @@ int w_getEffect(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_getEffectsList(lua_State *L)
|
||||
int w_getActiveEffects(lua_State *L)
|
||||
{
|
||||
std::vector<std::string> list;
|
||||
if (!instance()->getEffectsList(list))
|
||||
return 0;
|
||||
instance()->getActiveEffects(list);
|
||||
|
||||
lua_createtable(L, 0, list.size());
|
||||
for (unsigned int i = 0; i < list.size(); i++)
|
||||
lua_createtable(L, 0, (int) list.size());
|
||||
for (int i = 0; i < (int) list.size(); i++)
|
||||
{
|
||||
lua_pushnumber(L, i + 1);
|
||||
lua_pushstring(L, list[i].c_str());
|
||||
@@ -559,7 +558,7 @@ static const luaL_Reg functions[] =
|
||||
{ "getRecordingDevices", w_getRecordingDevices },
|
||||
{ "setEffect", w_setEffect },
|
||||
{ "getEffect", w_getEffect },
|
||||
{ "getEffectsList", w_getEffectsList },
|
||||
{ "getActiveEffects", w_getActiveEffects },
|
||||
{ "getMaxSceneEffects", w_getMaxSceneEffects },
|
||||
{ "getMaxSourceEffects", w_getMaxSourceEffects },
|
||||
{ "isEffectsSupported", w_isEffectsSupported },
|
||||
|
||||
@@ -493,15 +493,15 @@ int w_Source_getEffect(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_Source_getEffectsList(lua_State *L)
|
||||
int w_Source_getActiveEffects(lua_State *L)
|
||||
{
|
||||
Source *t = luax_checksource(L, 1);
|
||||
std::vector<std::string> list;
|
||||
if (!t->getEffectsList(list))
|
||||
return 0;
|
||||
|
||||
lua_createtable(L, 0, list.size());
|
||||
for (unsigned int i = 0; i < list.size(); i++)
|
||||
std::vector<std::string> list;
|
||||
t->getActiveEffects(list);
|
||||
|
||||
lua_createtable(L, 0, (int) list.size());
|
||||
for (int i = 0; i < (int) list.size(); i++)
|
||||
{
|
||||
lua_pushnumber(L, i + 1);
|
||||
lua_pushstring(L, list[i].c_str());
|
||||
@@ -624,7 +624,7 @@ static const luaL_Reg w_Source_functions[] =
|
||||
{ "getFilter", w_Source_getFilter },
|
||||
{ "setEffect", w_Source_setEffect },
|
||||
{ "getEffect", w_Source_getEffect },
|
||||
{ "getEffectsList", w_Source_getEffectsList },
|
||||
{ "getActiveEffects", w_Source_getActiveEffects },
|
||||
|
||||
{ "getFreeBufferCount", w_Source_getFreeBufferCount },
|
||||
{ "queue", w_Source_queue },
|
||||
|
||||
Reference in New Issue
Block a user