1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #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 volume;
- int status;
- int output_begin, output_end;
- int upsample;
- int resampler_quality;
- 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, 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);
- void mad_setVolume(mad_data *mp3_mad, int volume);
|