music_mad.c
changeset 561 87bdb4c81c0b
parent 542 3de4970b36d4
child 600 413430798384
equal deleted inserted replaced
560:0fc8dffb86c5 561:87bdb4c81c0b
    28 mad_data *
    28 mad_data *
    29 mad_openFileRW(SDL_RWops *rw, SDL_AudioSpec *mixer, int freerw)
    29 mad_openFileRW(SDL_RWops *rw, SDL_AudioSpec *mixer, int freerw)
    30 {
    30 {
    31   mad_data *mp3_mad;
    31   mad_data *mp3_mad;
    32 
    32 
    33   mp3_mad = (mad_data *)malloc(sizeof(mad_data));
    33   mp3_mad = (mad_data *)SDL_malloc(sizeof(mad_data));
    34   if (mp3_mad) {
    34   if (mp3_mad) {
    35 	mp3_mad->rw = rw;
    35 	mp3_mad->rw = rw;
    36 	mp3_mad->freerw = freerw;
    36 	mp3_mad->freerw = freerw;
    37 	mad_stream_init(&mp3_mad->stream);
    37 	mad_stream_init(&mp3_mad->stream);
    38 	mad_frame_init(&mp3_mad->frame);
    38 	mad_frame_init(&mp3_mad->frame);
    56   mad_synth_finish(&mp3_mad->synth);
    56   mad_synth_finish(&mp3_mad->synth);
    57 
    57 
    58   if (mp3_mad->freerw) {
    58   if (mp3_mad->freerw) {
    59 	SDL_RWclose(mp3_mad->rw);
    59 	SDL_RWclose(mp3_mad->rw);
    60   }
    60   }
    61   free(mp3_mad);
    61   SDL_free(mp3_mad);
    62 }
    62 }
    63 
    63 
    64 /* Starts the playback. */
    64 /* Starts the playback. */
    65 void
    65 void
    66 mad_start(mad_data *mp3_mad) {
    66 mad_start(mad_data *mp3_mad) {