vgmstream/src/meta/xbox_wavm.c
bnnm 9cf9416665 Add/use xbox_ima_bytes_to_samples, rename coding_XBOX to XBOX_IMA
Currently same as ms_ima_bytes_to_samples, but this will change; renamed
for consistency with all other IMA variations. Also clean a bit some
metas since I was testing anyway.
2018-02-17 12:30:14 +01:00

38 lines
1.0 KiB
C

#include "meta.h"
#include "../coding/coding.h"
/* WAVM - headerless format which can be found on XBOX */
VGMSTREAM * init_vgmstream_xbox_wavm(STREAMFILE *streamFile) {
VGMSTREAM * vgmstream = NULL;
off_t start_offset = 0;
int loop_flag, channel_count;
/* check extension */
if (!check_extensions(streamFile,"wavm"))
goto fail;
start_offset = 0;
loop_flag = 0;
channel_count = 2;
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(channel_count,loop_flag);
if (!vgmstream) goto fail;
vgmstream->sample_rate = 44100;
vgmstream->num_samples = xbox_ima_bytes_to_samples(get_streamfile_size(streamFile), vgmstream->channels);
vgmstream->coding_type = coding_XBOX_IMA;
vgmstream->layout_type = layout_none;
vgmstream->meta_type = meta_XBOX_WAVM;
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
goto fail;
return vgmstream;
fail:
close_vgmstream(vgmstream);
return NULL;
}