Skip to content

Latest commit

 

History

History
73 lines (59 loc) · 2.16 KB

music_mad.h

File metadata and controls

73 lines (59 loc) · 2.16 KB
 
Jul 15, 2007
Jul 15, 2007
1
/*
Dec 31, 2011
Dec 31, 2011
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SDL_mixer: An audio mixer library based on the SDL library
Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jul 15, 2007
Jul 15, 2007
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
*/
#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;
Jul 20, 2019
Jul 20, 2019
45
int start, length, pos;
Dec 31, 2011
Dec 31, 2011
46
int freerw;
Jul 15, 2007
Jul 15, 2007
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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;
Dec 31, 2011
Dec 31, 2011
62
mad_data *mad_openFileRW(SDL_RWops *rw, SDL_AudioSpec *mixer, int freerw);
Jul 15, 2007
Jul 15, 2007
63
64
65
66
67
68
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
69
int mad_getSamples(mad_data *mp3_mad, Uint8 *stream, int len);
Jul 15, 2007
Jul 15, 2007
70
71
72
73
void mad_seek(mad_data *mp3_mad, double position);
void mad_setVolume(mad_data *mp3_mad, int volume);
#endif