From 017b6e9e83458d5ec1cfd7c948c7ed72ca716168 Mon Sep 17 00:00:00 2001 From: halleyscometsw Date: Fri, 4 Apr 2008 01:24:57 +0000 Subject: [PATCH] revert to rev 68 git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@70 51a99a44-fe44-0410-b1ba-c3e57ba2b86b --- src/meta/adx_header.c | 1 - src/streamfile.c | 6 +-- src/streamtypes.h | 92 +++++++++++++++++++++---------------------- src/util.c | 24 ----------- src/util.h | 6 --- src/vgmstream.c | 6 +-- winamp/in_vgmstream.c | 35 +++++++++------- 7 files changed, 73 insertions(+), 97 deletions(-) diff --git a/src/meta/adx_header.c b/src/meta/adx_header.c index 7e37c451..d7d630f8 100644 --- a/src/meta/adx_header.c +++ b/src/meta/adx_header.c @@ -1,7 +1,6 @@ #ifdef _MSC_VER #define _USE_MATH_DEFINES #endif - #include #include "adx_header.h" #include "../util.h" diff --git a/src/streamfile.c b/src/streamfile.c index 645c1309..234a9ad5 100644 --- a/src/streamfile.c +++ b/src/streamfile.c @@ -67,7 +67,7 @@ size_t read_the_rest(uint8_t * dest, off_t offset, size_t length, STREAMFILE * s size_t length_to_read; size_t length_read=0; streamfile->validsize=0; - if (fseek(streamfile->infile,offset,SEEK_SET)) return length_read; + if (fseeko(streamfile->infile,offset,SEEK_SET)) return length_read; streamfile->offset=offset; /* decide how much must be read this time */ @@ -97,6 +97,6 @@ size_t read_the_rest(uint8_t * dest, off_t offset, size_t length, STREAMFILE * s } size_t get_streamfile_size(STREAMFILE * streamfile) { - fseek(streamfile->infile,0,SEEK_END); - return ftell(streamfile->infile); + fseeko(streamfile->infile,0,SEEK_END); + return ftello(streamfile->infile); } diff --git a/src/streamtypes.h b/src/streamtypes.h index cecbf6cc..b05ee779 100644 --- a/src/streamtypes.h +++ b/src/streamtypes.h @@ -1,46 +1,46 @@ -/* - * streamtypes.h - widely used type definitions - */ - - -#ifndef _STREAMTYPES_H -#define _STREAMTYPES_H - -#ifdef _MSC_VER -#include "pstdint.h" -#define inline _inline -#define strcasecmp _stricmp -#define snprintf _snprintf -#else -#include -#endif - -typedef int16_t sample; - -struct g72x_state { - long yl; /* Locked or steady state step size multiplier. */ - short yu; /* Unlocked or non-steady state step size multiplier. */ - short dms; /* Short term energy estimate. */ - short dml; /* Long term energy estimate. */ - short ap; /* Linear weighting coefficient of 'yl' and 'yu'. */ - - short a[2]; /* Coefficients of pole portion of prediction filter. */ - short b[6]; /* Coefficients of zero portion of prediction filter. */ - short pk[2]; /* - * Signs of previous two samples of a partially - * reconstructed signal. - */ - short dq[6]; /* - * Previous 6 samples of the quantized difference - * signal represented in an internal floating point - * format. - */ - short sr[2]; /* - * Previous 2 samples of the quantized difference - * signal represented in an internal floating point - * format. - */ - char td; /* delayed tone detect, new in 1988 version */ -}; - -#endif +/* + * streamtypes.h - widely used type definitions + */ + + +#ifndef _STREAMTYPES_H +#define _STREAMTYPES_H + +#ifdef _MSC_VER +#include "pstdint.h" +#define inline _inline +#define strcasecmp _stricmp +#define snprintf _snprintf +#else +#include +#endif + +typedef int16_t sample; + +struct g72x_state { + long yl; /* Locked or steady state step size multiplier. */ + short yu; /* Unlocked or non-steady state step size multiplier. */ + short dms; /* Short term energy estimate. */ + short dml; /* Long term energy estimate. */ + short ap; /* Linear weighting coefficient of 'yl' and 'yu'. */ + + short a[2]; /* Coefficients of pole portion of prediction filter. */ + short b[6]; /* Coefficients of zero portion of prediction filter. */ + short pk[2]; /* + * Signs of previous two samples of a partially + * reconstructed signal. + */ + short dq[6]; /* + * Previous 6 samples of the quantized difference + * signal represented in an internal floating point + * format. + */ + short sr[2]; /* + * Previous 2 samples of the quantized difference + * signal represented in an internal floating point + * format. + */ + char td; /* delayed tone detect, new in 1988 version */ +}; + +#endif diff --git a/src/util.c b/src/util.c index 3e9087bd..ba9aad20 100644 --- a/src/util.c +++ b/src/util.c @@ -142,27 +142,3 @@ void concatn_doublenull(int length, char * dst, const char * src) { dst[i]='\0'; dst[i+1]='\0'; } - -/* -* The following block of code is used for stuff like Winamp, etc. -* If you aren't building a plugin, disregard this. -*/ - -#define SUPPORTED_FORMATS 11 - -char * Supported_Format_List[] = { - "adx\0", - "afc\0", - "agsc\0", - "ast\0", - "brstm\0", - "hps\0", - "strm\0", - "adp\0", - "rsf\0", - "dsp\0", - "gcw\0", -}; - -int GetSupportedFormats(void) { return SUPPORTED_FORMATS; } -char * GetSupportedFormatById (int id) { return &Supported_Format_List[id]; } \ No newline at end of file diff --git a/src/util.h b/src/util.h index df6504f7..57fcca03 100644 --- a/src/util.h +++ b/src/util.h @@ -7,8 +7,6 @@ #ifndef _UTIL_H #define _UTIL_H -#define strcasecmp strcmp - /* host endian independent multi-byte integer reading */ static inline int16_t get_16bitBE(uint8_t * p) { @@ -65,8 +63,4 @@ void make_wav_header(uint8_t * buf, int32_t sample_count, int32_t sample_rate, i void concatn(int length, char * dst, const char * src); void concatn_doublenull(int length, char * dst, const char * src); - -int GetSupportedFormats(void); -char * GetSupportedFormatById (int id); - #endif diff --git a/src/vgmstream.c b/src/vgmstream.c index eb6bd382..bb2067e3 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -561,10 +561,10 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { /* */ #define DFS_PAIR_COUNT 4 const char * const dfs_pairs[DFS_PAIR_COUNT][2] = { - {"_L","_R"}, - {"_l","_r"}, + {"L","R"}, + {"l","r"}, {"_0","_1"}, - {"_left","_right"}, + {"left","right"}, }; void try_dual_file_stereo(VGMSTREAM * opened_stream, const char * const filename) { diff --git a/winamp/in_vgmstream.c b/winamp/in_vgmstream.c index f3de80ca..6e8e4dad 100644 --- a/winamp/in_vgmstream.c +++ b/winamp/in_vgmstream.c @@ -15,7 +15,6 @@ #include "../src/util.h" #include "in2.h" - #ifndef VERSION #define VERSION #endif @@ -34,7 +33,6 @@ short sample_buffer[576*2*2]; /* 576 16-bit samples, stereo, possibly doubled in /* hardcode these now, TODO will be configurable later */ const double fade_seconds = 10.0; const double loop_count = 2.0; -int loop_inf=1; /* Loop infinitely */ VGMSTREAM * vgmstream = NULL; HANDLE decode_thread_handle = INVALID_HANDLE_VALUE; @@ -45,9 +43,22 @@ int decode_pos_samples = 0; int stream_length_samples = 0; int fade_samples = 0; -/* TODO: Get vgmstream to make this list for us. */ #define EXTENSION_LIST_SIZE 1024 char working_extension_list[EXTENSION_LIST_SIZE] = {0}; +#define EXTENSION_COUNT 11 +char * extension_list[EXTENSION_COUNT] = { + "adx\0ADX Audio File (*.ADX)\0", + "afc\0AFC Audio File (*.AFC)\0", + "agsc\0AGSC Audio File (*.AGSC)\0", + "ast\0AST Audio File (*.AST)\0", + "brstm\0BRSTM Audio File (*.BRSTM)\0", + "hps\0HALPST Audio File (*.HPS)\0", + "strm\0STRM Audio File (*.STRM)\0", + "adp\0ADP Audio File (*.ADP)\0", + "rsf\0RSF Audio File (*.RSF)\0", + "dsp\0DSP Audio File (*.DSP)\0", + "gcw\0GCW Audio File (*.GCW)\0", +}; /* stubs, we don't do anything fancy yet */ void config(HWND hwndParent) {} @@ -55,17 +66,13 @@ void about(HWND hwndParent) {} void quit() {} void build_extension_list() { - int i, ext_cnt=0; - char BUFFAR[9]; - working_extension_list[0]='\0'; + int i; + working_extension_list[0]='\0'; working_extension_list[1]='\0'; - // Get stuff. - ext_cnt = GetSupportedFormats(); - - for (i=0;istream_length_samples) && (!vgmstream->loop_flag && loop_inf)) + if (decode_pos_samples+576>stream_length_samples) samples_to_do=stream_length_samples-decode_pos_samples; else samples_to_do=576; @@ -274,7 +281,7 @@ DWORD WINAPI __stdcall decode(void *arg) { render_vgmstream(sample_buffer,samples_to_do,vgmstream); /* fade! */ - if (vgmstream->loop_flag && fade_samples > 0 && !loop_inf) { + if (vgmstream->loop_flag && fade_samples > 0) { int samples_into_fade = decode_pos_samples - (stream_length_samples - fade_samples); if (samples_into_fade + samples_to_do > 0) { int j,k;