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 */
|
2019-09-02 22:32:02 +02:00
|
|
|
VGMSTREAM * init_vgmstream_raw_wavm(STREAMFILE *streamFile) {
|
2008-05-24 00:52:02 +02:00
|
|
|
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;
|
|
|
|
|
2019-09-02 22:32:02 +02:00
|
|
|
vgmstream->meta_type = meta_RAW_WAVM;
|
2008-05-24 00:52:02 +02:00
|
|
|
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
|
|
|
|
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
|
|
|
}
|