mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-24 15:00:11 +01:00
8-bit unsigned pcm, for RIFF
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@486 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
aebdd634ee
commit
8ee5f1b89d
@ -30,6 +30,7 @@ void decode_pcm16BE(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspaci
|
||||
void decode_pcm8(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_pcm8_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_pcm8_sb_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
void decode_pcm8_unsigned_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
|
||||
void decode_psx(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do);
|
||||
|
||||
|
@ -48,6 +48,16 @@ void decode_pcm8_sb_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channels
|
||||
}
|
||||
}
|
||||
|
||||
void decode_pcm8_unsigned_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
int i;
|
||||
int32_t sample_count;
|
||||
|
||||
for (i=first_sample,sample_count=0; i<first_sample+samples_to_do; i++,sample_count+=channelspacing) {
|
||||
int16_t v = (uint8_t)read_8bit(stream->offset+i*channelspacing,stream->streamfile);
|
||||
outbuf[sample_count] = v*0x100 - 0x8000;
|
||||
}
|
||||
}
|
||||
|
||||
void decode_pcm16LE_int(VGMSTREAMCHANNEL * stream, sample * outbuf, int channelspacing, int32_t first_sample, int32_t samples_to_do) {
|
||||
int i;
|
||||
int32_t sample_count;
|
||||
|
@ -149,7 +149,7 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
interleave = 2;
|
||||
break;
|
||||
case 8:
|
||||
coding_type = coding_PCM8;
|
||||
coding_type = coding_PCM8_U_int;
|
||||
interleave = 1;
|
||||
break;
|
||||
default:
|
||||
@ -211,7 +211,7 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
case coding_PCM16LE:
|
||||
sample_count = data_size/2/channel_count;
|
||||
break;
|
||||
case coding_PCM8:
|
||||
case coding_PCM8_U_int:
|
||||
sample_count = data_size/channel_count;
|
||||
break;
|
||||
}
|
||||
@ -226,7 +226,7 @@ VGMSTREAM * init_vgmstream_riff(STREAMFILE *streamFile) {
|
||||
vgmstream->sample_rate = sample_rate;
|
||||
|
||||
vgmstream->coding_type = coding_type;
|
||||
if (channel_count > 1)
|
||||
if (channel_count > 1 && coding_type != coding_PCM8_U_int)
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
else
|
||||
vgmstream->layout_type = layout_none;
|
||||
|
@ -540,6 +540,7 @@ int get_vgmstream_samples_per_frame(VGMSTREAM * vgmstream) {
|
||||
case coding_PCM8:
|
||||
case coding_PCM8_int:
|
||||
case coding_PCM8_SB_int:
|
||||
case coding_PCM8_U_int:
|
||||
#ifdef VGM_USE_VORBIS
|
||||
case coding_ogg_vorbis:
|
||||
#endif
|
||||
@ -625,6 +626,7 @@ int get_vgmstream_frame_size(VGMSTREAM * vgmstream) {
|
||||
case coding_PCM8:
|
||||
case coding_PCM8_int:
|
||||
case coding_PCM8_SB_int:
|
||||
case coding_PCM8_U_int:
|
||||
case coding_SDX2:
|
||||
case coding_SDX2_int:
|
||||
case coding_NWA0:
|
||||
@ -756,6 +758,13 @@ void decode_vgmstream(VGMSTREAM * vgmstream, int samples_written, int samples_to
|
||||
samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_PCM8_U_int:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_pcm8_unsigned_int(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
vgmstream->channels,vgmstream->samples_into_block,
|
||||
samples_to_do);
|
||||
}
|
||||
break;
|
||||
case coding_NDS_IMA:
|
||||
for (chan=0;chan<vgmstream->channels;chan++) {
|
||||
decode_nds_ima(&vgmstream->ch[chan],buffer+samples_written*vgmstream->channels+chan,
|
||||
@ -1121,6 +1130,9 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) {
|
||||
case coding_PCM8:
|
||||
snprintf(temp,TEMPSIZE,"8-bit PCM");
|
||||
break;
|
||||
case coding_PCM8_U_int:
|
||||
snprintf(temp,TEMPSIZE,"8-bit unsigned PCM with 1 byte interleave");
|
||||
break;
|
||||
case coding_PCM8_int:
|
||||
snprintf(temp,TEMPSIZE,"8-bit PCM with 1 byte interleave");
|
||||
break;
|
||||
|
@ -37,6 +37,8 @@ typedef enum {
|
||||
by the decoder */
|
||||
coding_PCM8_SB_int, /* 8-bit PCM, sign bit (others are 2's complement),
|
||||
sample-level interleave */
|
||||
coding_PCM8_U_int, /* 8-bit PCM, unsigned (0x80 = 0), sample-level
|
||||
interleave */
|
||||
|
||||
/* 4-bit ADPCM */
|
||||
coding_NDS_IMA, /* IMA ADPCM w/ NDS layout */
|
||||
|
Loading…
Reference in New Issue
Block a user