mirror of
https://github.com/vgmstream/vgmstream.git
synced 2024-11-28 00:20:47 +01:00
Merge pull request #298 from bxaimc/master
Add .POS looping for .Ogg (SNK Heroines, Sonic Mania)
This commit is contained in:
commit
771b539291
@ -1,6 +1,5 @@
|
|||||||
#include "meta.h"
|
#include "meta.h"
|
||||||
|
|
||||||
|
|
||||||
/* .pos - loop points for .wav [Ys I Complete (PC); reused for manual looping] */
|
/* .pos - loop points for .wav [Ys I Complete (PC); reused for manual looping] */
|
||||||
VGMSTREAM * init_vgmstream_pos(STREAMFILE *streamFile) {
|
VGMSTREAM * init_vgmstream_pos(STREAMFILE *streamFile) {
|
||||||
VGMSTREAM * vgmstream = NULL;
|
VGMSTREAM * vgmstream = NULL;
|
||||||
@ -9,32 +8,44 @@ VGMSTREAM * init_vgmstream_pos(STREAMFILE *streamFile) {
|
|||||||
|
|
||||||
|
|
||||||
/* checks */
|
/* checks */
|
||||||
if (!check_extensions(streamFile,"pos"))
|
if (!check_extensions(streamFile, "pos"))
|
||||||
goto fail;
|
goto fail;
|
||||||
if (get_streamfile_size(streamFile) != 0x08)
|
if (get_streamfile_size(streamFile) != 0x08)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
streamData = open_streamfile_by_ext(streamFile, "wav");
|
streamData = open_streamfile_by_ext(streamFile, "wav");
|
||||||
if (!streamData) goto fail;
|
if (streamData) {
|
||||||
|
vgmstream = init_vgmstream_riff(streamData);
|
||||||
/* let the real initer do the parsing */
|
if (!vgmstream) goto fail;
|
||||||
vgmstream = init_vgmstream_riff(streamData);
|
vgmstream->meta_type = meta_RIFF_WAVE_POS;
|
||||||
if (!vgmstream) goto fail;
|
}
|
||||||
|
else {
|
||||||
|
/* hack for Ogg with external loops */
|
||||||
|
streamData = open_streamfile_by_ext(streamFile, "ogg");
|
||||||
|
if (streamData) {
|
||||||
|
vgmstream = init_vgmstream_ogg_vorbis(streamData);
|
||||||
|
if (!vgmstream) goto fail;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
close_streamfile(streamData);
|
close_streamfile(streamData);
|
||||||
streamData = NULL;
|
streamData = NULL;
|
||||||
|
|
||||||
/* install loops (wrong values are validated later) */
|
/* install loops (wrong values are validated later) */
|
||||||
loop_start = read_32bitLE(0x00,streamFile);
|
loop_start = read_32bitLE(0x00, streamFile);
|
||||||
loop_end = read_32bitLE(0x04,streamFile);
|
loop_end = read_32bitLE(0x04, streamFile);
|
||||||
|
if (loop_end <= 0 || (loop_end > vgmstream->num_samples)) {
|
||||||
|
loop_end = vgmstream->num_samples;
|
||||||
|
}
|
||||||
vgmstream_force_loop(vgmstream, 1, loop_start, loop_end);
|
vgmstream_force_loop(vgmstream, 1, loop_start, loop_end);
|
||||||
|
|
||||||
vgmstream->meta_type = meta_RIFF_WAVE_POS;
|
|
||||||
|
|
||||||
return vgmstream;
|
return vgmstream;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
close_streamfile(streamData);
|
close_streamfile(streamData);
|
||||||
close_vgmstream(vgmstream);
|
close_vgmstream(vgmstream);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user