2008-05-24 00:52:02 +02:00
|
|
|
#include "meta.h"
|
2018-02-17 12:30:14 +01:00
|
|
|
#include "../coding/coding.h"
|
2008-05-24 00:52:02 +02:00
|
|
|
|
2018-02-17 12:30:14 +01:00
|
|
|
/* WAVM - headerless format which can be found on XBOX */
|
2008-05-24 00:52:02 +02:00
|
|
|
VGMSTREAM * init_vgmstream_xbox_wavm(STREAMFILE *streamFile) {
|
|
|
|
VGMSTREAM * vgmstream = NULL;
|
2018-02-17 12:30:14 +01:00
|
|
|
off_t start_offset = 0;
|
|
|
|
int loop_flag, channel_count;
|
2008-05-24 00:52:02 +02:00
|
|
|
|
2018-02-17 12:30:14 +01:00
|
|
|
/* check extension */
|
|
|
|
if (!check_extensions(streamFile,"wavm"))
|
|
|
|
goto fail;
|
2008-05-24 00:52:02 +02:00
|
|
|
|
2018-02-17 12:30:14 +01:00
|
|
|
start_offset = 0;
|
|
|
|
loop_flag = 0;
|
|
|
|
channel_count = 2;
|
2008-05-24 00:52:02 +02:00
|
|
|
|
2018-02-17 12:30:14 +01:00
|
|
|
/* build the VGMSTREAM */
|
2008-05-24 00:52:02 +02:00
|
|
|
vgmstream = allocate_vgmstream(channel_count,loop_flag);
|
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
|
|
|
vgmstream->sample_rate = 44100;
|
2018-02-17 12:30:14 +01:00
|
|
|
vgmstream->num_samples = xbox_ima_bytes_to_samples(get_streamfile_size(streamFile), vgmstream->channels);
|
2008-05-24 00:52:02 +02:00
|
|
|
|
2018-02-17 12:30:14 +01:00
|
|
|
vgmstream->coding_type = coding_XBOX_IMA;
|
2008-08-10 22:08:03 +02:00
|
|
|
vgmstream->layout_type = layout_none;
|
2008-05-24 00:52:02 +02:00
|
|
|
vgmstream->meta_type = meta_XBOX_WAVM;
|
|
|
|
|
|
|
|
|
2018-02-17 12:30:14 +01:00
|
|
|
if (!vgmstream_open_stream(vgmstream, streamFile, start_offset))
|
|
|
|
goto fail;
|
2008-05-24 00:52:02 +02:00
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
2018-02-17 12:30:14 +01:00
|
|
|
close_vgmstream(vgmstream);
|
2008-05-24 00:52:02 +02:00
|
|
|
return NULL;
|
2014-06-27 06:12:48 +02:00
|
|
|
}
|