mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-17 23:36:41 +01:00
Improve PCMFLOAT
This commit is contained in:
parent
9c692ac472
commit
7875090f0f
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user