- got rid of std::auto_ptr, courtesy of Blzut3's patch.
This commit is contained in:
parent
d880783784
commit
6bb79be85c
22 changed files with 181 additions and 167 deletions
|
|
@ -6,12 +6,12 @@
|
|||
#include "except.h"
|
||||
|
||||
#include "sndfile_decoder.h"
|
||||
#include "templates.h"
|
||||
#include "files.h"
|
||||
#include "xs_Float.h"
|
||||
|
||||
#ifdef HAVE_SNDFILE
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
sf_count_t SndFileDecoder::file_get_filelen(void *user_data)
|
||||
{
|
||||
FileReader *reader = reinterpret_cast<SndFileDecoder*>(user_data)->Reader;
|
||||
|
|
@ -69,10 +69,10 @@ bool SndFileDecoder::open(FileReader *reader)
|
|||
SndFile = 0;
|
||||
}
|
||||
}
|
||||
__except (CheckException(GetExceptionCode()))
|
||||
{
|
||||
// this means that the delay loaded decoder DLL was not found.
|
||||
}
|
||||
__except (CheckException(GetExceptionCode()))
|
||||
{
|
||||
// this means that the delay loaded decoder DLL was not found.
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -103,14 +103,14 @@ size_t SndFileDecoder::read(char *buffer, size_t bytes)
|
|||
// could be more.
|
||||
while(total < frames)
|
||||
{
|
||||
size_t todo = std::min<size_t>(frames-total, 64/SndInfo.channels);
|
||||
size_t todo = MIN<size_t>(frames-total, 64/SndInfo.channels);
|
||||
float tmp[64];
|
||||
|
||||
size_t got = (size_t)sf_readf_float(SndFile, tmp, todo);
|
||||
if(got < todo) frames = total + got;
|
||||
|
||||
for(size_t i = 0;i < got*SndInfo.channels;i++)
|
||||
*out++ = (short)((std::min)((std::max)(tmp[i] * 32767.f, -32768.f), 32767.f));
|
||||
*out++ = (short)xs_CRoundToInt(clamp(tmp[i] * 32767.f, -32768.f, 32767.f));
|
||||
total += got;
|
||||
}
|
||||
return total * SndInfo.channels * 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue