mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
Update sfxSndStream.cpp
streaming file fixes, also only wrap back around when we have read the whole file.
This commit is contained in:
parent
bf34d3daa8
commit
ebdc408385
1 changed files with 12 additions and 3 deletions
|
|
@ -139,13 +139,22 @@ U32 SFXSndStream::read(U8* buffer, U32 length)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (framesRead != sfinfo.frames)
|
if (framesRead != framesToRead)
|
||||||
{
|
{
|
||||||
Con::errorf("SFXSndStream - read: %s", sf_strerror(sndFile));
|
Con::errorf("SFXSndStream - read: %s", sf_strerror(sndFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset stream
|
// make sure we are more than 0 position.
|
||||||
setPosition(0);
|
if (getPosition() > 0)
|
||||||
|
{
|
||||||
|
// (convert to frames) == number of frames available?
|
||||||
|
if ((getPosition() / mFormat.getBytesPerSample()) == sfinfo.frames)
|
||||||
|
{
|
||||||
|
// reset stream
|
||||||
|
setPosition(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return framesRead * mFormat.getBytesPerSample();
|
return framesRead * mFormat.getBytesPerSample();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue