mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Rename Source/SoundData/Decoder:getChannels to getChannelCount (resolves issue #1307). Deprecate the old methods rather than completely removing them.
--HG-- branch : minor
This commit is contained in:
@@ -94,7 +94,7 @@ public:
|
||||
/**
|
||||
* @return Number of channels for recording.
|
||||
**/
|
||||
virtual int getChannels() const = 0;
|
||||
virtual int getChannelCount() const = 0;
|
||||
|
||||
/**
|
||||
* @return True if currently recording.
|
||||
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
virtual void setAirAbsorptionFactor(float factor) = 0;
|
||||
virtual float getAirAbsorptionFactor() const = 0;
|
||||
|
||||
virtual int getChannels() const = 0;
|
||||
virtual int getChannelCount() const = 0;
|
||||
|
||||
virtual bool setFilter(const std::map<Filter::Parameter, float> ¶ms) = 0;
|
||||
virtual bool setFilter() = 0;
|
||||
|
||||
@@ -72,7 +72,7 @@ int RecordingDevice::getBitDepth() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RecordingDevice::getChannels() const
|
||||
int RecordingDevice::getChannelCount() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
virtual int getSampleCount() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual int getBitDepth() const;
|
||||
virtual int getChannels() const;
|
||||
virtual int getChannelCount() const;
|
||||
virtual bool isRecording() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -224,7 +224,7 @@ float Source::getAirAbsorptionFactor() const
|
||||
return absorptionFactor;
|
||||
}
|
||||
|
||||
int Source::getChannels() const
|
||||
int Source::getChannelCount() const
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
virtual float getMaxDistance() const;
|
||||
virtual void setAirAbsorptionFactor(float factor);
|
||||
virtual float getAirAbsorptionFactor() const;
|
||||
virtual int getChannels() const;
|
||||
virtual int getChannelCount() const;
|
||||
|
||||
virtual int getFreeBufferCount() const;
|
||||
virtual bool queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels);
|
||||
|
||||
@@ -132,7 +132,7 @@ int RecordingDevice::getBitDepth() const
|
||||
return bitDepth;
|
||||
}
|
||||
|
||||
int RecordingDevice::getChannels() const
|
||||
int RecordingDevice::getChannelCount() const
|
||||
{
|
||||
return channels;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
virtual int getMaxSamples() const;
|
||||
virtual int getSampleRate() const;
|
||||
virtual int getBitDepth() const;
|
||||
virtual int getChannels() const;
|
||||
virtual int getChannelCount() const;
|
||||
virtual bool isRecording() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -122,12 +122,12 @@ Source::Source(Pool *pool, love::sound::SoundData *soundData)
|
||||
: love::audio::Source(Source::TYPE_STATIC)
|
||||
, pool(pool)
|
||||
, sampleRate(soundData->getSampleRate())
|
||||
, channels(soundData->getChannels())
|
||||
, channels(soundData->getChannelCount())
|
||||
, bitDepth(soundData->getBitDepth())
|
||||
{
|
||||
ALenum fmt = Audio::getFormat(soundData->getBitDepth(), soundData->getChannels());
|
||||
ALenum fmt = Audio::getFormat(soundData->getBitDepth(), soundData->getChannelCount());
|
||||
if (fmt == AL_NONE)
|
||||
throw InvalidFormatException(soundData->getChannels(), soundData->getBitDepth());
|
||||
throw InvalidFormatException(soundData->getChannelCount(), soundData->getBitDepth());
|
||||
|
||||
staticBuffer.set(new StaticDataBuffer(fmt, soundData->getData(), (ALsizei) soundData->getSize(), sampleRate), Acquire::NORETAIN);
|
||||
|
||||
@@ -145,13 +145,13 @@ Source::Source(Pool *pool, love::sound::Decoder *decoder)
|
||||
: love::audio::Source(Source::TYPE_STREAM)
|
||||
, pool(pool)
|
||||
, sampleRate(decoder->getSampleRate())
|
||||
, channels(decoder->getChannels())
|
||||
, channels(decoder->getChannelCount())
|
||||
, bitDepth(decoder->getBitDepth())
|
||||
, decoder(decoder)
|
||||
, buffers(DEFAULT_BUFFERS)
|
||||
{
|
||||
if (Audio::getFormat(decoder->getBitDepth(), decoder->getChannels()) == AL_NONE)
|
||||
throw InvalidFormatException(decoder->getChannels(), decoder->getBitDepth());
|
||||
if (Audio::getFormat(decoder->getBitDepth(), decoder->getChannelCount()) == AL_NONE)
|
||||
throw InvalidFormatException(decoder->getChannelCount(), decoder->getBitDepth());
|
||||
|
||||
for (int i = 0; i < buffers; i++)
|
||||
{
|
||||
@@ -1138,7 +1138,7 @@ int Source::streamAtomic(ALuint buffer, love::sound::Decoder *d)
|
||||
// OpenAL implementations are allowed to ignore 0-size alBufferData calls.
|
||||
if (decoded > 0)
|
||||
{
|
||||
int fmt = Audio::getFormat(d->getBitDepth(), d->getChannels());
|
||||
int fmt = Audio::getFormat(d->getBitDepth(), d->getChannelCount());
|
||||
|
||||
if (fmt != AL_NONE)
|
||||
alBufferData(buffer, fmt, d->getBuffer(), decoded, d->getSampleRate());
|
||||
@@ -1318,7 +1318,7 @@ float Source::getAirAbsorptionFactor() const
|
||||
return absorptionFactor;
|
||||
}
|
||||
|
||||
int Source::getChannels() const
|
||||
int Source::getChannelCount() const
|
||||
{
|
||||
return channels;
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
virtual float getMaxDistance() const;
|
||||
virtual void setAirAbsorptionFactor(float factor);
|
||||
virtual float getAirAbsorptionFactor() const;
|
||||
virtual int getChannels() const;
|
||||
virtual int getChannelCount() const;
|
||||
|
||||
virtual bool setFilter(const std::map<Filter::Parameter, float> ¶ms);
|
||||
virtual bool setFilter();
|
||||
|
||||
@@ -39,7 +39,7 @@ int w_RecordingDevice_start(lua_State *L)
|
||||
int samples = d->getMaxSamples();
|
||||
int samplerate = d->getSampleRate();
|
||||
int bitdepth = d->getBitDepth();
|
||||
int channels = d->getChannels();
|
||||
int channels = d->getChannelCount();
|
||||
|
||||
if (lua_gettop(L) > 1)
|
||||
{
|
||||
@@ -115,10 +115,10 @@ int w_RecordingDevice_getBitDepth(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int w_RecordingDevice_getChannels(lua_State *L)
|
||||
int w_RecordingDevice_getChannelCount(lua_State *L)
|
||||
{
|
||||
RecordingDevice *d = luax_checkrecordingdevice(L, 1);
|
||||
lua_pushnumber(L, d->getChannels());
|
||||
lua_pushnumber(L, d->getChannelCount());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ static const luaL_Reg w_RecordingDevice_functions[] =
|
||||
{ "getSampleCount", w_RecordingDevice_getSampleCount },
|
||||
{ "getSampleRate", w_RecordingDevice_getSampleRate },
|
||||
{ "getBitDepth", w_RecordingDevice_getBitDepth },
|
||||
{ "getChannels", w_RecordingDevice_getChannels },
|
||||
{ "getChannelCount", w_RecordingDevice_getChannelCount },
|
||||
{ "getName", w_RecordingDevice_getName },
|
||||
{ "isRecording", w_RecordingDevice_isRecording },
|
||||
{ 0, 0 }
|
||||
|
||||
@@ -338,10 +338,10 @@ int w_Source_setAirAbsorption(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_Source_getChannels(lua_State *L)
|
||||
int w_Source_getChannelCount(lua_State *L)
|
||||
{
|
||||
Source *t = luax_checksource(L, 1);
|
||||
lua_pushinteger(L, t->getChannels());
|
||||
lua_pushinteger(L, t->getChannelCount());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ int w_Source_queue(lua_State *L)
|
||||
|
||||
luax_catchexcept(L, [&]() {
|
||||
success = t->queue((unsigned char *)s->getData() + offset, length,
|
||||
s->getSampleRate(), s->getBitDepth(), s->getChannels());
|
||||
s->getSampleRate(), s->getBitDepth(), s->getChannelCount());
|
||||
});
|
||||
}
|
||||
else if (lua_islightuserdata(L, 2))
|
||||
@@ -580,6 +580,14 @@ int w_Source_getType(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
|
||||
int w_Source_getChannels(lua_State *L)
|
||||
{
|
||||
luax_markdeprecated(L, "Source:getChannels", DEPRECATED_RENAMED, "Source:getChannelCount");
|
||||
return w_Source_getChannelCount(L);
|
||||
}
|
||||
|
||||
static const luaL_Reg w_Source_functions[] =
|
||||
{
|
||||
{ "clone", w_Source_clone },
|
||||
@@ -618,7 +626,7 @@ static const luaL_Reg w_Source_functions[] =
|
||||
{ "setRolloff", w_Source_setRolloff },
|
||||
{ "getRolloff", w_Source_getRolloff },
|
||||
|
||||
{ "getChannels", w_Source_getChannels },
|
||||
{ "getChannelCount", w_Source_getChannelCount },
|
||||
|
||||
{ "setFilter", w_Source_setFilter },
|
||||
{ "getFilter", w_Source_getFilter },
|
||||
@@ -631,6 +639,9 @@ static const luaL_Reg w_Source_functions[] =
|
||||
|
||||
{ "getType", w_Source_getType },
|
||||
|
||||
// Deprecated
|
||||
{ "getChannels", w_Source_getChannels },
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user