revert to rev 68

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@70 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
halleyscometsw 2008-04-04 01:24:57 +00:00
parent 91dbfd36f8
commit 017b6e9e83
7 changed files with 73 additions and 97 deletions

View File

@ -1,7 +1,6 @@
#ifdef _MSC_VER
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#include "adx_header.h"
#include "../util.h"

View File

@ -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);
}

View File

@ -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 <stdint.h>
#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 <stdint.h>
#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

View File

@ -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]; }

View File

@ -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

View File

@ -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) {

View File

@ -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;i<ext_cnt;i++) {
strcpy(BUFFAR,GetSupportedFormatById(i));
sprintf(working_extension_list[i],"%s\0%s Audio File (*.%s)\0",BUFFAR,BUFFAR,BUFFAR);
for (i=0;i<EXTENSION_COUNT;i++) {
concatn_doublenull(EXTENSION_LIST_SIZE,working_extension_list,
extension_list[i]);
}
}
@ -252,7 +259,7 @@ DWORD WINAPI __stdcall decode(void *arg) {
int samples_to_do;
int l;
if ((decode_pos_samples+576>stream_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;