uFMOD 1.25.1 from Quantum and some minor bugfixes

git-svn-id: svn://kolibrios.org@646 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-10-14 17:38:57 +00:00
parent b2579e99a5
commit 38ed47b73c
7 changed files with 1593 additions and 1359 deletions

View File

@ -1,22 +1,24 @@
 
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005 # Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ac97snd", "ac97snd\ac97snd.vcproj", "{5146AAEE-C15C-47C5-A245-64050C820145}"
ProjectSection(ProjectDependencies) = postProject
{6BB005B0-3277-4C8C-950F-38E15A4E440C} = {6BB005B0-3277-4C8C-950F-38E15A4E440C}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpg", "mpg\mpg.vcproj", "{6BB005B0-3277-4C8C-950F-38E15A4E440C}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpg", "mpg\mpg.vcproj", "{6BB005B0-3277-4C8C-950F-38E15A4E440C}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ac97snd", "ac97snd\ac97snd.vcproj", "{5146AAEE-C15C-47C5-A245-64050C820145}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5146AAEE-C15C-47C5-A245-64050C820145}.Release|Win32.ActiveCfg = Release|Win32 {6BB005B0-3277-4C8C-950F-38E15A4E440C}.Debug|Win32.ActiveCfg = Debug|Win32
{5146AAEE-C15C-47C5-A245-64050C820145}.Release|Win32.Build.0 = Release|Win32 {6BB005B0-3277-4C8C-950F-38E15A4E440C}.Debug|Win32.Build.0 = Debug|Win32
{6BB005B0-3277-4C8C-950F-38E15A4E440C}.Release|Win32.ActiveCfg = Release|Win32 {6BB005B0-3277-4C8C-950F-38E15A4E440C}.Release|Win32.ActiveCfg = Release|Win32
{6BB005B0-3277-4C8C-950F-38E15A4E440C}.Release|Win32.Build.0 = Release|Win32 {6BB005B0-3277-4C8C-950F-38E15A4E440C}.Release|Win32.Build.0 = Release|Win32
{5146AAEE-C15C-47C5-A245-64050C820145}.Debug|Win32.ActiveCfg = Debug|Win32
{5146AAEE-C15C-47C5-A245-64050C820145}.Debug|Win32.Build.0 = Debug|Win32
{5146AAEE-C15C-47C5-A245-64050C820145}.Release|Win32.ActiveCfg = Release|Win32
{5146AAEE-C15C-47C5-A245-64050C820145}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -14,7 +14,7 @@
</Platforms> </Platforms>
<ToolFiles> <ToolFiles>
<ToolFile <ToolFile
RelativePath="../fasm.rules" RelativePath="..\..\..\VStudio 8\Common7\IDE\fasm.rules"
/> />
</ToolFiles> </ToolFiles>
<Configurations> <Configurations>
@ -141,7 +141,8 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="2" Optimization="2"
EnableIntrinsicFunctions="true" InlineFunctionExpansion="0"
EnableIntrinsicFunctions="false"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
@ -166,7 +167,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="$(OutDir)\sound.lib $(OutDir)\mpg.lib" AdditionalDependencies="$(OutDir)\sound.lib $(OutDir)\mpg.lib $(OutDir)\ufmod.obj"
LinkIncremental="1" LinkIncremental="1"
GenerateManifest="false" GenerateManifest="false"
IgnoreAllDefaultLibraries="true" IgnoreAllDefaultLibraries="true"
@ -221,6 +222,17 @@
<File <File
RelativePath=".\ac97wav.c" RelativePath=".\ac97wav.c"
> >
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="0"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath=".\crt.c" RelativePath=".\crt.c"

View File

