mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Fixed SoundData:getDuration
This commit is contained in:
@@ -147,9 +147,9 @@ int SoundData::getSampleRate() const
|
|||||||
return sampleRate;
|
return sampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SoundData::getDuration() const
|
float SoundData::getDuration() const
|
||||||
{
|
{
|
||||||
return size/(channels*sampleRate*bits/8);
|
return float(size) / (channels*sampleRate*bits/8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundData::setSample(int i, float sample)
|
void SoundData::setSample(int i, float sample)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
virtual int getBits() const;
|
virtual int getBits() const;
|
||||||
virtual int getSampleRate() const;
|
virtual int getSampleRate() const;
|
||||||
|
|
||||||
virtual int getDuration() const;
|
virtual float getDuration() const;
|
||||||
|
|
||||||
void setSample(int i, float sample);
|
void setSample(int i, float sample);
|
||||||
float getSample(int i) const;
|
float getSample(int i) const;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ int w_SoundData_getSampleRate(lua_State *L)
|
|||||||
int w_SoundData_getDuration(lua_State *L)
|
int w_SoundData_getDuration(lua_State *L)
|
||||||
{
|
{
|
||||||
SoundData *t = luax_checksounddata(L, 1);
|
SoundData *t = luax_checksounddata(L, 1);
|
||||||
lua_pushinteger(L, t->getDuration());
|
lua_pushnumber(L, t->getDuration());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user