mirror of
https://github.com/vgmstream/vgmstream.git
synced 2025-01-18 07:44:43 +01:00
Changed decode_pcm4 functions to use int16_t instead of uint16_t
This commit is contained in:
parent
a9ad21c77b
commit
c47ae9632a
@ -81,7 +81,7 @@ void decode_pcm8_sb(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspaci
|
|||||||
void decode_pcm4(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) {
|
void decode_pcm4(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) {
|
||||||
int i, nibble_shift, is_high_first, is_stereo;
|
int i, nibble_shift, is_high_first, is_stereo;
|
||||||
int32_t sample_count;
|
int32_t sample_count;
|
||||||
uint16_t sample;
|
int16_t v;
|
||||||
off_t byte_offset;
|
off_t byte_offset;
|
||||||
|
|
||||||
is_high_first = (vgmstream->codec_config & 1);
|
is_high_first = (vgmstream->codec_config & 1);
|
||||||
@ -95,16 +95,16 @@ void decode_pcm4(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, sample * outb
|
|||||||
is_stereo ? (!(channel&1) ? 4:0) : (!(i&1) ? 4:0) : /* even = high, odd = low */
|
is_stereo ? (!(channel&1) ? 4:0) : (!(i&1) ? 4:0) : /* even = high, odd = low */
|
||||||
is_stereo ? (!(channel&1) ? 0:4) : (!(i&1) ? 0:4); /* even = low, odd = high */
|
is_stereo ? (!(channel&1) ? 0:4) : (!(i&1) ? 0:4); /* even = low, odd = high */
|
||||||
|
|
||||||
sample = (uint16_t)read_8bit(byte_offset, stream->streamfile);
|
v = (int16_t)read_8bit(byte_offset, stream->streamfile);
|
||||||
sample = (sample >> nibble_shift) & 0x0F;
|
v = (v >> nibble_shift) & 0x0F;
|
||||||
outbuf[sample_count] = sample*0x11*0x100;
|
outbuf[sample_count] = v*0x11*0x100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void decode_pcm4_unsigned(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) {
|
void decode_pcm4_unsigned(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do, int channel) {
|
||||||
int i, nibble_shift, is_high_first, is_stereo;
|
int i, nibble_shift, is_high_first, is_stereo;
|
||||||
int32_t sample_count;
|
int32_t sample_count;
|
||||||
uint16_t sample;
|
int16_t v;
|
||||||
off_t byte_offset;
|
off_t byte_offset;
|
||||||
|
|
||||||
is_high_first = (vgmstream->codec_config & 1);
|
is_high_first = (vgmstream->codec_config & 1);
|
||||||
@ -118,9 +118,9 @@ void decode_pcm4_unsigned(VGMSTREAM * vgmstream, VGMSTREAMCHANNEL * stream, samp
|
|||||||
is_stereo ? (!(channel&1) ? 4:0) : (!(i&1) ? 4:0) : /* even = high, odd = low */
|
is_stereo ? (!(channel&1) ? 4:0) : (!(i&1) ? 4:0) : /* even = high, odd = low */
|
||||||
is_stereo ? (!(channel&1) ? 0:4) : (!(i&1) ? 0:4); /* even = low, odd = high */
|
is_stereo ? (!(channel&1) ? 0:4) : (!(i&1) ? 0:4); /* even = low, odd = high */
|
||||||
|
|
||||||
sample = (uint16_t)read_8bit(byte_offset, stream->streamfile);
|
v = (int16_t)read_8bit(byte_offset, stream->streamfile);
|
||||||
sample = (sample >> nibble_shift) & 0x0F;
|
v = (v >> nibble_shift) & 0x0F;
|
||||||
outbuf[sample_count] = sample*0x11*0x100 - 0x8000;
|
outbuf[sample_count] = v*0x11*0x100 - 0x8000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user