mirror of
https://github.com/love2d/love.git
synced 2026-08-18 11:44:15 +02:00
Use doubles instead of floats for the time argument in Source:seek. This probably won't affect anything meaningfully, but in theory it's more precise.
This commit is contained in:
@@ -98,7 +98,7 @@ public:
|
||||
* @param s The position in the stream in seconds.
|
||||
* @return True if success, false on fail/unsupported.
|
||||
**/
|
||||
virtual bool seek(float s) = 0;
|
||||
virtual bool seek(double s) = 0;
|
||||
|
||||
/**
|
||||
* Rewinds the stream to the start.
|
||||
|
||||
@@ -227,7 +227,7 @@ int CoreAudioDecoder::decode()
|
||||
return size;
|
||||
}
|
||||
|
||||
bool CoreAudioDecoder::seek(float s)
|
||||
bool CoreAudioDecoder::seek(double s)
|
||||
{
|
||||
OSStatus err = ExtAudioFileSeek(extAudioFile, (SInt64) (s * inputInfo.mSampleRate));
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
love::sound::Decoder *clone();
|
||||
int decode();
|
||||
bool seek(float s);
|
||||
bool seek(double s);
|
||||
bool rewind();
|
||||
bool isSeekable();
|
||||
int getChannelCount() const;
|
||||
|
||||
@@ -78,9 +78,9 @@ int FLACDecoder::decode()
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
bool FLACDecoder::seek(float s)
|
||||
bool FLACDecoder::seek(double s)
|
||||
{
|
||||
return seek_absolute((int)(s*1000.0f));
|
||||
return seek_absolute((int)(s*1000.0));
|
||||
}
|
||||
|
||||
bool FLACDecoder::rewind()
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
static bool accepts(const std::string &ext);
|
||||
love::sound::Decoder *clone();
|
||||
int decode();
|
||||
bool seek(float s);
|
||||
bool seek(double s);
|
||||
bool rewind();
|
||||
bool isSeekable();
|
||||
int getChannelCount() const;
|
||||
|
||||
@@ -109,9 +109,9 @@ int GmeDecoder::decode()
|
||||
return bufferSize;
|
||||
}
|
||||
|
||||
bool GmeDecoder::seek(float s)
|
||||
bool GmeDecoder::seek(double s)
|
||||
{
|
||||
return gme_seek(emu, static_cast<long>(s * 1000.f)) != 0;
|
||||
return gme_seek(emu, static_cast<long>(s * 1000.0)) != 0;
|
||||
}
|
||||
|
||||
bool GmeDecoder::rewind()
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
|
||||
love::sound::Decoder *clone();
|
||||
int decode();
|
||||
bool seek(float s);
|
||||
bool seek(double s);
|
||||
bool rewind();
|
||||
bool isSeekable();
|
||||
int getChannelCount() const;
|
||||
|
||||
@@ -111,9 +111,9 @@ int ModPlugDecoder::decode()
|
||||
return r;
|
||||
}
|
||||
|
||||
bool ModPlugDecoder::seek(float s)
|
||||
bool ModPlugDecoder::seek(double s)
|
||||
{
|
||||
ModPlug_Seek(plug, (int)(s*1000.0f));
|
||||
ModPlug_Seek(plug, (int)(s*1000.0));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
love::sound::Decoder *clone();
|
||||
int decode();
|
||||
bool seek(float s);
|
||||
bool seek(double s);
|
||||
bool rewind();
|
||||
bool isSeekable();
|
||||
int getChannelCount() const;
|
||||
|
||||
@@ -232,7 +232,7 @@ int Mpg123Decoder::decode()
|
||||
return size;
|
||||
}
|
||||
|
||||
bool Mpg123Decoder::seek(float s)
|
||||
bool Mpg123Decoder::seek(double s)
|
||||
{
|
||||
off_t offset = (off_t) (s * (double) sampleRate);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
|
||||
love::sound::Decoder *clone();
|
||||
int decode();
|
||||
bool seek(float s);
|
||||
bool seek(double s);
|
||||
bool rewind();
|
||||
bool isSeekable();
|
||||
int getChannelCount() const;
|
||||
|
||||
@@ -209,7 +209,7 @@ int VorbisDecoder::decode()
|
||||
return size;
|
||||
}
|
||||
|
||||
bool VorbisDecoder::seek(float s)
|
||||
bool VorbisDecoder::seek(double s)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
|
||||
love::sound::Decoder *clone();
|
||||
int decode();
|
||||
bool seek(float s);
|
||||
bool seek(double s);
|
||||
bool rewind();
|
||||
bool isSeekable();
|
||||
int getChannelCount() const;
|
||||
|
||||
@@ -143,7 +143,7 @@ int WaveDecoder::decode()
|
||||
return (int) size;
|
||||
}
|
||||
|
||||
bool WaveDecoder::seek(float s)
|
||||
bool WaveDecoder::seek(double s)
|
||||
{
|
||||
int wuff_status = wuff_seek(handle, (wuff_uint64) (s * info.sample_rate));
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
love::sound::Decoder *clone();
|
||||
int decode();
|
||||
bool seek(float s);
|
||||
bool seek(double s);
|
||||
bool rewind();
|
||||
bool isSeekable();
|
||||
int getChannelCount() const;
|
||||
|
||||
@@ -96,7 +96,7 @@ int w_Decoder_decode(lua_State *L)
|
||||
int w_Decoder_seek(lua_State *L)
|
||||
{
|
||||
Decoder *t = luax_checkdecoder(L, 1);
|
||||
float offset = luaL_checknumber(L, 2);
|
||||
double offset = luaL_checknumber(L, 2);
|
||||
if (offset < 0)
|
||||
return luaL_argerror(L, 2, "can't seek to a negative position");
|
||||
else if (offset == 0)
|
||||
|
||||
Reference in New Issue
Block a user