Skip to content

Latest commit

 

History

History
74 lines (59 loc) · 2.11 KB

music_mad.h

File metadata and controls

74 lines (59 loc) · 2.11 KB
 
Jul 15, 2007
Jul 15, 2007
1
2
/*
SDL_mixer: An audio mixer library based on the SDL library
Dec 8, 2008
Dec 8, 2008
3
Copyright (C) 1997-2009 Sam Lantinga
Jul 15, 2007
Jul 15, 2007
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifdef MP3_MAD_MUSIC
#include "mad.h"
#include "SDL_rwops.h"
#include "SDL_audio.h"
#include "SDL_mixer.h"
#define MAD_INPUT_BUFFER_SIZE (5*8192)
#define MAD_OUTPUT_BUFFER_SIZE 8192
enum {
MS_input_eof = 0x0001,
MS_input_error = 0x0001,
MS_decode_eof = 0x0002,
MS_decode_error = 0x0004,
MS_error_flags = 0x000f,
MS_playing = 0x0100,
MS_cvt_decoded = 0x0200,
};
typedef struct {
SDL_RWops *rw;
Feb 26, 2008
Feb 26, 2008
46
SDL_bool freerw;
Jul 15, 2007
Jul 15, 2007
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
struct mad_stream stream;
struct mad_frame frame;
struct mad_synth synth;
int frames_read;
mad_timer_t next_frame_start;
int volume;
int status;
int output_begin, output_end;
SDL_AudioSpec mixer;
SDL_AudioCVT cvt;
unsigned char input_buffer[MAD_INPUT_BUFFER_SIZE + MAD_BUFFER_GUARD];
unsigned char output_buffer[MAD_OUTPUT_BUFFER_SIZE];
} mad_data;
mad_data *mad_openFile(const char *filename, SDL_AudioSpec *mixer);
mad_data *mad_openFileRW(SDL_RWops *rw, SDL_AudioSpec *mixer);
void mad_closeFile(mad_data *mp3_mad);
void mad_start(mad_data *mp3_mad);
void mad_stop(mad_data *mp3_mad);
int mad_isPlaying(mad_data *mp3_mad);
Oct 2, 2009
Oct 2, 2009
70
int mad_getSamples(mad_data *mp3_mad, Uint8 *stream, int len);
Jul 15, 2007
Jul 15, 2007
71
72
73
74
void mad_seek(mad_data *mp3_mad, double position);
void mad_setVolume(mad_data *mp3_mad, int volume);
#endif