3 Ann Hell Ex Machina - Music Software
4 Copyright (C) 2003/2006 Angel Ortega <angel@triptico.com>
6 ss_song.c - Software synth song event stream management
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 http://www.triptico.com
41 song_ev_type type
; /* event type */
42 int frame
; /* frame number (time) */
43 int trk_id
; /* track id */
44 int event_id
; /* event id */
49 song_ev_type type
; /* SONG_EV_NOTE_OFF */
53 int note_id
; /* note id */
58 song_ev_type type
; /* SONG_EV_NOTE_ON */
62 int note_id
; /* note id */
63 int note
; /* MIDI-like note */
64 sample_t vol
; /* volume */
67 struct ss_ev_ss_sustain
69 song_ev_type type
; /* SONG_EV_SS_SUSTAIN */
73 double sustain
; /* sustain time (in frames) */
76 struct ss_ev_ss_vibrato
78 song_ev_type type
; /* SONG_EV_SS_VIBRATO */
82 double vib_depth
; /* vibrato depth (in msecs) */
83 double vib_freq
; /* vibrato frequency (in Hzs) */
86 struct ss_ev_ss_channel
88 song_ev_type type
; /* SONG_EV_SS_CHANNEL */
92 int channel
; /* channel */
93 sample_t vol
; /* volume */
98 song_ev_type type
; /* SONG_EV_SS_WAV */
102 char * file
; /* path to .wav file */
103 int base
; /* MIDI-like base note */
104 int min
; /* MIDI-like minimum note */
105 int max
; /* MIDI-like maximum note */
106 double loop_start
; /* loop start */
107 double loop_end
; /* loop end */
108 int first_channel
; /* first channel to start spreading */
109 int skip_channels
; /* channels to skip when spreading */
114 song_ev_type type
; /* SONG_EV_SS_PAT */
118 char * file
; /* path to .pat file */
123 song_ev_type type
; /* SONG_EV_TEMPO */
127 double tempo
; /* tempo in bmp */
130 struct ss_ev_pitch_stretch
132 song_ev_type type
; /* SONG_EV_SS_PITCH_STRETCH */
136 int note_id
; /* note id */
137 int note
; /* MIDI-like note (to find the wave) */
138 double len
; /* note length (1: whole note) */
139 sample_t vol
; /* note volume (1: full volume) */
142 struct ss_ev_print_wave_tempo
144 song_ev_type type
; /* SONG_EV_SS_PRINT_WAVE_TEMPO */
148 int note_id
; /* note id */
149 int note
; /* MIDI-like note (to find the wave) */
150 double len
; /* note length (1: whole note) */
155 song_ev_type type
; /* effect type */
159 int channel
; /* channel */
160 double size
; /* size of effect */
161 sample_t gain
; /* gain */
162 double depth
; /* depth */
163 double freq
; /* freq */
164 double phase
; /* phase */
165 sample_t initial
; /* initial vol */
166 sample_t final
; /* final vol */
169 struct ss_ev_song_info
171 song_ev_type type
; /* SONG_EV_SONG_INFO */
175 char * author
; /* track author */
176 char * name
; /* track name */
181 struct ss_ev_generic generic
;
182 struct ss_ev_note_on note_on
;
183 struct ss_ev_note_off note_off
;
184 struct ss_ev_ss_sustain ss_sustain
;
185 struct ss_ev_ss_vibrato ss_vibrato
;
186 struct ss_ev_ss_channel ss_channel
;
187 struct ss_ev_ss_wav ss_wav
;
188 struct ss_ev_ss_pat ss_pat
;
189 struct ss_ev_ss_eff ss_eff
;
190 struct ss_ev_tempo tempo
;
191 struct ss_ev_pitch_stretch ss_pitch_stretch
;
192 struct ss_ev_print_wave_tempo ss_print_wave_tempo
;
193 struct ss_ev_song_info song_info
;
196 /* the softsynth song stream */
198 static union ss_ev
* ss_song
= NULL
;
199 static int n_ss_ev
= 0;
202 /* the instruments */
204 struct ss_ins ss_song_ins
[SS_MAX_INSTRUMENTS
];
208 ********************/
210 static void add_ss_ev(union ss_ev
* e
)
211 /* adds a softsynth song event */
213 GROW(ss_song
, n_ss_ev
, union ss_ev
);
216 memcpy(&ss_song
[n_ss_ev
], e
, sizeof(union ss_ev
));
222 static int ss_ev_cmp(const void * v1
, const void * v2
)
223 /* softsynth song event compare function for qsort() */
225 struct ss_ev_generic
* e1
;
226 struct ss_ev_generic
* e2
;
229 e1
= (struct ss_ev_generic
*)v1
; e2
= (struct ss_ev_generic
*)v2
;
231 ret
= e1
->frame
- e2
->frame
;
234 ret
= e1
->type
- e2
->type
;
237 ret
= e1
->event_id
- e2
->event_id
;
243 static void ss_song_convert_events(int * n_tracks
, int * n_channels
)
244 /* converts generic song_ev events to softsynth events */
249 int frame
, frame_ac
, f_frame
;
250 double fpw
, time_ac
, time_ac_m
;
257 /* resets the ss stream */
270 frame
= frame_ac
= f_frame
= 0;
271 time_ac
= time_ac_m
= 0;
274 /* travels the song events generating softsynth song events */
275 for(n
= 0;n
< n_song_ev
;n
++)
277 /* gets the song event */
280 /* calculates the frame */
281 frame
= ((e
->generic
.time
- time_ac
) * fpw
) + frame_ac
;
283 /* generic event data */
284 sse
.generic
.type
= e
->generic
.type
;
285 sse
.generic
.frame
= frame
;
286 sse
.generic
.trk_id
= e
->generic
.trk_id
;
287 sse
.generic
.event_id
= e
->generic
.event_id
;
289 /* account the biggest track seen */
290 if(*n_tracks
< e
->generic
.trk_id
) *n_tracks
= e
->generic
.trk_id
;
292 switch(e
->generic
.type
)
296 /* updates accumulations */
298 time_ac
= e
->generic
.time
;
300 /* calculates frames-per-whole based on new tempo */
301 fpw
= (double) ss_frequency
* 60.0;
302 fpw
/= e
->tempo
.tempo
/ 4.0;
305 sse
.tempo
.tempo
= e
->tempo
.tempo
;
312 /* just store the values */
315 time_ac_m
= e
->meter
.time
;
319 case SONG_EV_MEASURE
:
321 song_test_measure_boundary(e
->measure
.time
- time_ac_m
,
322 num
, den
, e
->measure
.line
);
327 /* convert to note on / off pairs */
329 sse
.note_on
.type
= SONG_EV_NOTE_ON
;
330 sse
.note_on
.note_id
= note_id
++;
331 sse
.note_on
.note
= e
->note
.note
;
332 sse
.note_on
.vol
= e
->note
.vol
;
336 frame
+= (int)(e
->note
.len
* fpw
);
338 sse
.note_off
.type
= SONG_EV_NOTE_OFF
;
339 sse
.note_off
.frame
= frame
;
346 /* move the cursor back */
348 frame_ac
-= (int)(e
->back
.len
* fpw
);
352 case SONG_EV_SS_PITCH_STRETCH
:
354 sse
.ss_pitch_stretch
.note_id
= note_id
++;
355 sse
.ss_pitch_stretch
.note
= e
->ss_pitch_stretch
.note
;
356 sse
.ss_pitch_stretch
.len
= e
->ss_pitch_stretch
.len
;
357 sse
.ss_pitch_stretch
.vol
= e
->ss_pitch_stretch
.vol
;
361 frame
+= (int)(e
->ss_pitch_stretch
.len
* fpw
);
363 sse
.note_off
.type
= SONG_EV_NOTE_OFF
;
364 sse
.note_off
.frame
= frame
;
369 case SONG_EV_SS_PRINT_WAVE_TEMPO
:
371 sse
.ss_print_wave_tempo
.note
= e
->ss_print_wave_tempo
.note
;
372 sse
.ss_print_wave_tempo
.len
= e
->ss_print_wave_tempo
.len
;
379 sse
.ss_wav
.file
= e
->ss_wav
.file
;
380 sse
.ss_wav
.base
= e
->ss_wav
.base
;
381 sse
.ss_wav
.min
= e
->ss_wav
.min
;
382 sse
.ss_wav
.max
= e
->ss_wav
.max
;
383 sse
.ss_wav
.loop_start
= e
->ss_wav
.loop_start
;
384 sse
.ss_wav
.loop_end
= e
->ss_wav
.loop_end
;
385 sse
.ss_wav
.first_channel
= e
->ss_wav
.first_channel
;
386 sse
.ss_wav
.skip_channels
= e
->ss_wav
.skip_channels
;
393 sse
.ss_pat
.file
= e
->ss_pat
.file
;
398 case SONG_EV_SS_SUSTAIN
:
400 sse
.ss_sustain
.sustain
= e
->ss_sustain
.sustain
;
405 case SONG_EV_SS_VIBRATO
:
407 sse
.ss_vibrato
.vib_depth
= e
->ss_vibrato
.vib_depth
;
408 sse
.ss_vibrato
.vib_freq
= e
->ss_vibrato
.vib_freq
;
413 case SONG_EV_SS_CHANNEL
:
415 sse
.ss_channel
.channel
= e
->ss_channel
.channel
;
416 sse
.ss_channel
.vol
= e
->ss_channel
.vol
;
419 if(*n_channels
< e
->ss_channel
.channel
)
420 *n_channels
= e
->ss_channel
.channel
;
425 case SONG_EV_SS_EFF_DELAY
:
426 case SONG_EV_SS_EFF_ECHO
:
427 case SONG_EV_SS_EFF_COMB
:
428 case SONG_EV_SS_EFF_ALLPASS
:
429 case SONG_EV_SS_EFF_FLANGER
:
430 case SONG_EV_SS_EFF_WOBBLE
:
431 case SONG_EV_SS_EFF_SQWOBBLE
:
432 case SONG_EV_SS_EFF_FADER
:
433 case SONG_EV_SS_EFF_REVERB
:
434 case SONG_EV_SS_EFF_OFF
:
436 sse
.ss_eff
.channel
= e
->ss_eff
.channel
;
437 sse
.ss_eff
.size
= e
->ss_eff
.size
;
438 sse
.ss_eff
.gain
= e
->ss_eff
.gain
;
439 sse
.ss_eff
.depth
= e
->ss_eff
.depth
;
440 sse
.ss_eff
.freq
= e
->ss_eff
.freq
;
441 sse
.ss_eff
.phase
= e
->ss_eff
.phase
;
442 sse
.ss_eff
.initial
= e
->ss_eff
.initial
;
443 sse
.ss_eff
.final
= e
->ss_eff
.final
;
448 case SONG_EV_SONG_INFO
:
450 sse
.song_info
.author
= e
->song_info
.author
;
451 sse
.song_info
.name
= e
->song_info
.name
;
456 case SONG_EV_MIDI_CHANNEL
:
457 case SONG_EV_MIDI_PROGRAM
:
462 case SONG_EV_NOTE_ON
:
463 case SONG_EV_NOTE_OFF
:
466 /* never found in generic song streams */
470 /* store the further frame seen */
471 if(f_frame
< frame
) f_frame
= frame
;
474 /* generates an end of event mark, a time after the last one */
475 sse
.generic
.type
= SONG_EV_END
;
476 sse
.generic
.frame
= f_frame
+ ss_frequency
;
477 sse
.generic
.event_id
= -1;
481 qsort(ss_song
, n_ss_ev
, sizeof(union ss_ev
), ss_ev_cmp
);
489 static void ss_song_trace_events(void)
494 printf("** SOFTWARE SYNTHESIZER EVENT DUMP **\n\n");
495 printf("%10s %5s %5s Event and information\n",
496 "Frame", "Track", "Ev.ID");
497 printf("------------------------------------------------------------\n");
499 for(n
= 0, e
= ss_song
;n
< n_ss_ev
;n
++, e
++)
501 printf("%10d %5d %5d ",
502 e
->generic
.frame
, e
->generic
.trk_id
, e
->generic
.event_id
);
504 switch(e
->generic
.type
)
508 printf("SONG_EV_TEMPO ");
509 printf("%lf", e
->tempo
.tempo
);
512 case SONG_EV_SS_SUSTAIN
:
514 printf("SONG_EV_SS_SUSTAIN ");
515 printf("SUSTAIN:%lf", e
->ss_sustain
.sustain
);
518 case SONG_EV_SS_VIBRATO
:
520 printf("SONG_EV_SS_VIBRATO ");
521 printf("DEPTH:%lf FREQ:%lf",
522 e
->ss_vibrato
.vib_depth
,
523 e
->ss_vibrato
.vib_freq
);
526 case SONG_EV_SS_CHANNEL
:
528 printf("SONG_EV_SS_CHANNEL ");
529 printf("CHANNEL:%d VOL:%lf",
530 e
->ss_channel
.channel
,
536 printf("SONG_EV_SS_WAV ");
537 printf("FILE:'%s' BASE:%d MIN:%d MAX:%d START:%lf END:%lf",
538 e
->ss_wav
.file
, e
->ss_wav
.base
,
539 e
->ss_wav
.min
, e
->ss_wav
.max
,
540 e
->ss_wav
.loop_start
, e
->ss_wav
.loop_end
);
545 printf("SONG_EV_SS_PAT ");
546 printf("FILE:'%s'", e
->ss_pat
.file
);
549 case SONG_EV_SS_EFF_DELAY
:
551 printf("SONG_EV_SS_EFF_DELAY ");
552 printf("CHANNEL:%d ", e
->ss_eff
.channel
);
553 printf("SIZE:%lf ", e
->ss_eff
.size
);
556 case SONG_EV_SS_EFF_ECHO
:
558 printf("SONG_EV_SS_EFF_ECHO ");
559 printf("CHANNEL:%d ", e
->ss_eff
.channel
);
560 printf("SIZE:%lf ", e
->ss_eff
.size
);
561 printf("GAIN:%f ", e
->ss_eff
.gain
);
564 case SONG_EV_SS_EFF_COMB
:
566 printf("SONG_EV_SS_EFF_COMB ");
567 printf("CHANNEL:%d ", e
->ss_eff
.channel
);
568 printf("SIZE:%lf ", e
->ss_eff
.size
);
569 printf("GAIN:%f ", e
->ss_eff
.gain
);
572 case SONG_EV_SS_EFF_ALLPASS
:
574 printf("SONG_EV_SS_EFF_ALLPASS ");
575 printf("CHANNEL:%d ", e
->ss_eff
.channel
);
576 printf("SIZE:%lf ", e
->ss_eff
.size
);
577 printf("GAIN:%f ", e
->ss_eff
.gain
);
580 case SONG_EV_SS_EFF_FLANGER
:
582 printf("SONG_EV_SS_EFF_FLANGER ");
583 printf("CHANNEL:%d ", e
->ss_eff
.channel
);
584 printf("SIZE:%lf ", e
->ss_eff
.size
);
585 printf("GAIN:%f ", e
->ss_eff
.gain
);
586 printf("DEPTH:%lf ", e
->ss_eff
.depth
);
587 printf("FREQ:%lf PHASE:%lf", e
->ss_eff
.freq
,
591 case SONG_EV_SS_EFF_WOBBLE
:
593 printf("SONG_EV_SS_EFF_WOBBLE ");
594 printf("CHANNEL:%d ", e
->ss_eff
.channel
);
595 printf("FREQ:%lf PHASE:%lf", e
->ss_eff
.freq
,
599 case SONG_EV_SS_EFF_SQWOBBLE
:
601 printf("SONG_EV_SS_EFF_SQWOBBLE ");
602 printf("CHANNEL:%d ", e
->ss_eff
.channel
);
603 printf("FREQ:%lf PHASE:%lf", e
->ss_eff
.freq
,
607 case SONG_EV_SS_EFF_FADER
:
609 printf("SONG_EV_SS_EFF_FADER ");
610 printf("CHANNEL:%d ", e
->ss_eff
.channel
);
611 printf("SIZE:%lf ", e
->ss_eff
.size
);
612 printf("INITIAL:%f FINAL:%f", e
->ss_eff
.initial
,
616 case SONG_EV_SS_EFF_REVERB
:
618 printf("SONG_EV_SS_EFF_REVERB ");
619 printf("CHANNEL:%d ", e
->ss_eff
.channel
);
622 case SONG_EV_SS_EFF_OFF
:
624 printf("SONG_EV_SS_EFF_OFF ");
625 printf("CHANNEL:%d ", e
->ss_eff
.channel
);
628 case SONG_EV_SS_PITCH_STRETCH
:
630 printf("SONG_EV_SS_PITCH_STRETCH ");
631 printf("MIDI:%d LEN:%lf VOL:%f",
632 e
->ss_pitch_stretch
.note
,
633 e
->ss_pitch_stretch
.len
,
634 e
->ss_pitch_stretch
.vol
);
638 case SONG_EV_SS_PRINT_WAVE_TEMPO
:
640 printf("SONG_EV_SS_PRINT_WAVE_TEMPO ");
641 printf("MIDI:%d LEN:%lf",
642 e
->ss_print_wave_tempo
.note
,
643 e
->ss_print_wave_tempo
.len
);
646 case SONG_EV_SONG_INFO
:
648 printf("SONG_EV_SONG_INFO ");
649 printf("AUTHOR:'%s' NAME:'%s'",
654 case SONG_EV_NOTE_ON
:
656 printf("SONG_EV_NOTE_ON ");
657 printf("ID:%d MIDI:%d VOL:%f",
658 e
->note_on
.note_id
, e
->note_on
.note
,
662 case SONG_EV_NOTE_OFF
:
664 printf("SONG_EV_NOTE_OFF ");
665 printf("ID:%d", e
->note_off
.note_id
);
670 printf("SONG_EV_END ");
674 printf("** Unexpected type: %d",
685 int ss_song_render(int skip_secs
, char * driver
, char * devfile
)
691 sample_t output
[SS_MAX_CHANNELS
];
693 double tempo
= 120.0;
700 /* convert the song to ss events */
701 ss_song_convert_events(&n_tracks
, &n_channels
);
704 printf("Tracks: %d Channels: %d Events: %d\n",
705 n_tracks
, n_channels
, n_ss_ev
);
709 ss_song_trace_events();
713 /* set the number of channels, unless forced */
714 if(ss_nchannels
== -1)
715 ss_nchannels
= n_channels
> 0 ? n_channels
: 2;
717 if(ss_output_open(driver
, devfile
) < 0)
719 printf("Error: can't init driver\n");
727 /* init the generators */
730 /* init the instruments */
731 for(n
= 0;n
< n_tracks
;n
++)
732 ss_ins_init(&ss_song_ins
[n
]);
734 /* calculate the frame to start playing */
735 skip_frames
= skip_secs
* ss_frequency
;
737 /* loop the events */
742 if(frame
% ss_frequency
== 0)
744 int m
= frame
/ ss_frequency
;
745 printf("[%02d:%02d]\r", m
/ 60, m
% 60);
750 /* process all events for this exact frame */
751 while(go
&& e
->generic
.frame
== frame
)
753 if(e
->generic
.type
== SONG_EV_NOTE_ON
||
754 e
->generic
.type
== SONG_EV_NOTE_OFF
||
755 e
->generic
.type
== SONG_EV_SS_PITCH_STRETCH
)
757 if(frame
< skip_frames
)
760 frame
= e
->generic
.frame
;
765 /* take the instrument */
766 if(e
->generic
.trk_id
< 0)
769 i
= &ss_song_ins
[e
->generic
.trk_id
];
771 switch(e
->generic
.type
)
773 case SONG_EV_NOTE_ON
:
775 ss_ins_note_on(i
, e
->note_on
.note
,
776 e
->note_on
.vol
, e
->note_on
.note_id
);
780 case SONG_EV_NOTE_OFF
:
782 ss_ins_note_off(i
, e
->note_off
.note_id
);
786 case SONG_EV_SS_SUSTAIN
:
788 ss_ins_set_sustain(i
, e
->ss_sustain
.sustain
);
792 case SONG_EV_SS_VIBRATO
:
794 ss_ins_set_vibrato(i
, e
->ss_vibrato
.vib_depth
,
795 e
->ss_vibrato
.vib_freq
);
799 case SONG_EV_SS_CHANNEL
:
801 ss_ins_set_channel(i
, e
->ss_channel
.channel
,
808 w
=ss_load_wav_file(e
->ss_wav
.file
,
809 ss_note_frequency(e
->ss_wav
.base
),
810 ss_note_frequency(e
->ss_wav
.min
),
811 ss_note_frequency(e
->ss_wav
.max
),
812 e
->ss_wav
.loop_start
, e
->ss_wav
.loop_end
,
813 e
->ss_wav
.first_channel
, e
->ss_wav
.skip_channels
);
815 /* fail if can't open wav */
818 printf("Can't load wav '%s'\n", e
->ss_wav
.file
);
822 ss_ins_add_layer(i
, w
);
828 if(ss_load_pat_file(i
, e
->ss_pat
.file
) < 0)
830 printf("Can't load pat '%s'\n", e
->ss_pat
.file
);
836 case SONG_EV_SS_EFF_DELAY
:
838 ss_eff_delay(&i
->effs
[e
->ss_eff
.channel
],
842 case SONG_EV_SS_EFF_ECHO
:
844 ss_eff_echo(&i
->effs
[e
->ss_eff
.channel
],
845 e
->ss_eff
.size
, e
->ss_eff
.gain
);
848 case SONG_EV_SS_EFF_COMB
:
850 ss_eff_comb(&i
->effs
[e
->ss_eff
.channel
],
851 e
->ss_eff
.size
, e
->ss_eff
.gain
);
854 case SONG_EV_SS_EFF_ALLPASS
:
856 ss_eff_allpass(&i
->effs
[e
->ss_eff
.channel
],
857 e
->ss_eff
.size
, e
->ss_eff
.gain
);
860 case SONG_EV_SS_EFF_FLANGER
:
862 ss_eff_flanger(&i
->effs
[e
->ss_eff
.channel
],
863 e
->ss_eff
.size
, e
->ss_eff
.gain
,
864 e
->ss_eff
.depth
, e
->ss_eff
.freq
,
868 case SONG_EV_SS_EFF_WOBBLE
:
870 ss_eff_wobble(&i
->effs
[e
->ss_eff
.channel
],
871 e
->ss_eff
.freq
, e
->ss_eff
.phase
);
875 case SONG_EV_SS_EFF_SQWOBBLE
:
877 ss_eff_square_wobble(&i
->effs
[e
->ss_eff
.channel
],
878 e
->ss_eff
.freq
, e
->ss_eff
.phase
);
882 case SONG_EV_SS_EFF_FADER
:
884 ss_eff_fader(&i
->effs
[e
->ss_eff
.channel
],
885 e
->ss_eff
.size
, e
->ss_eff
.initial
,
889 case SONG_EV_SS_EFF_REVERB
:
891 ss_eff_reverb(&i
->effs
[e
->ss_eff
.channel
]);
894 case SONG_EV_SS_EFF_OFF
:
896 ss_eff_off(&i
->effs
[e
->ss_eff
.channel
]);
901 /* just store the last tempo */
902 tempo
= e
->tempo
.tempo
;
905 case SONG_EV_SS_PITCH_STRETCH
:
908 freq
= ss_note_frequency(e
->ss_pitch_stretch
.note
);
909 w
= ss_ins_find_layer(i
, freq
, NULL
);
911 /* calculate optimal frequency */
912 freq
= ss_pitch_from_tempo(w
, tempo
,
913 e
->ss_pitch_stretch
.len
);
916 ss_ins_play(i
, freq
, e
->ss_pitch_stretch
.vol
,
917 e
->ss_pitch_stretch
.note_id
, w
);
921 case SONG_EV_SS_PRINT_WAVE_TEMPO
:
924 freq
= ss_note_frequency(e
->ss_print_wave_tempo
.note
);
925 w
= ss_ins_find_layer(i
, freq
, NULL
);
927 /* print the optimal tempo */
928 printf("Optimal tempo: %lf\n",
929 ss_tempo_from_wave(w
,
930 e
->ss_print_wave_tempo
.note
,
931 e
->ss_print_wave_tempo
.len
));
935 case SONG_EV_SONG_INFO
:
937 /* add a new song (track) */
938 cue_file_song_info(frame
, e
->song_info
.author
,
948 case SONG_EV_MIDI_CHANNEL
:
949 case SONG_EV_MIDI_PROGRAM
:
952 case SONG_EV_MEASURE
:
954 /* never found in ss song streams */
962 /* reset frame samples */
963 ss_output_init_frame(output
);
965 /* generate output from all instruments */
966 for(n
= 0;n
< n_tracks
;n
++)
967 ss_ins_frame(&ss_song_ins
[n
], output
);
969 /* dump to sampling driver */
970 ss_output_write(output
);
976 if(verbose
>= 1) printf("\n");