source: golgotha/src/i4/loaders/mp3/mpg123.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 6.8 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9/*
10 * mpg123 defines
11 * used source: musicout.h from mpegaudio package
12 */
13
14#ifndef __GNUC__
15#include        <io.h>
16#endif
17#include        <stdio.h>
18#include        <string.h>
19#include        <signal.h>
20#include        <math.h>
21#include                <stdlib.h>
22
23#ifndef M_PI
24#define M_PI 3.14159265358979323846
25#define M_SQRT2 1.41421356237309504880
26#endif
27
28#ifdef OS2
29#include <float.h>
30#endif
31
32#define MPG123_REMOTE
33#define SHUFFLESUPPORT
34#ifdef HPUX
35#define random rand
36#define srandom srand
37#endif
38
39#define FRONTEND_SAJBER 1
40#define FRONTEND_TK3PLAY 2
41
42
43#include "loaders/mp3/xfermem.hh"
44
45#ifdef SUNOS
46#define memmove(dst,src,size) bcopy(src,dst,size)
47#endif
48
49#ifdef REAL_IS_FLOAT
50#  define real float
51#elif defined(REAL_IS_LONG_DOUBLE)
52#  define real long double
53#else
54#  define real double
55#endif
56
57#ifdef __GNUC__
58#define INLINE inline
59#else
60#define INLINE
61#endif
62
63#ifndef NAS
64#if defined(LINUX) || defined(__FreeBSD__)
65#define VOXWARE
66#endif
67#endif
68
69#include "loaders/mp3/audio.hh"
70
71/* AUDIOBUFSIZE = n*64 with n=1,2,3 ...  */
72#define         AUDIOBUFSIZE            16384
73
74#define         FALSE                   0
75#define         TRUE                    1
76
77#define         MAX_NAME_SIZE           81
78#define         SBLIMIT                 32
79#define         SCALE_BLOCK             12
80#define         SSLIMIT                 18
81
82#define         MPG_MD_STEREO           0
83#define         MPG_MD_JOINT_STEREO     1
84#define         MPG_MD_DUAL_CHANNEL     2
85#define         MPG_MD_MONO             3
86
87#define MAXOUTBURST 32768
88
89
90struct al_table
91{
92  short bits;
93  short d;
94};
95
96struct frame {
97    struct al_table *alloc;
98    int (*synth)(real *,int,unsigned char *);
99    int (*synth_mono)(real *,unsigned char *);
100    int stereo;
101    int jsbound;
102    int single;
103    int II_sblimit;
104    int lsf;
105    int mpeg25;
106    int down_sample;
107    int header_change;
108    int block_size;
109    int lay;
110        int (*do_layer)(struct frame *fr,int,struct audio_info_struct *);
111    int error_protection;
112    int bitrate_index;
113    int sampling_frequency;
114    int padding;
115    int extension;
116    int mode;
117    int mode_ext;
118    int copyright;
119    int original;
120    int emphasis;
121};
122
123struct flags {
124        int equalizer;
125        int aggressive; /* renice to max. priority */
126};
127
128extern int outmode; 
129extern int tryresync;
130extern int quiet;
131extern int halfspeed;
132extern int usebuffer;
133extern int buffer_fd[2];
134extern txfermem *buffermem;
135extern char *prgName, *prgVersion;
136
137/* ------ Declarations from "httpget.c" ------ */
138
139extern char *proxyurl;
140extern unsigned long proxyip;
141extern FILE *http_open (char *url);
142
143/* ------ Declarations from "common.c" ------ */
144
145extern void audio_flush(int, struct audio_info_struct *);
146extern void (*catchsignal(int signum, void(*handler)()))();
147
148extern void print_header(struct frame *);
149extern void print_header_compact(struct frame *);
150
151/* extern char *strndup(const char *src, int num); */
152extern int split_dir_file(const char *path, char **dname, char **fname);
153
154extern unsigned int   get1bit(void);
155extern unsigned int   getbits(int);
156extern unsigned int   getbits_fast(int);
157
158extern void set_pointer(long);
159
160extern unsigned char *pcm_sample;
161extern int pcm_point;
162extern int audiobufsize;
163
164#ifdef VARMODESUPPORT
165extern int varmode;
166extern int playlimit;
167#endif
168
169struct III_sideinfo
170{
171  unsigned main_data_begin;
172  unsigned private_bits;
173  struct what_the {
174    struct gr_info_s {
175      int scfsi;
176      unsigned part2_3_length;
177      unsigned big_values;
178      unsigned scalefac_compress;
179      unsigned block_type;
180      unsigned mixed_block_flag;
181      unsigned table_select[3];
182      unsigned subblock_gain[3];
183      unsigned maxband[3];
184      unsigned maxbandl;
185      unsigned maxb;
186      unsigned region1start;
187      unsigned region2start;
188      unsigned preflag;
189      unsigned scalefac_scale;
190      unsigned count1table_select;
191      real *full_gain[3];
192      real *pow2gain;
193    } gr[2];
194  } ch[2];
195};
196
197extern void open_stream(char *,int fd);
198extern void close_stream(void);
199extern long tell_stream(void);
200extern void read_frame_init (void);
201extern int read_frame(struct frame *fr);
202extern int back_frame(struct frame *fr,int num);
203extern void play_frame(int init,struct frame *fr);
204extern int do_layer3(struct frame *fr,int,struct audio_info_struct *);
205extern int do_layer2(struct frame *fr,int,struct audio_info_struct *);
206extern int do_layer1(struct frame *fr,int,struct audio_info_struct *);
207extern void do_equalizer(real *bandPtr,int channel);
208extern int synth_1to1 (real *,int,unsigned char *);
209extern int synth_1to1_8bit (real *,int,unsigned char *);
210extern int synth_2to1 (real *,int,unsigned char *);
211extern int synth_2to1_8bit (real *,int,unsigned char *);
212extern int synth_4to1 (real *,int,unsigned char *);
213extern int synth_4to1_8bit (real *,int,unsigned char *);
214extern int synth_1to1_mono (real *,unsigned char *);
215extern int synth_1to1_mono2stereo (real *,unsigned char *);
216extern int synth_1to1_8bit_mono (real *,unsigned char *);
217extern int synth_1to1_8bit_mono2stereo (real *,unsigned char *);
218extern int synth_2to1_mono (real *,unsigned char *);
219extern int synth_2to1_mono2stereo (real *,unsigned char *);
220extern int synth_2to1_8bit_mono (real *,unsigned char *);
221extern int synth_2to1_8bit_mono2stereo (real *,unsigned char *);
222extern int synth_4to1_mono (real *,unsigned char *);
223extern int synth_4to1_mono2stereo (real *,unsigned char *);
224extern int synth_4to1_8bit_mono (real *,unsigned char *);
225extern int synth_4to1_8bit_mono2stereo (real *,unsigned char *);
226extern void rewindNbits(int bits);
227extern int  hsstell(void);
228extern void set_pointer(long);
229extern void huffman_decoder(int ,int *);
230extern void huffman_count1(int,int *);
231
232extern void init_layer3(int);
233extern void init_layer2(void);
234extern void make_decode_tables(long scale);
235extern void make_conv16to8_table(int);
236extern void dct64(real *,real *,real *);
237
238extern void control_sajber(struct frame *fr);
239extern void control_tk3play(struct frame *fr);
240
241extern unsigned char *conv16to8;
242extern long freqs[7];
243extern real muls[27][64];
244extern real decwin[512+32];
245extern real *pnts[5];
246
247extern real equalizer[2][32];
248extern real equalizer_sum[2][32];
249extern int equalizer_cnt;
250
251extern struct flags flags;
252
253
Note: See TracBrowser for help on using the repository browser.