Mercurial > SDL_sound_CoreAudio
diff decoders/timidity/timidity.c @ 455:cbc2a4ffeeec
* Added support for loading DLS format instruments:
Timidity_LoadDLS(), Timidity_FreeDLS(), Timidity_LoadDLSSong()
* Added Timidity_Init_NoConfig()
author | hercules |
---|---|
date | Fri, 26 Sep 2003 20:51:58 +0000 |
parents | 1ba14a084531 |
children | c66080364dff |
line wrap: on
line diff
--- a/decoders/timidity/timidity.c Sat Sep 13 20:46:09 2003 +0000 +++ b/decoders/timidity/timidity.c Fri Sep 26 20:51:58 2003 +0000 @@ -398,6 +398,22 @@ return 0; } +int Timidity_Init_NoConfig() +{ + /* Allocate memory for the standard tonebank and drumset */ + master_tonebank[0] = safe_malloc(sizeof(ToneBank)); + memset(master_tonebank[0], 0, sizeof(ToneBank)); + master_tonebank[0]->tone = safe_malloc(128 * sizeof(ToneBankElement)); + memset(master_tonebank[0]->tone, 0, 128 * sizeof(ToneBankElement)); + + master_drumset[0] = safe_malloc(sizeof(ToneBank)); + memset(master_drumset[0], 0, sizeof(ToneBank)); + master_drumset[0]->tone = safe_malloc(128 * sizeof(ToneBankElement)); + memset(master_drumset[0]->tone, 0, 128 * sizeof(ToneBankElement)); + + return 0; +} + int Timidity_Init() { /* !!! FIXME: This may be ugly, but slightly less so than requiring the @@ -414,21 +430,12 @@ add_to_pathlist("/etc"); #endif - /* Allocate memory for the standard tonebank and drumset */ - master_tonebank[0] = safe_malloc(sizeof(ToneBank)); - memset(master_tonebank[0], 0, sizeof(ToneBank)); - master_tonebank[0]->tone = safe_malloc(128 * sizeof(ToneBankElement)); - memset(master_tonebank[0]->tone, 0, 128 * sizeof(ToneBankElement)); - - master_drumset[0] = safe_malloc(sizeof(ToneBank)); - memset(master_drumset[0], 0, sizeof(ToneBank)); - master_drumset[0]->tone = safe_malloc(128 * sizeof(ToneBankElement)); - memset(master_drumset[0]->tone, 0, 128 * sizeof(ToneBankElement)); + Timidity_Init_NoConfig(); return read_config_file(CONFIG_FILE); } -MidiSong *Timidity_LoadSong(SDL_RWops *rw, SDL_AudioSpec *audio) +MidiSong *Timidity_LoadDLSSong(SDL_RWops *rw, DLS_Patches *patches, SDL_AudioSpec *audio) { MidiSong *song; Sint32 events; @@ -440,6 +447,7 @@ /* Allocate memory for the song */ song = (MidiSong *)safe_malloc(sizeof(*song)); memset(song, 0, sizeof(*song)); + song->patches = patches; for (i = 0; i < 128; i++) { @@ -529,6 +537,11 @@ return(song); } +MidiSong *Timidity_LoadSong(SDL_RWops *rw, SDL_AudioSpec *audio) +{ + return Timidity_LoadDLSSong(rw, NULL, audio); +} + void Timidity_FreeSong(MidiSong *song) { int i;