@ -18,7 +18,8 @@
#include "ac97wav.h" #include "ac97wav.h"
#include "../mpg/mpg123.h" #include "../mpg/mpg123.h"
#include "../sound.h" #include "../sound.h"
#include "../ufmod-codec.h" /* uFMOD integration */
void exit(); /* uFMOD integration */
#define MP3_ERROR_OUT_OF_BUFFER 5 #define MP3_ERROR_OUT_OF_BUFFER 5
int m_last_error; int m_last_error;
@ -29,7 +30,10 @@ void _stdcall send_ipc(int dst, DWORD code);
void touch(char *buf, int size); void touch(char *buf, int size);
int mp3FindSync(byte* buf, int size, int* sync); int mp3FindSync(byte* buf, int size, int* sync);
int stream_read_raw(struct reader *rd,unsigned char *buf, int size); int stream_read_raw(struct reader *rd,unsigned char *buf, int size);
int __cdecl _stricmp (const char * dst, const char * src);
char *__cdecl strrchr (const char * string,int ch);
char *fname; char *fname;
@ -43,6 +47,8 @@ SNDBUF hBuff;
CTRL_INFO info; CTRL_INFO info;
FILEINFO fileinfo; FILEINFO fileinfo;
const char *filename;
const char *fileext;
int m_vol; int m_vol;
int l_vol=-700; //-7db int l_vol=-700; //-7db
@ -62,14 +68,18 @@ int outsize;
int outremain; int outremain;
int totalout; int totalout;
int done; int done;
char header[] = "AC97 MP3 player";
char buttons_text[]=" Play Stop << >> Vol- Vol+";
char header[] = "AC97 MP3 player";
char buttons_xm[] = " Play Stop Vol- Vol+"; /* uFMOD integration */
char buttons_wav[] = " Play Stop << >> Vol- Vol+"; /* uFMOD integration */
char *buttons_text = buttons_wav; /* uFMOD integration */
void play_xm(); /* uFMOD integration */
void (*snd_play)(); void (*snd_play)();
void draw_window() void draw_window()
{ {
int len; /* uFMOD integration */
BeginDraw(); BeginDraw();
DrawWindow(100,100,299,72,0x404040,3,0,0,0); DrawWindow(100,100,299,72,0x404040,3,0,0,0);
@ -85,19 +95,20 @@ void draw_window()
draw_bar(7,41,286,11,0x404040); draw_bar(7,41,286,11,0x404040);
draw_bar(7,55,286,11,0x404040); draw_bar(7,55,286,11,0x404040);
write_text(12,58,0x004000|FONT0, fname, strlen(fname)); len = strlen(filename); /* uFMOD integration */
write_text(11,57,0x00FF20|FONT0, fname, strlen(fname)); if(len > 47) len = 47; /* uFMOD integration */
write_text(11,57,0x00FF20|FONT0, filename, len); /* uFMOD integration */
write_text(8,8,0xFFFFFF|FONT0, header, strlen(header)); write_text(8,8,FONT0, header, sizeof(header)-1); /* uFMOD integration */
write_text(12,28,0x404040|FONT0,buttons_text,strlen(buttons_text)); write_text(12,28,0x404040|FONT0,buttons_text,sizeof(buttons_wav)-1); /* uFMOD integration */
write_text(11,27,0xA0FFA0|FONT0,buttons_text,strlen(buttons_text)); write_text(11,27,0xA0FFA0|FONT0,buttons_text,sizeof(buttons_wav)-1); /* uFMOD integration */
EndDraw(); EndDraw();
}; };
void draw_progress_bar() void draw_progress_bar()
{ DWORD x; { DWORD x;
x = 287.0f * (float)(rd.filepos-rd.strremain)/(float)fileinfo.size; x = (DWORD)(287.0f * (float)(rd.filepos-rd.strremain)/(float)fileinfo.size); /* uFMOD integration */
if(x==0) return; if(x==0) return;
draw_bar(7,41,x,11,0xA0A0A0); draw_bar(7,41,x,11,0xA0A0A0);
draw_bar(x+7,41,287-x,11,0x404040); draw_bar(x+7,41,287-x,11,0x404040);
@ -119,6 +130,7 @@ int main(int argc, char *argv[]) //int argc, char *argv[])
int retval; int retval;
int err; int err;
int ver; int ver;
unsigned char *ttl, *cur; /* uFMOD integration */
fname = argv[1]; fname = argv[1];
debug_out_str("\n\rPlay file "); debug_out_str("\n\rPlay file ");
@ -157,28 +169,74 @@ int main(int argc, char *argv[]) //int argc, char *argv[])
create_reader(&rd, inpbuf, 0x10000); create_reader(&rd, inpbuf, 0x10000);
init_reader(&rd,fname); init_reader(&rd,fname);
fmt = test_wav((WAVEHEADER*)testbuff); filename = strrchr(fname,'/')+1;
if (fmt != 0) if( !(fileext = strrchr(filename,'.')))
return 0;
if(!_stricmp(fileext,".mp3"))
{ {
snd_play = &play_wave; fmt = test_mp3(testbuff);
set_reader(&rd, 44); if(!fmt)
outbuf = UserAlloc(32*1024); {
touch(outbuf, 32768); debug_out_str("\n\rInvalid MP3 file");
} return 0;
else };
{ fmt = test_mp3(testbuff); snd_play = &play_mp3;
if(fmt ==0) return 0; outremain = 0x40000;
snd_play = &play_mp3; outbuf = UserAlloc(outremain);
touch(outbuf, outremain);
outremain = 0x40000 ; make_decode_tables(32767);
outbuf = UserAlloc(outremain); init_layer2();
touch(outbuf, outremain); init_layer3(32);
make_decode_tables(32767); fr.single = -1;
init_layer2(); goto play;
init_layer3(32);
fr.single = -1;
}; };
if(!_stricmp(fileext,".xm"))
{
if(uFMOD_LoadSong(fname))
{
buttons_text = buttons_xm; /* uFMOD integration */
fmt = PCM_2_16_48; /* uFMOD integration */
snd_play = &play_xm; /* uFMOD integration */
ttl = uFMOD_GetTitle(); /* uFMOD integration */
cur = ttl; /* uFMOD integration */
err = 0; /* uFMOD integration */
while(*cur && *cur++ != ' ') err++; /* uFMOD integration */
if(err){ /* uFMOD integration */
cur = fname; /* uFMOD integration */
while(*cur) cur++; /* uFMOD integration */
*cur++ = ' '; /* uFMOD integration */
*cur++ = '|'; /* uFMOD integration */
*cur++ = ' '; /* uFMOD integration */
while(*ttl) *cur++ = *ttl++; /* uFMOD integration */
}
goto play;
}
debug_out_str("\n\rInvalid XM file");
return 0;
};
if(!_stricmp(fileext, ".wav"))
{
fmt = test_wav((WAVEHEADER*)testbuff);
if(fmt)
{
snd_play = &play_wave;
set_reader(&rd, 44);
outbuf = UserAlloc(32*1024);
touch(outbuf, 32768);
goto play;
}
debug_out_str("\n\rInvalid WAV file");
return 0;
};
debug_out_str("\n\rUsupported file");
return 0;
play:
status = ST_PLAY; status = ST_PLAY;
@ -206,6 +264,7 @@ int main(int argc, char *argv[]) //int argc, char *argv[])
continue; continue;
case ST_EXIT: case ST_EXIT:
uFMOD_StopSong(); /* uFMOD integration */
StopBuffer(hBuff); StopBuffer(hBuff);
DestroyBuffer(hBuff); DestroyBuffer(hBuff);
return 0; return 0;
@ -217,7 +276,7 @@ int main(int argc, char *argv[]) //int argc, char *argv[])
void touch(char *buf, int size) void touch(char *buf, int size)
{ int i; { int i;
char a; char a;
for ( i = 0;i < size; i+=4096) for ( i = 0;i < size; i+=4096) //alloc all pages
a = buf[i]; a = buf[i];
}; };
@ -231,13 +290,20 @@ DWORD test_mp3(char *buf)
if(!rd.head_read(&rd,&hdr)) if(!rd.head_read(&rd,&hdr))
return 0; return 0;
if(!decode_header(&fr,hdr)) if(!decode_header(&fr,hdr))
{ rd.strpos-=3; {
rd.stream-=3; if((hdr & 0xffffff00) == 0x49443300)
rd.strremain+=3; {
continue; int id3length = 0;
id3length = parse_new_id3(&rd, hdr);
continue;
};
rd.strpos-=3;
rd.stream-=3;
rd.strremain+=3;
continue;
}; };
break; break;
}; };
first_sync = rd.filepos-rd.strremain-4; first_sync = rd.filepos-rd.strremain-4;
@ -245,7 +311,7 @@ DWORD test_mp3(char *buf)
whdr.riff_format = 0x45564157; whdr.riff_format = 0x45564157;
whdr.wFormatTag = 0x01; whdr.wFormatTag = 0x01;
whdr.nSamplesPerSec = freqs[fr.sampling_frequency]; whdr.nSamplesPerSec = freqs[fr.sampling_frequency];
whdr.nChannels = 2; //mpginfo.channels; whdr.nChannels = 2;
whdr.wBitsPerSample = 16; whdr.wBitsPerSample = 16;
return test_wav(&whdr); return test_wav(&whdr);
@ -324,26 +390,35 @@ void play_mp3()
}; };
void play_wave() void play_wave()
{ int retval; { int count;
set_reader(&rd,44); set_reader(&rd,44);
retval = 0;
while(1) while(1)
{ {
if(status!=ST_PLAY) if(status!=ST_PLAY)
break; break;
if( !stream_read_raw(&rd,outbuf,32768)) if( count=stream_read_raw(&rd,outbuf,32768))
{ done = 1; {
break; WaveOut(hBuff,outbuf,count);
}; continue;
WaveOut(hBuff,outbuf,32768); }
done = 1;
break;
}; };
if(status != ST_EXIT) if(status != ST_EXIT)
status = ST_STOP; status = ST_STOP;
}; };
void play_xm(){ /* uFMOD integration */
while(status == ST_PLAY){ /* uFMOD integration */
uFMOD_WaveOut(hBuff); /* uFMOD integration */
delay(8); /* uFMOD integration */
} /* uFMOD integration */
if(status != ST_EXIT) status = ST_STOP; /* uFMOD integration */
} /* uFMOD integration */
void snd_stop() void snd_stop()
{ {
StopBuffer(hBuff); StopBuffer(hBuff);
@ -519,7 +594,7 @@ void EndDraw()
}; };
///********* ///*********
void *memmove ( void * dst, void * src, int count) void *memmove ( void * dst, void * src, unsigned int count) /* uFMOD integration */
{ void *ret; { void *ret;
ret = dst; ret = dst;
@ -555,6 +630,40 @@ void * __cdecl mem_cpy(void * dst,const void * src,size_t count)
return(ret); return(ret);
} }
char * __cdecl strrchr (const char * string,int ch)
{
char *start = (char *)string;
while (*string++) /* find end of string */
;
/* search towards front */
while (--string != start && *string != (char)ch)
;
if (*string == (char)ch) /* char found ? */
return( (char *)string );
return(NULL);
}
int __cdecl _stricmp (const char * dst, const char * src)
{
int f, l;
do
{
if ( ((f = (unsigned char)(*(dst++))) >= 'A') && (f <= 'Z') )
f -= 'A' - 'a';
if ( ((l = (unsigned char)(*(src++))) >= 'A') && (l <= 'Z') )
l -= 'A' - 'a';
}
while ( f && (f == l) );
return(f - l);
}
// debug_out_str(formats[fmt]); // debug_out_str(formats[fmt]);
// debug_out_str("\x0D\x0A\x00"); // debug_out_str("\x0D\x0A\x00");
@ -584,6 +693,3 @@ void * __cdecl mem_cpy(void * dst,const void * src,size_t count)
// debug_out_hex(fmt); // debug_out_hex(fmt);
// debug_out_str("\x0D\x0A\x00"); // debug_out_str("\x0D\x0A\x00");

