diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 00000000..ca41bd90 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,6 @@ +CFLAGS=-lm + +test: test.c ../src/streamfile.c ../src/vgmstream.c ../src/util.c ../src/fmt/adx.c ../src/fmt/interleave.c + +clean: + rm test diff --git a/test/filetest.c b/test/filetest.c new file mode 100644 index 00000000..a55ec60b --- /dev/null +++ b/test/filetest.c @@ -0,0 +1,38 @@ +#include +#include "streamfile.h" + +char buf[0x1002]; + +int main(void) { + STREAMFILE * infile; + FILE * outfile; + size_t filesize,i; + + infile = open_streamfile("bob.bin"); + if (!infile) { + printf("failed to open\n"); + return 1; + } + + outfile = fopen("fred.bin","wb"); + + filesize = get_streamfile_size(infile); + + for (i=0;isample_rate); + printf("channels: %d\n",s->channels); + if (s->loop_flag) { + printf("loop start: %d samples (%lf seconds)\n",s->loop_start_sample,(double)s->loop_start_sample/s->sample_rate); + printf("loop end: %d samples (%lf seconds)\n",s->loop_end_sample,(double)s->loop_end_sample/s->sample_rate); + } + printf("file total samples %d (%lf seconds)\n",s->num_samples); + + len = get_vgmstream_play_samples(2.0,10.0,s); + printf("samples to play %d (%lf seconds)\n",len,(double)len/s->sample_rate); + + for (i=0;ilen) toget=len-i; + render_vgmstream(buf,toget,s); + fwrite(buf,sizeof(sample)*2,toget,outfile); + } + + close_vgmstream(s); +}