Mercurial > SDL_sound_CoreAudio
comparison decoders/timidity/playmidi.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 | 498240aa76f1 |
children | c66080364dff |
comparison
equal
deleted
inserted
replaced
454:6bd7ca7d218b | 455:cbc2a4ffeeec |
---|---|
77 song->channel[i].bank=0; /* tone bank or drum set */ | 77 song->channel[i].bank=0; /* tone bank or drum set */ |
78 } | 78 } |
79 reset_voices(song); | 79 reset_voices(song); |
80 } | 80 } |
81 | 81 |
82 static void select_sample(MidiSong *song, int v, Instrument *ip) | 82 static void select_sample(MidiSong *song, int v, Instrument *ip, int vel) |
83 { | 83 { |
84 Sint32 f, cdiff, diff; | 84 Sint32 f, cdiff, diff; |
85 int s,i; | 85 int s,i; |
86 Sample *sp, *closest; | 86 Sample *sp, *closest; |
87 | 87 |
95 } | 95 } |
96 | 96 |
97 f=song->voice[v].orig_frequency; | 97 f=song->voice[v].orig_frequency; |
98 for (i=0; i<s; i++) | 98 for (i=0; i<s; i++) |
99 { | 99 { |
100 if (sp->low_freq <= f && sp->high_freq >= f) | 100 if (sp->low_vel <= vel && sp->high_vel >= vel && |
101 sp->low_freq <= f && sp->high_freq >= f) | |
101 { | 102 { |
102 song->voice[v].sample=sp; | 103 song->voice[v].sample=sp; |
103 return; | 104 return; |
104 } | 105 } |
105 sp++; | 106 sp++; |
280 | 281 |
281 if (ip->sample->note_to_use) /* Fixed-pitch instrument? */ | 282 if (ip->sample->note_to_use) /* Fixed-pitch instrument? */ |
282 song->voice[i].orig_frequency = freq_table[(int)(ip->sample->note_to_use)]; | 283 song->voice[i].orig_frequency = freq_table[(int)(ip->sample->note_to_use)]; |
283 else | 284 else |
284 song->voice[i].orig_frequency = freq_table[e->a & 0x7F]; | 285 song->voice[i].orig_frequency = freq_table[e->a & 0x7F]; |
285 select_sample(song, i, ip); | 286 select_sample(song, i, ip, e->b); |
286 } | 287 } |
287 | 288 |
288 song->voice[i].status = VOICE_ON; | 289 song->voice[i].status = VOICE_ON; |
289 song->voice[i].channel = e->channel; | 290 song->voice[i].channel = e->channel; |
290 song->voice[i].note = e->a; | 291 song->voice[i].note = e->a; |