Browse Source

Rename love.audio.getSourceCount to getActiveSourceCount and deprecate the old function (resolves issue #1302).

--HG--
branch : minor
Alex Szpakowski 8 years ago
parent
commit
3128a127cf

+ 1 - 1
src/modules/audio/Audio.h

@@ -83,7 +83,7 @@ public:
 	 * Gets the current number of simultaneous playing sources.
 	 * Gets the current number of simultaneous playing sources.
 	 * @return The current number of simultaneous playing sources.
 	 * @return The current number of simultaneous playing sources.
 	 **/
 	 **/
-	virtual int getSourceCount() const = 0;
+	virtual int getActiveSourceCount() const = 0;
 
 
 	/**
 	/**
 	 * Gets the maximum supported number of simultaneous playing sources.
 	 * Gets the maximum supported number of simultaneous playing sources.

+ 1 - 1
src/modules/audio/null/Audio.cpp

@@ -56,7 +56,7 @@ love::audio::Source *Audio::newSource(int, int, int, int)
 	return new Source();
 	return new Source();
 }
 }
 
 
-int Audio::getSourceCount() const
+int Audio::getActiveSourceCount() const
 {
 {
 	return 0;
 	return 0;
 }
 }

+ 1 - 1
src/modules/audio/null/Audio.h

@@ -48,7 +48,7 @@ public:
 	love::audio::Source *newSource(love::sound::Decoder *decoder);
 	love::audio::Source *newSource(love::sound::Decoder *decoder);
 	love::audio::Source *newSource(love::sound::SoundData *soundData);
 	love::audio::Source *newSource(love::sound::SoundData *soundData);
 	love::audio::Source *newSource(int sampleRate, int bitDepth, int channels, int buffers);
 	love::audio::Source *newSource(int sampleRate, int bitDepth, int channels, int buffers);
-	int getSourceCount() const;
+	int getActiveSourceCount() const;
 	int getMaxSources() const;
 	int getMaxSources() const;
 	bool play(love::audio::Source *source);
 	bool play(love::audio::Source *source);
 	bool play(const std::vector<love::audio::Source*> &sources);
 	bool play(const std::vector<love::audio::Source*> &sources);

+ 2 - 2
src/modules/audio/openal/Audio.cpp

@@ -234,9 +234,9 @@ love::audio::Source *Audio::newSource(int sampleRate, int bitDepth, int channels
 	return new Source(pool, sampleRate, bitDepth, channels, buffers);
 	return new Source(pool, sampleRate, bitDepth, channels, buffers);
 }
 }
 
 
-int Audio::getSourceCount() const
+int Audio::getActiveSourceCount() const
 {
 {
-	return pool->getSourceCount();
+	return pool->getActiveSourceCount();
 }
 }
 
 
 int Audio::getMaxSources() const
 int Audio::getMaxSources() const

+ 1 - 1
src/modules/audio/openal/Audio.h

@@ -85,7 +85,7 @@ public:
 	love::audio::Source *newSource(love::sound::Decoder *decoder);
 	love::audio::Source *newSource(love::sound::Decoder *decoder);
 	love::audio::Source *newSource(love::sound::SoundData *soundData);
 	love::audio::Source *newSource(love::sound::SoundData *soundData);
 	love::audio::Source *newSource(int sampleRate, int bitDepth, int channels, int buffers);
 	love::audio::Source *newSource(int sampleRate, int bitDepth, int channels, int buffers);
-	int getSourceCount() const;
+	int getActiveSourceCount() const;
 	int getMaxSources() const;
 	int getMaxSources() const;
 	bool play(love::audio::Source *source);
 	bool play(love::audio::Source *source);
 	bool play(const std::vector<love::audio::Source*> &sources);
 	bool play(const std::vector<love::audio::Source*> &sources);

+ 1 - 1
src/modules/audio/openal/Pool.cpp

@@ -115,7 +115,7 @@ void Pool::update()
 		releaseSource(s);
 		releaseSource(s);
 }
 }
 
 
-int Pool::getSourceCount() const
+int Pool::getActiveSourceCount() const
 {
 {
 	return (int) playing.size();
 	return (int) playing.size();
 }
 }

+ 1 - 1
src/modules/audio/openal/Pool.h

@@ -80,7 +80,7 @@ public:
 
 
 	void update();
 	void update();
 
 
-	int getSourceCount() const;
+	int getActiveSourceCount() const;
 	int getMaxSources() const;
 	int getMaxSources() const;
 
 
 private:
 private:

+ 13 - 3
src/modules/audio/wrap_Audio.cpp

@@ -37,9 +37,9 @@ namespace audio
 
 
 #define instance() (Module::getInstance<Audio>(Module::M_AUDIO))
 #define instance() (Module::getInstance<Audio>(Module::M_AUDIO))
 
 
-int w_getSourceCount(lua_State *L)
+int w_getActiveSourceCount(lua_State *L)
 {
 {
-	lua_pushinteger(L, instance()->getSourceCount());
+	lua_pushinteger(L, instance()->getActiveSourceCount());
 	return 1;
 	return 1;
 }
 }
 
 
@@ -524,10 +524,16 @@ int w_setMixWithSystem(lua_State *L)
 	return 1;
 	return 1;
 }
 }
 
 
+int w_getSourceCount(lua_State *L)
+{
+	luax_markdeprecated(L, "love.audio.getSourceCount", DEPRECATED_RENAMED, "love.audio.getActiveSourceCount");
+	return w_getActiveSourceCount(L);
+}
+
 // List of functions to wrap.
 // List of functions to wrap.
 static const luaL_Reg functions[] =
 static const luaL_Reg functions[] =
 {
 {
-	{ "getSourceCount", w_getSourceCount },
+	{ "getActiveSourceCount", w_getActiveSourceCount },
 	{ "newSource", w_newSource },
 	{ "newSource", w_newSource },
 	{ "newQueueableSource", w_newQueueableSource },
 	{ "newQueueableSource", w_newQueueableSource },
 	{ "play", w_play },
 	{ "play", w_play },
@@ -555,6 +561,10 @@ static const luaL_Reg functions[] =
 	{ "getMaxSourceEffects", w_getMaxSourceEffects },
 	{ "getMaxSourceEffects", w_getMaxSourceEffects },
 	{ "isEffectsSupported", w_isEffectsSupported },
 	{ "isEffectsSupported", w_isEffectsSupported },
 	{ "setMixWithSystem", w_setMixWithSystem },
 	{ "setMixWithSystem", w_setMixWithSystem },
+
+	// Deprecated
+	{ "getSourceCount", w_getSourceCount },
+
 	{ 0, 0 }
 	{ 0, 0 }
 };
 };