Add LWAV output option to test, fix so that we need at3plusdecoder.dll, not .def in test and winamp builds

This commit is contained in:
Soneek 2015-05-11 15:02:21 -07:00
parent f6367fb0a8
commit 3826cd0f8e
7 changed files with 50 additions and 11 deletions

View File

@ -14,8 +14,8 @@ libg7221_decode.a: libg7221_decode.def
libg719_decode.a: libg719_decode.def
$(DLLTOOL) -d libg719_decode.def -l libg719_decode.a
at3plusdecoder.a: at3plusdecoder.def
$(DLLTOOL) -d at3plusdecoder.def -l at3plusdecoder.a
libat3plusdecoder.a: at3plusdecoder.def
$(DLLTOOL) -d at3plusdecoder.def -l libat3plusdecoder.a
clean:
rm -f libvorbis.a libmpg123-0.a libg7221_decode.a libat3plusdecoder.a
rm -f libvorbis.a libmpg123-0.a libg7221_decode.a libg719_decode.a libat3plusdecoder.a

View File

@ -127,6 +127,29 @@ void make_wav_header(uint8_t * buf, int32_t sample_count, int32_t sample_rate, i
put_32bitLE(buf+0x28, (int32_t)bytecount);
}
void make_smpl_chunk(uint8_t * buf, int32_t loop_start, int32_t loop_end) {
int i;
/* RIFF header */
memcpy(buf+0, "smpl", 4);
/* size of RIFF */
put_32bitLE(buf+4, 0x3c);
for (i = 0; i < 7; i++)
put_32bitLE(buf+8 + i * 4, 0);
put_32bitLE(buf+36, 1);
for (i = 0; i < 3; i++)
put_32bitLE(buf+40 + i * 4, 0);
put_32bitLE(buf+52, loop_start);
put_32bitLE(buf+56, loop_end);
put_32bitLE(buf+60, 0);
put_32bitLE(buf+64, 0);
}
void swap_samples_le(sample *buf, int count) {
int i;
for (i=0;i<count;i++) {

View File

@ -63,6 +63,7 @@ static inline int clamp16(int32_t val) {
/* make a header for PCM .wav */
/* buffer must be 0x2c bytes */
void make_wav_header(uint8_t * buf, int32_t sample_count, int32_t sample_rate, int channels);
void make_smpl_chunk(uint8_t * buf, int32_t loop_start, int32_t loop_end);
void swap_samples_le(sample *buf, int count);
void concatn(int length, char * dst, const char * src);

View File

@ -1,6 +1,6 @@
export SHELL = /bin/sh
export CFLAGS=-Wall -O3 -I../ext_includes
export LDFLAGS=-L../src -L ../ext_libs -lvgmstream -lvorbisfile -lmpg123 -lm
export LDFLAGS=-L../src -L ../ext_libs -lvgmstream -lvorbisfile -lmpg123-0 -lm
export CC=gcc
export AR=ar
export STRIP=strip

View File

@ -8,9 +8,9 @@ export STRIP=i586-mingw32msvc-strip
#export AR=i686-w64-mingw32-ar
#export STRIP=i686-w64-mingw32-strip
.PHONY: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a libg719_decode.a at3plusdecoder.a
.PHONY: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a libg719_decode.a libat3plusdecoder.a
test.exe: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a libg719_decode.a at3plusdecoder.a
test.exe: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a libg719_decode.a libat3plusdecoder.a
$(CC) $(CFLAGS) "-DVERSION=\"`../version.sh`\"" test.c $(LDFLAGS) -o test.exe
$(STRIP) test.exe
@ -29,7 +29,8 @@ libg7221_decode.a:
libg719_decode.a:
$(MAKE) -C ../ext_libs -f Makefile.mingw $@
at3plusdecoder.a:
$(MAKE) -C ../ext_libs -f Makefile.mingw $@
libat3plusdecoder.a:
$(MAKE) -C ../ext_libs -f Makefile.mingw $@
clean:
rm -f test.exe

View File

@ -29,6 +29,7 @@ void usage(const char * name) {
" -x: decode and print adxencd command line to encode as ADX\n"
" -g: decode and print oggenc command line to encode as OGG\n"
" -b: decode and print batch variable commands\n"
" -L: append a smpl chunk and create a looping wav\n"
" -e: force end-to-end looping\n"
" -E: force end-to-end looping even if file has real loop points\n"
" -r outfile2.wav: output a second time after resetting\n"
@ -56,13 +57,14 @@ int main(int argc, char ** argv) {
int metaonly = 0;
int adxencd = 0;
int oggenc = 0;
int lwav = 0;
int batchvar = 0;
int only_stereo = -1;
double loop_count = 2.0;
double fade_seconds = 10.0;
double fade_delay_seconds = 0.0;
while ((opt = getopt(argc, argv, "o:l:f:d:ipPcmxeEr:gb2:")) != -1) {
while ((opt = getopt(argc, argv, "o:l:f:d:ipPcmxeLEr:gb2:")) != -1) {
switch (opt) {
case 'o':
outfilename = optarg;
@ -107,6 +109,9 @@ int main(int argc, char ** argv) {
case 'E':
really_force_loop = 1;
break;
case 'L':
lwav = 1;
break;
case 'r':
reset_outfilename = optarg;
break;
@ -293,7 +298,16 @@ int main(int argc, char ** argv) {
fwrite(buf,sizeof(sample)*s->channels,toget,outfile);
}
}
if (!play && lwav && s->loop_flag) { // Writing smpl chuck
make_smpl_chunk((uint8_t*)buf, s->loop_start_sample, s->loop_end_sample);
fwrite(buf,1,0x44,outfile);
fseek(outfile, 4, SEEK_SET);
size_t bytecount = len*s->channels*sizeof(sample);
put_32bitLE((uint8_t*)buf, (int32_t)(bytecount+0x2c+52));
fwrite(buf,1,0x4,outfile);
}
fclose(outfile); outfile = NULL;
#ifdef PROFILE_STREAMFILE

View File

@ -13,7 +13,7 @@ export WINDRES=i586-mingw32msvc-windres
.PHONY: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a libg719_decode.a at3plusdecoder.a
in_vgmstream.dll: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a libg719_decode.a in_vgmstream.c resource.o
in_vgmstream.dll: libvgmstream.a libvorbis.a libmpg123-0.a libg7221_decode.a libg719_decode.a libat3plusdecoder.a in_vgmstream.c resource.o
$(CC) -shared -static-libgcc $(CFLAGS) "-DVERSION=\"`../version.sh`\"" in_vgmstream.c resource.o $(LDFLAGS) -o in_vgmstream.dll
$(STRIP) in_vgmstream.dll