mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 08:20:54 +01:00
add support for IMA encoding
git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@676 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
parent
6d478b33a8
commit
8101ace4ed
@ -18,7 +18,8 @@ VGMSTREAM * init_vgmstream_ps2_snd(STREAMFILE *streamFile) {
|
||||
/* check header */
|
||||
if (read_32bitBE(0x0,streamFile) !=0x53534e44) goto fail;
|
||||
|
||||
loop_flag = 0;
|
||||
/* Force Loop 0->end */
|
||||
loop_flag = 1;
|
||||
channel_count = read_16bitLE(0x0a,streamFile);
|
||||
|
||||
/* build the VGMSTREAM */
|
||||
@ -28,13 +29,32 @@ VGMSTREAM * init_vgmstream_ps2_snd(STREAMFILE *streamFile) {
|
||||
/* fill in the vital statistics */
|
||||
start_offset = read_32bitLE(0x04,streamFile)+8;
|
||||
vgmstream->sample_rate = (uint16_t)read_16bitLE(0xe,streamFile);
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
vgmstream->num_samples = (get_streamfile_size(streamFile)-start_offset)/2/channel_count;
|
||||
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
if(read_8bit(0x08,streamFile)==1) {
|
||||
vgmstream->coding_type = coding_INT_DVI_IMA;
|
||||
}
|
||||
else
|
||||
vgmstream->coding_type = coding_PCM16LE;
|
||||
|
||||
vgmstream->num_samples = read_32bitLE(0x16,streamFile);
|
||||
|
||||
vgmstream->interleave_block_size = (uint16_t)read_16bitLE(0x12,streamFile);
|
||||
|
||||
if((get_streamfile_size(streamFile)-start_offset)%vgmstream->interleave_block_size)
|
||||
{
|
||||
/* not sure if this is right ... */
|
||||
vgmstream->layout_type = layout_interleave_shortblock;
|
||||
vgmstream->interleave_smallblock_size = ((get_streamfile_size(streamFile)-start_offset)%vgmstream->interleave_block_size)/vgmstream->channels;
|
||||
} else {
|
||||
vgmstream->layout_type = layout_interleave;
|
||||
}
|
||||
vgmstream->meta_type = meta_PS2_SND;
|
||||
|
||||
if(loop_flag) {
|
||||
vgmstream->loop_start_sample=0;
|
||||
vgmstream->loop_end_sample=vgmstream->num_samples;
|
||||
}
|
||||
|
||||
/* open the file for reading */
|
||||
{
|
||||
int i;
|
||||
|
Loading…
Reference in New Issue
Block a user