vgmstream/src/meta/tgc.c

30 lines
760 B
C
Raw Normal View History

2020-01-11 11:52:24 +01:00
#include "meta.h"
#include "../coding/coding.h"
/* Tiger Game.com ADPCM file */
VGMSTREAM * init_vgmstream_tgc(STREAMFILE *streamFile) {
2020-01-11 12:33:27 +01:00
VGMSTREAM * vgmstream = NULL;
2020-01-11 11:52:24 +01:00
2020-01-11 12:33:27 +01:00
/* checks */
if (!check_extensions(streamFile, "gcomadpcm,tgcadpcm,4"))
goto fail;
2020-01-11 11:52:24 +01:00
2020-01-11 12:33:27 +01:00
/* build the VGMSTREAM */
vgmstream = allocate_vgmstream(1, 0);
if (!vgmstream) goto fail;
2020-01-11 11:52:24 +01:00
2020-01-11 12:33:27 +01:00
vgmstream->sample_rate = 8000;
vgmstream->num_samples = (read_16bitBE(1, streamFile) - 3) * 2;
vgmstream->meta_type = meta_TGC;
vgmstream->layout_type = layout_none;
vgmstream->coding_type = coding_TGC;
2020-01-11 11:52:24 +01:00
2020-01-11 12:33:27 +01:00
if (!vgmstream_open_stream(vgmstream, streamFile, 3))
goto fail;
2020-01-11 11:52:24 +01:00
2020-01-11 12:33:27 +01:00
return vgmstream;
2020-01-11 11:52:24 +01:00
fail:
2020-01-11 12:33:27 +01:00
close_vgmstream(vgmstream);
return NULL;
2020-01-11 11:52:24 +01:00
}