2 |
- |
1 |
/*
|
|
|
2 |
* Get Audio routines include file
|
|
|
3 |
*
|
|
|
4 |
* Copyright (c) 1999 Albert L Faber
|
|
|
5 |
*
|
|
|
6 |
* This library is free software; you can redistribute it and/or
|
|
|
7 |
* modify it under the terms of the GNU Library General Public
|
|
|
8 |
* License as published by the Free Software Foundation; either
|
|
|
9 |
* version 2 of the License, or (at your option) any later version.
|
|
|
10 |
*
|
|
|
11 |
* This library is distributed in the hope that it will be useful,
|
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
14 |
* Library General Public License for more details.
|
|
|
15 |
*
|
|
|
16 |
* You should have received a copy of the GNU Library General Public
|
|
|
17 |
* License along with this library; if not, write to the
|
|
|
18 |
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
19 |
* Boston, MA 02111-1307, USA.
|
|
|
20 |
*/
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
#ifndef LAME_GET_AUDIO_H
|
|
|
24 |
#define LAME_GET_AUDIO_H
|
|
|
25 |
|
|
|
26 |
typedef enum sound_file_format_e {
|
|
|
27 |
sf_unknown,
|
|
|
28 |
sf_raw,
|
|
|
29 |
sf_wave,
|
|
|
30 |
sf_aiff,
|
|
|
31 |
sf_mp1, /* MPEG Layer 1, aka mpg */
|
|
|
32 |
sf_mp2, /* MPEG Layer 2 */
|
|
|
33 |
sf_mp3, /* MPEG Layer 3 */
|
|
|
34 |
sf_ogg
|
|
|
35 |
} sound_file_format;
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
FILE* init_outfile ( char *outPath, int decode );
|
|
|
40 |
void init_infile(lame_global_flags *, char *inPath);
|
|
|
41 |
void close_infile(void);
|
|
|
42 |
int get_audio(lame_global_flags *gfp,short buffer[2][1152]);
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
/* the simple lame decoder */
|
|
|
47 |
/* After calling lame_init(), lame_init_params() and
|
|
|
48 |
* init_infile(), call this routine to read the input MP3 file
|
|
|
49 |
* and output .wav data to the specified file pointer
|
|
|
50 |
* lame_decoder will ignore the first 528 samples, since these samples
|
|
|
51 |
* represent the mpglib decoding delay (and are all 0).
|
|
|
52 |
*skip = number of additional
|
|
|
53 |
* samples to skip, to (for example) compensate for the encoder delay,
|
|
|
54 |
* only used when decoding mp3
|
|
|
55 |
*/
|
|
|
56 |
int lame_decoder(lame_global_flags *gfp,FILE *outf,int skip, char *inPath, char *outPath);
|
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
void SwapBytesInWords( short *loc, int words );
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
#ifdef LIBSNDFILE
|
|
|
65 |
|
|
|
66 |
#include "sndfile.h"
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
#else
|
|
|
70 |
/*****************************************************************
|
|
|
71 |
* LAME/ISO built in audio file I/O routines
|
|
|
72 |
*******************************************************************/
|
|
|
73 |
#include "portableio.h"
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
typedef struct blockAlign_struct {
|
|
|
77 |
unsigned long offset;
|
|
|
78 |
unsigned long blockSize;
|
|
|
79 |
} blockAlign;
|
|
|
80 |
|
|
|
81 |
typedef struct IFF_AIFF_struct {
|
|
|
82 |
short numChannels;
|
|
|
83 |
unsigned long numSampleFrames;
|
|
|
84 |
short sampleSize;
|
|
|
85 |
double sampleRate;
|
|
|
86 |
unsigned long sampleType;
|
|
|
87 |
blockAlign blkAlgn;
|
|
|
88 |
} IFF_AIFF;
|
|
|
89 |
|
|
|
90 |
extern int aiff_read_headers(FILE*, IFF_AIFF*);
|
|
|
91 |
extern int aiff_seek_to_sound_data(FILE*);
|
|
|
92 |
extern int aiff_write_headers(FILE*, IFF_AIFF*);
|
|
|
93 |
extern int parse_wavheader(void);
|
|
|
94 |
extern int parse_aiff(const char fn[]);
|
|
|
95 |
extern void aiff_check(const char*, IFF_AIFF*, int*);
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
#endif /* ifdef LIBSNDFILE */
|
|
|
100 |
#endif /* ifndef LAME_GET_AUDIO_H */
|