2008-07-14 15:08:01 +02:00
|
|
|
#include "meta.h"
|
|
|
|
#include "../util.h"
|
|
|
|
|
|
|
|
|
2023-06-24 16:14:41 +02:00
|
|
|
/* RWAX - from AirForce Delta Storm (Xbox) */
|
2023-06-24 16:15:39 +02:00
|
|
|
VGMSTREAM* init_vgmstream_rwax(STREAMFILE* sf) {
|
2023-06-24 16:14:41 +02:00
|
|
|
VGMSTREAM* vgmstream = NULL;
|
|
|
|
uint32_t start_offset;
|
|
|
|
int channels, loop_flag = 0;
|
2008-07-14 15:08:01 +02:00
|
|
|
|
2023-06-24 16:14:41 +02:00
|
|
|
/* checks */
|
|
|
|
if (!is_id32be(0x00,sf, "RAWX"))
|
|
|
|
return NULL;
|
|
|
|
if (!check_extensions(sf,"rwx"))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
start_offset = read_u32le(0x04,sf);
|
|
|
|
loop_flag = read_s32le(0x0C,sf);
|
|
|
|
channels = 2;
|
2008-07-14 15:08:01 +02:00
|
|
|
|
2023-06-24 16:14:41 +02:00
|
|
|
/* build the VGMSTREAM */
|
|
|
|
vgmstream = allocate_vgmstream(channels,loop_flag);
|
2008-07-14 15:08:01 +02:00
|
|
|
if (!vgmstream) goto fail;
|
|
|
|
|
2023-06-24 16:14:41 +02:00
|
|
|
vgmstream->meta_type = meta_RWAX;
|
|
|
|
vgmstream->sample_rate = read_s32le(0x08,sf);
|
|
|
|
vgmstream->num_samples = read_s32le(0x10,sf);
|
|
|
|
vgmstream->loop_start_sample = read_s32le(0x0C,sf);
|
|
|
|
vgmstream->loop_end_sample = read_s32le(0x10,sf);
|
2008-07-14 15:08:01 +02:00
|
|
|
|
|
|
|
vgmstream->coding_type = coding_PCM16LE;
|
|
|
|
vgmstream->layout_type = layout_interleave;
|
|
|
|
vgmstream->interleave_block_size = 0x2;
|
|
|
|
|
2023-06-24 16:14:41 +02:00
|
|
|
if (!vgmstream_open_stream(vgmstream, sf, start_offset))
|
|
|
|
goto fail;
|
2008-07-14 15:08:01 +02:00
|
|
|
return vgmstream;
|
|
|
|
|
|
|
|
fail:
|
2023-06-24 16:14:41 +02:00
|
|
|
close_vgmstream(vgmstream);
|
2008-07-14 15:08:01 +02:00
|
|
|
return NULL;
|
|
|
|
}
|