Improve PCMFLOAT

This commit is contained in:
bnnm 2017-08-27 21:54:43 +02:00
parent 9c692ac472
commit 7875090f0f

View File

@ -124,11 +124,11 @@ void decode_pcmfloat(VGMSTREAM *vgmstream, VGMSTREAMCHANNEL * stream, sample * o
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
uint32_t sample_int = read_32bit(stream->offset+i*4,stream->streamfile);
float sample_float;
float* sample_float;
int sample_pcm;
memcpy(&sample_float, &sample_int, 4); /* maybe unorthodox but simplest */
sample_pcm = floor(sample_float * 32767.f + .5f);
sample_float = (float*)&sample_int;
sample_pcm = floor((*sample_float) * 32767.f + .5f);
outbuf[sample_count] = clamp16(sample_pcm);
}