"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/playmidi.c" between
libtimidity-0.2.6.tar.gz and libtimidity-0.2.7.tar.gz

About: libTiMidity is a MIDI to WAVE converter library that uses Gravis Ultrasound-compatible patch files to generate digital audio data from General MIDI files.

playmidi.c  (libtimidity-0.2.6):playmidi.c  (libtimidity-0.2.7)
skipping to change at line 50 skipping to change at line 50
#include "timidity_internal.h" #include "timidity_internal.h"
#include "instrum.h" #include "instrum.h"
#include "playmidi.h" #include "playmidi.h"
#include "output.h" #include "output.h"
#include "mix.h" #include "mix.h"
#include "tables.h" #include "tables.h"
static void adjust_amplification(MidSong *song) static void adjust_amplification(MidSong *song)
{ {
song->master_volume = (float)(song->amplification) / (float)100.0; song->master_volume = (float)(song->amplification) / 100.0f;
} }
static void reset_voices(MidSong *song) static void reset_voices(MidSong *song)
{ {
int i; int i;
for (i=0; i<MID_MAX_VOICES; i++) for (i=0; i<MID_MAX_VOICES; i++)
song->voice[i].status=VOICE_FREE; song->voice[i].status=VOICE_FREE;
} }
/* Process the Reset All Controllers event */ /* Process the Reset All Controllers event */
skipping to change at line 85 skipping to change at line 85
reset_controllers(song, i); reset_controllers(song, i);
/* The rest of these are unaffected by the Reset All Controllers event */ /* The rest of these are unaffected by the Reset All Controllers event */
song->channel[i].program=song->default_program; song->channel[i].program=song->default_program;
song->channel[i].panning=NO_PANNING; song->channel[i].panning=NO_PANNING;
song->channel[i].pitchsens=2; song->channel[i].pitchsens=2;
song->channel[i].bank=0; /* tone bank or drum set */ song->channel[i].bank=0; /* tone bank or drum set */
} }
reset_voices(song); reset_voices(song);
} }
static void select_sample(MidSong *song, int v, MidInstrument *ip, int vel) static void select_sample(MidSong *song, int v, MidInstrument *ip)
{ {
sint32 f, cdiff, diff; sint32 f, cdiff, diff;
int s,i; int s,i;
MidSample *sp, *closest; MidSample *sp, *closest;
s=ip->samples; s=ip->samples;
sp=ip->sample; sp=ip->sample;
if (s==1) if (s==1)
{ {
skipping to change at line 285 skipping to change at line 285
instrument[song->channel[e->channel].program])) instrument[song->channel[e->channel].program]))
{ {
if (!(ip=song->tonebank[0]->instrument[song->channel[e->channel].progra m])) if (!(ip=song->tonebank[0]->instrument[song->channel[e->channel].progra m]))
return; /* No instrument? Then we can't play. */ return; /* No instrument? Then we can't play. */
} }
if (ip->sample->note_to_use) /* Fixed-pitch instrument? */ if (ip->sample->note_to_use) /* Fixed-pitch instrument? */
song->voice[i].orig_frequency = freq_table[(int)(ip->sample->note_to_use) ]; song->voice[i].orig_frequency = freq_table[(int)(ip->sample->note_to_use) ];
else else
song->voice[i].orig_frequency = freq_table[e->a & 0x7F]; song->voice[i].orig_frequency = freq_table[e->a & 0x7F];
select_sample(song, i, ip, e->b); select_sample(song, i, ip);
} }
song->voice[i].status = VOICE_ON; song->voice[i].status = VOICE_ON;
song->voice[i].channel = e->channel; song->voice[i].channel = e->channel;
song->voice[i].note = e->a; song->voice[i].note = e->a;
song->voice[i].velocity = e->b; song->voice[i].velocity = e->b;
song->voice[i].sample_offset = 0; song->voice[i].sample_offset = 0;
song->voice[i].sample_increment = 0; /* make sure it isn't negative */ song->voice[i].sample_increment = 0; /* make sure it isn't negative */
song->voice[i].tremolo_phase = 0; song->voice[i].tremolo_phase = 0;
skipping to change at line 770 skipping to change at line 770
break; break;
case ME_TONE_BANK: case ME_TONE_BANK:
song->channel[song->current_event->channel].bank = song->channel[song->current_event->channel].bank =
song->current_event->a; song->current_event->a;
break; break;
case ME_EOT: case ME_EOT:
/* Give the last notes a couple of seconds to decay */ /* Give the last notes a couple of seconds to decay */
DEBUG_MSG("Playing time: ~%d seconds\n", DEBUG_MSG("Playing time: ~%d seconds\n",
song->current_sample/song->rate+2); song->current_sample/song->rate+2);
DEBUG_MSG("Notes cut: %d\n", song->cut_notes); DEBUG_MSG("Notes cut: %d\n", song->cut_notes);
DEBUG_MSG("Notes lost totally: %d\n", song->lost_notes); DEBUG_MSG("Notes lost totally: %d\n", song->lost_notes);
song->playing = 0; song->playing = 0;
return (song->current_sample - start_sample) * song->bytes_per_sample; return (song->current_sample - start_sample) * song->bytes_per_sample;
} }
song->current_event++; song->current_event++;
} }
if (song->current_event->time > end_sample) if (song->current_event->time > end_sample)
compute_data(song, &ptr, end_sample-song->current_sample); compute_data(song, &ptr, end_sample-song->current_sample);
else else
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)