123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #include "mad.h"
- #include "SDL_rwops.h"
- #include "SDL_audio.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;
- void *resampler[2];
- struct mad_stream stream;
- struct mad_frame frame;
- struct mad_synth synth;
- int frames_read;
- mad_timer_t next_frame_start;
- int status;
- int output_begin, output_end;
- int upsample;
- int resampler_quality;
- SDL_AudioSpec mixer;
- void (*converter)(signed short *, int);
- 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, int resampler_quality);
- mad_data *mad_openFileRW(SDL_RWops *rw, SDL_AudioSpec *mixer, int resampler_quality);
- 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);
- void mad_getSamples(mad_data *mp3_mad, Uint8 *stream, int len);
- void mad_seek(mad_data *mp3_mad, double position);
|