View File

@ -14,7 +14,7 @@
</Platforms> </Platforms>
<ToolFiles> <ToolFiles>
<ToolFile <ToolFile
RelativePath="../fasm.rules" RelativePath="..\..\..\VStudio 8\Common7\IDE\fasm.rules"
/> />
</ToolFiles> </ToolFiles>
<Configurations> <Configurations>
@ -229,6 +229,16 @@
<File <File
RelativePath=".\readers.c" RelativePath=".\readers.c"
> >
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
EnableIntrinsicFunctions="true"
WholeProgramOptimization="true"
AssemblerOutput="1"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath=".\tabinit.c" RelativePath=".\tabinit.c"

View File

@ -1,361 +1,361 @@
/* /*
mpg123: main code of the program (not of the decoder...) mpg123: main code of the program (not of the decoder...)
copyright 1995-2006 by the mpg123 project - free software under the terms of the LGPL 2.1 copyright 1995-2006 by the mpg123 project - free software under the terms of the LGPL 2.1
see COPYING and AUTHORS files in distribution or http://mpg123.de see COPYING and AUTHORS files in distribution or http://mpg123.de
initially written by Michael Hipp initially written by Michael Hipp
mpg123 defines mpg123 defines
used source: musicout.h from mpegaudio package used source: musicout.h from mpegaudio package
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <math.h> #include <math.h>
#ifndef _AUDIO_H_ #ifndef _AUDIO_H_
#define _AUDIO_H_ #define _AUDIO_H_
typedef unsigned char byte; typedef unsigned char byte;
#define off_t long #define off_t long
//#define I486_OPT 1 //#define I486_OPT 1
#define SKIP_JUNK 1 #define SKIP_JUNK 1
# define M_PI 3.14159265358979323846 # define M_PI 3.14159265358979323846
# define M_SQRT2 1.41421356237309504880 # define M_SQRT2 1.41421356237309504880
# define REAL_IS_FLOAT # define REAL_IS_FLOAT
# define NEW_DCT9 # define NEW_DCT9
#ifdef REAL_IS_FLOAT #ifdef REAL_IS_FLOAT
# define real float # define real float
# define REAL_SCANF "%f" # define REAL_SCANF "%f"
# define REAL_PRINTF "%f" # define REAL_PRINTF "%f"
#else #else
# define real double # define real double
# define REAL_SCANF "%lf" # define REAL_SCANF "%lf"
# define REAL_PRINTF "%f" # define REAL_PRINTF "%f"
#endif #endif
#ifndef DOUBLE_TO_REAL #ifndef DOUBLE_TO_REAL
# define DOUBLE_TO_REAL(x) (x) # define DOUBLE_TO_REAL(x) (x)
#endif #endif
#ifndef REAL_TO_SHORT #ifndef REAL_TO_SHORT
# define REAL_TO_SHORT(x) (x) # define REAL_TO_SHORT(x) (x)
#endif #endif
#ifndef REAL_PLUS_32767 #ifndef REAL_PLUS_32767
# define REAL_PLUS_32767 32767.0 # define REAL_PLUS_32767 32767.0
#endif #endif
#ifndef REAL_MINUS_32768 #ifndef REAL_MINUS_32768
# define REAL_MINUS_32768 -32768.0 # define REAL_MINUS_32768 -32768.0
#endif #endif
#ifndef REAL_MUL #ifndef REAL_MUL
# define REAL_MUL(x, y) ((x) * (y)) # define REAL_MUL(x, y) ((x) * (y))
#endif #endif
#define INLINE #define INLINE
/* AUDIOBUFSIZE = n*64 with n=1,2,3 ... */ /* AUDIOBUFSIZE = n*64 with n=1,2,3 ... */
#define AUDIOBUFSIZE 16384 #define AUDIOBUFSIZE 16384
#define FALSE 0 #define FALSE 0
#define TRUE 1 #define TRUE 1
#define MAX_NAME_SIZE 81 #define MAX_NAME_SIZE 81
#define SBLIMIT 32 #define SBLIMIT 32
#define SCALE_BLOCK 12 #define SCALE_BLOCK 12
#define SSLIMIT 18 #define SSLIMIT 18
#define MPG_MD_STEREO 0 #define MPG_MD_STEREO 0
#define MPG_MD_JOINT_STEREO 1 #define MPG_MD_JOINT_STEREO 1
#define MPG_MD_DUAL_CHANNEL 2 #define MPG_MD_DUAL_CHANNEL 2
#define MPG_MD_MONO 3 #define MPG_MD_MONO 3
/* I suspect that 32767 would be a better idea here, but Michael put this in... */ /* I suspect that 32767 would be a better idea here, but Michael put this in... */
#define MAXOUTBURST 32768 #define MAXOUTBURST 32768
/* Pre Shift fo 16 to 8 bit converter table */ /* Pre Shift fo 16 to 8 bit converter table */
#define AUSHIFT (3) #define AUSHIFT (3)
struct bitstream_info struct bitstream_info
{ int bitindex; { int bitindex;
unsigned char *wordpointer; unsigned char *wordpointer;
}; };
extern struct bitstream_info bsi; extern struct bitstream_info bsi;
struct reader struct reader
{ {
char *hFile; char *hFile;
unsigned char *buffer; unsigned char *buffer;
unsigned char *stream; unsigned char *stream;
int strpos; int strpos;
int strremain; int strremain;
int filelen; int filelen;
int filepos; int filepos;
int (*head_read)(struct reader *,unsigned long *newhead); int (*head_read)(struct reader *,unsigned long *newhead);
int (*read_frame_body)(struct reader *,unsigned char *,int size); int (*read_frame_body)(struct reader *,unsigned char *,int size);
}; };
int parse_new_id3(struct reader *rd, unsigned long newhead); int parse_new_id3(struct reader *rd, unsigned long newhead);
struct al_table struct al_table
{ short bits; { short bits;
short d; short d;
}; };
struct frame { struct frame {
struct al_table *alloc; struct al_table *alloc;
int (*synth)(real *,int,unsigned char *,int *); int (*synth)(real *,int,unsigned char *,int *);
int (*synth_mono)(real *,unsigned char *,int *); int (*synth_mono)(real *,unsigned char *,int *);
int stereo; /* I _think_ 1 for mono and 2 for stereo */ int stereo; /* I _think_ 1 for mono and 2 for stereo */
int jsbound; int jsbound;
int single; int single;
int II_sblimit; int II_sblimit;
int down_sample_sblimit; int down_sample_sblimit;
int lsf; /* 0: MPEG 1.0; 1: MPEG 2.0/2.5 -- both used as bool and array index! */ int lsf; /* 0: MPEG 1.0; 1: MPEG 2.0/2.5 -- both used as bool and array index! */
int mpeg25; int mpeg25;
int down_sample; int down_sample;
int header_change; int header_change;
int lay; int lay;
int (*do_layer)(struct frame *fr,byte *pcm_out, int *pcm_size); int (*do_layer)(struct frame *fr,byte *pcm_out, int *pcm_size);
int error_protection; int error_protection;
int bitrate_index; int bitrate_index;
int sampling_frequency; int sampling_frequency;
int padding; int padding;
int extension; int extension;
int mode; int mode;
int mode_ext; int mode_ext;
int copyright; int copyright;
int original; int original;
int emphasis; int emphasis;
int framesize; /* computed framesize */ int framesize; /* computed framesize */
int vbr; /* 1 if variable bitrate was detected */ int vbr; /* 1 if variable bitrate was detected */
unsigned long num; /* the nth frame in some stream... */ unsigned long num; /* the nth frame in some stream... */
}; };
#if 0 #if 0
struct parameter { struct parameter {
int aggressive; /* renice to max. priority */ int aggressive; /* renice to max. priority */
int shuffle; /* shuffle/random play */ int shuffle; /* shuffle/random play */
int remote; /* remote operation */ int remote; /* remote operation */
int remote_err; /* remote operation to stderr */ int remote_err; /* remote operation to stderr */
int outmode; /* where to out the decoded sampels */ int outmode; /* where to out the decoded sampels */
int quiet; /* shut up! */ int quiet; /* shut up! */
int xterm_title; /* Change xterm title to song names? */ int xterm_title; /* Change xterm title to song names? */
long usebuffer; /* second level buffer size */ long usebuffer; /* second level buffer size */
int tryresync; /* resync stream after error */ int tryresync; /* resync stream after error */
int verbose; /* verbose level */ int verbose; /* verbose level */
int force_mono; int force_mono;
int force_stereo; int force_stereo;
int force_8bit; int force_8bit;
long force_rate; long force_rate;
int down_sample; int down_sample;
int checkrange; int checkrange;
long doublespeed; long doublespeed;
long halfspeed; long halfspeed;
int force_reopen; int force_reopen;
long realtime; long realtime;
char filename[256]; char filename[256];
long listentry; /* possibility to choose playback of one entry in playlist (0: off, > 0 : select, < 0; just show list*/ long listentry; /* possibility to choose playback of one entry in playlist (0: off, > 0 : select, < 0; just show list*/
int rva; /* (which) rva to do: <0: nothing, 0: radio/mix/track 1: album/audiophile */ int rva; /* (which) rva to do: <0: nothing, 0: radio/mix/track 1: album/audiophile */
char* listname; /* name of playlist */ char* listname; /* name of playlist */
int long_id3; int long_id3;
}; };
#endif #endif
#if 0 #if 0
struct reader { struct reader {
int (*init)(struct reader *); int (*init)(struct reader *);
void (*close)(struct reader *); void (*close)(struct reader *);
int (*head_read)(struct reader *,unsigned long *newhead); int (*head_read)(struct reader *,unsigned long *newhead);
int (*head_shift)(struct reader *,unsigned long *head); int (*head_shift)(struct reader *,unsigned long *head);
long (*skip_bytes)(struct reader *,off_t len); long (*skip_bytes)(struct reader *,off_t len);
int (*read_frame_body)(struct reader *,unsigned char *,int size); int (*read_frame_body)(struct reader *,unsigned char *,int size);
int (*back_bytes)(struct reader *,off_t bytes); int (*back_bytes)(struct reader *,off_t bytes);
int (*back_frame)(struct reader *,struct frame *,long num); int (*back_frame)(struct reader *,struct frame *,long num);
off_t (*tell)(struct reader *); off_t (*tell)(struct reader *);
void (*rewind)(struct reader *); void (*rewind)(struct reader *);
off_t filelen; off_t filelen;
off_t filepos; off_t filepos;
int filept; int filept;
int flags; int flags;
unsigned char id3buf[128]; unsigned char id3buf[128];
}; };
#endif #endif
#define READER_FD_OPENED 0x1 #define READER_FD_OPENED 0x1
#define READER_ID3TAG 0x2 #define READER_ID3TAG 0x2
#define READER_SEEKABLE 0x4 #define READER_SEEKABLE 0x4
//extern void audio_flush(int, struct audio_info_struct *); //extern void audio_flush(int, struct audio_info_struct *);
//extern void print_header(struct frame *); //extern void print_header(struct frame *);
//extern void print_header_compact(struct frame *); //extern void print_header_compact(struct frame *);
//extern void print_id3_tag(unsigned char *buf); //extern void print_id3_tag(unsigned char *buf);
//extern int split_dir_file(const char *path, char **dname, char **fname); //extern int split_dir_file(const char *path, char **dname, char **fname);
extern unsigned int get1bit(void); extern unsigned int get1bit(void);
extern unsigned int getbits(int); extern unsigned int getbits(int);
extern unsigned int getbits_fast(int); extern unsigned int getbits_fast(int);
//extern void backbits(int); //extern void backbits(int);
//extern int getbitoffset(void); //extern int getbitoffset(void);
//extern int getbyte(void); //extern int getbyte(void);
//extern void set_pointer(long); //extern void set_pointer(long);
//extern unsigned char *pcm_sample; //extern unsigned char *pcm_sample;
//extern int pcm_point; //extern int pcm_point;
//extern int audiobufsize; //extern int audiobufsize;
//extern int OutputDescriptor; //extern int OutputDescriptor;
#ifdef VARMODESUPPORT #ifdef VARMODESUPPORT
extern int varmode; extern int varmode;
extern int playlimit; extern int playlimit;
#endif #endif
struct gr_info_s { struct gr_info_s {
int scfsi; int scfsi;
unsigned part2_3_length; unsigned part2_3_length;
unsigned big_values; unsigned big_values;
unsigned scalefac_compress; unsigned scalefac_compress;
unsigned block_type; unsigned block_type;
unsigned mixed_block_flag; unsigned mixed_block_flag;
unsigned table_select[3]; unsigned table_select[3];
unsigned subblock_gain[3]; unsigned subblock_gain[3];
unsigned maxband[3]; unsigned maxband[3];
unsigned maxbandl; unsigned maxbandl;
unsigned maxb; unsigned maxb;
unsigned region1start; unsigned region1start;
unsigned region2start; unsigned region2start;
unsigned preflag; unsigned preflag;
unsigned scalefac_scale; unsigned scalefac_scale;
unsigned count1table_select; unsigned count1table_select;
real *full_gain[3]; real *full_gain[3];
real *pow2gain; real *pow2gain;
}; };
struct III_sideinfo struct III_sideinfo
{ {
unsigned main_data_begin; unsigned main_data_begin;
unsigned private_bits; unsigned private_bits;
struct { struct {
struct gr_info_s gr[2]; struct gr_info_s gr[2];
} ch[2]; } ch[2];
}; };
extern int open_stream(char *,int fd); extern int open_stream(char *,int fd);
extern void read_frame_init (struct frame* fr); extern void read_frame_init (struct frame* fr);
int read_frame(struct reader *rd, struct frame *fr); int read_frame(struct reader *rd, struct frame *fr);
/* why extern? */ /* why extern? */
void prepare_audioinfo(struct frame *fr, struct audio_info_struct *nai); void prepare_audioinfo(struct frame *fr, struct audio_info_struct *nai);
int play_frame(int init,struct frame *fr); int play_frame(int init,struct frame *fr);
int do_layer1(struct frame *fr,byte *pcm_sample, int *pcm_point); int do_layer1(struct frame *fr,byte *pcm_sample, int *pcm_point);
int do_layer2(struct frame *fr,byte *pcm_sample, int *pcm_point); int do_layer2(struct frame *fr,byte *pcm_sample, int *pcm_point);
int do_layer3(struct frame *fr,byte *pcm_sample, int *pcm_point); int do_layer3(struct frame *fr,byte *pcm_sample, int *pcm_point);
extern void do_equalizer(real *bandPtr,int channel); extern void do_equalizer(real *bandPtr,int channel);
#ifdef PENTIUM_OPT #ifdef PENTIUM_OPT
extern int synth_1to1_pent (real *,int,unsigned char *); extern int synth_1to1_pent (real *,int,unsigned char *);
#endif #endif
extern int synth_1to1 (real *,int,unsigned char *,int *); extern int synth_1to1 (real *,int,unsigned char *,int *);
extern int synth_1to1_8bit (real *,int,unsigned char *,int *); extern int synth_1to1_8bit (real *,int,unsigned char *,int *);
extern int synth_1to1_mono (real *,unsigned char *,int *); extern int synth_1to1_mono (real *,unsigned char *,int *);
extern int synth_1to1_mono2stereo (real *,unsigned char *,int *); extern int synth_1to1_mono2stereo (real *,unsigned char *,int *);
extern int synth_1to1_8bit_mono (real *,unsigned char *,int *); extern int synth_1to1_8bit_mono (real *,unsigned char *,int *);
extern int synth_1to1_8bit_mono2stereo (real *,unsigned char *,int *); extern int synth_1to1_8bit_mono2stereo (real *,unsigned char *,int *);
extern int synth_2to1 (real *,int,unsigned char *,int *); extern int synth_2to1 (real *,int,unsigned char *,int *);
extern int synth_2to1_8bit (real *,int,unsigned char *,int *); extern int synth_2to1_8bit (real *,int,unsigned char *,int *);
extern int synth_2to1_mono (real *,unsigned char *,int *); extern int synth_2to1_mono (real *,unsigned char *,int *);
extern int synth_2to1_mono2stereo (real *,unsigned char *,int *); extern int synth_2to1_mono2stereo (real *,unsigned char *,int *);
extern int synth_2to1_8bit_mono (real *,unsigned char *,int *); extern int synth_2to1_8bit_mono (real *,unsigned char *,int *);
extern int synth_2to1_8bit_mono2stereo (real *,unsigned char *,int *); extern int synth_2to1_8bit_mono2stereo (real *,unsigned char *,int *);
extern int synth_4to1 (real *,int,unsigned char *,int *); extern int synth_4to1 (real *,int,unsigned char *,int *);
extern int synth_4to1_8bit (real *,int,unsigned char *,int *); extern int synth_4to1_8bit (real *,int,unsigned char *,int *);
extern int synth_4to1_mono (real *,unsigned char *,int *); extern int synth_4to1_mono (real *,unsigned char *,int *);
extern int synth_4to1_mono2stereo (real *,unsigned char *,int *); extern int synth_4to1_mono2stereo (real *,unsigned char *,int *);
extern int synth_4to1_8bit_mono (real *,unsigned char *,int *); extern int synth_4to1_8bit_mono (real *,unsigned char *,int *);
extern int synth_4to1_8bit_mono2stereo (real *,unsigned char *,int *); extern int synth_4to1_8bit_mono2stereo (real *,unsigned char *,int *);
extern int synth_ntom (real *,int,unsigned char *,int *); extern int synth_ntom (real *,int,unsigned char *,int *);
extern int synth_ntom_8bit (real *,int,unsigned char *,int *); extern int synth_ntom_8bit (real *,int,unsigned char *,int *);
extern int synth_ntom_mono (real *,unsigned char *,int *); extern int synth_ntom_mono (real *,unsigned char *,int *);
extern int synth_ntom_mono2stereo (real *,unsigned char *,int *); extern int synth_ntom_mono2stereo (real *,unsigned char *,int *);
extern int synth_ntom_8bit_mono (real *,unsigned char *,int *); extern int synth_ntom_8bit_mono (real *,unsigned char *,int *);
extern int synth_ntom_8bit_mono2stereo (real *,unsigned char *,int *); extern int synth_ntom_8bit_mono2stereo (real *,unsigned char *,int *);
extern void rewindNbits(int bits); extern void rewindNbits(int bits);
extern int hsstell(void); extern int hsstell(void);
extern void set_pointer(long); extern void set_pointer(long);
extern void huffman_decoder(int ,int *); extern void huffman_decoder(int ,int *);
extern void huffman_count1(int,int *); extern void huffman_count1(int,int *);
extern void print_stat(struct frame *fr,unsigned long no,long buffsize,struct audio_info_struct *ai); extern void print_stat(struct frame *fr,unsigned long no,long buffsize,struct audio_info_struct *ai);
extern int get_songlen(struct frame *fr,int no); extern int get_songlen(struct frame *fr,int no);
extern void init_layer3(int); extern void init_layer3(int);
extern void init_layer2(void); extern void init_layer2(void);
extern void make_decode_tables(long scale); extern void make_decode_tables(long scale);
extern int make_conv16to8_table(int); extern int make_conv16to8_table(int);
extern void dct64(real *,real *,real *); extern void dct64(real *,real *,real *);
#ifdef USE_MMX #ifdef USE_MMX
extern void dct64_MMX(short *a,short *b,real *c); extern void dct64_MMX(short *a,short *b,real *c);
extern int synth_1to1_MMX(real *, int, short *, short *, int *); extern int synth_1to1_MMX(real *, int, short *, short *, int *);
#endif #endif
extern int synth_ntom_set_step(long,long); extern int synth_ntom_set_step(long,long);
extern unsigned char *conv16to8; extern unsigned char *conv16to8;
extern long freqs[9]; extern long freqs[9];
extern real muls[27][64]; extern real muls[27][64];
extern real decwin[512+32]; extern real decwin[512+32];
#ifndef USE_MMX #ifndef USE_MMX
extern real *pnts[5]; extern real *pnts[5];
#endif #endif
extern real equalizer[2][32]; extern real equalizer[2][32];
extern real equalizer_sum[2][32]; extern real equalizer_sum[2][32];
extern int equalizer_cnt; extern int equalizer_cnt;
extern struct audio_name audio_val2name[]; extern struct audio_name audio_val2name[];
//extern struct parameter param; //extern struct parameter param;
/* 486 optimizations */ /* 486 optimizations */
#define FIR_BUFFER_SIZE 128 #define FIR_BUFFER_SIZE 128
extern void dct64_486(int *a,int *b,real *c); extern void dct64_486(int *a,int *b,real *c);
extern int synth_1to1_486(real *bandPtr,int channel,unsigned char *out,int nb_blocks); extern int synth_1to1_486(real *bandPtr,int channel,unsigned char *out,int nb_blocks);
/* 3DNow! optimizations */ /* 3DNow! optimizations */
#ifdef USE_3DNOW #ifdef USE_3DNOW
extern int getcpuflags(void); extern int getcpuflags(void);
extern void dct36(real *,real *,real *,real *,real *); extern void dct36(real *,real *,real *,real *,real *);
extern void dct36_3dnow(real *,real *,real *,real *,real *); extern void dct36_3dnow(real *,real *,real *,real *,real *);
extern int synth_1to1_3dnow(real *,int,unsigned char *,int *); extern int synth_1to1_3dnow(real *,int,unsigned char *,int *);
#endif #endif
/* avoid the SIGINT in terminal control */ /* avoid the SIGINT in terminal control */
void next_track(void); void next_track(void);
extern long outscale; extern long outscale;
#endif #endif
void set_pointer(long backstep); void set_pointer(long backstep);
int __stdcall create_reader(struct reader *rd,byte *buffer, int buffsize); int __stdcall create_reader(struct reader *rd,byte *buffer, int buffsize);
int __stdcall init_reader(struct reader *rd, char *file); int __stdcall init_reader(struct reader *rd, char *file);
int __stdcall decode_header(struct frame *fr,unsigned long newhead); int __stdcall decode_header(struct frame *fr,unsigned long newhead);
int __stdcall set_reader(struct reader *rd, unsigned int filepos); int __stdcall set_reader(struct reader *rd, unsigned int filepos);
double pow_test(double, double); double pow_test(double, double);
void * __cdecl mem_cpy(void * dst,const void * src,size_t count); void * __cdecl mem_cpy(void * dst,const void * src,size_t count);
void init_dct(); void init_dct();
void reset_mpg(); void reset_mpg();
#ifdef __cplusplus #ifdef __cplusplus
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,90 @@
/*
uFMOD AC97SND codec header file
Target OS: KolibriOS
Compiler: Visual C
NOTE: ufmod.obj should be rebuilt setting UF_MODE=AC97SND
in order to make it usable in AC97SND player.
The Infinity Sound driver handle should be available as
a public symbol named hSound. It is so when using Serge's
sound.lib.
*/
#ifdef __cplusplus
extern "C" {
#endif
/* HANDLE uFMOD_LoadSong(char *lpXM);
---
Description:
---
Loads the given XM song and starts playing it as soon as you
call uFMOD_WaveOut for the first time. It will stop any
currently playing song before loading the new one. Heap should
be initialized before calling this function!
---
Parameters:
---
lpXM
Specifies the filename of the song to load.
---
Return Values:
---
On success, returns a non zero value. Returns 0 on failure.
*/
int __cdecl uFMOD_LoadSong(char*);
/* int uFMOD_WaveOut(SNDBUF hBuff)
---
Description:
---
Updates the internal playback buffer.
---
Parameters:
---
hBuff
The Infinity Sound buffer to update.
---
Remarks:
---
Playback doesn't actually begin when calling uFMOD_LoadSong,
but when calling uFMOD_WaveOut after a successful uFMOD_LoadSong
call. Afterwards, you should call uFMOD_WaveOut repeatedly at
least once every 250 ms to prevent "buffer underruns".
uFMOD_WaveOut is a non-blocking function.
---
Return Values:
---
Returns non zero on error.
*/
int __cdecl uFMOD_WaveOut(unsigned int);
/* void uFMOD_StopSong(void)
---
Description:
---
Stops the currently playing song, freeing the associated
resources.
---
Remarks:
---
Does nothing if no song is playing at the time the call is made.
*/
void __cdecl uFMOD_StopSong();
/* unsigned char* _uFMOD_GetTitle(void)
---
Description:
---
Returns the current song's title.
---
Remarks:
---
Not every song has a title, so be prepared to get an empty string.
*/
unsigned char* __cdecl uFMOD_GetTitle();
#ifdef __cplusplus
}
#endif