#include <stdlib.h>
#include <stdio.h>
#include <fluidsynth.h>
short synth_destination, client_destination;
unsigned int time_marker;
unsigned int duration = 1440;
unsigned int notes[] = { 60, 64, 67, 72, 76, 79, 84, 79, 76, 72, 67, 64 };
unsigned int pattern_size;
void
void
schedule_noteon (int chan, short key, unsigned int ticks)
{
}
void
schedule_noteoff (int chan, short key, unsigned int ticks)
{
}
void
schedule_timer_event ()
{
}
void
schedule_pattern ()
{
int i, note_time, note_duration;
note_time = time_marker;
note_duration = duration / pattern_size;
for (i = 0; i < pattern_size; ++i) {
schedule_noteon (0, notes[i], note_time);
note_time += note_duration;
schedule_noteoff (0, notes[i], note_time);
}
time_marker += duration;
}
void
{
schedule_timer_event ();
schedule_pattern ();
}
void
usage (char* prog_name)
{
printf ("Usage: %s soundfont.sf2 [steps [duration]]\n", prog_name);
printf ("\t(optional) steps: number of pattern notes, from 2 to %d\n",
pattern_size);
printf ("\t(optional) duration: of the pattern in ticks, default %d\n",
duration);
}
int
main (int argc, char* argv[])
{
int n;
pattern_size = sizeof(notes) / sizeof(int);
if (argc < 2) {
usage (argv[0]);
} else {
synth);
"arpeggio", sequencer_callback, NULL);
if (n != -1) {
if (argc > 2) {
n = atoi (argv[2]);
if ((n > 1) && (n <= pattern_size)) pattern_size = n;
}
if (argc > 3) {
n = atoi (argv[3]);
if (n > 0) duration = n;
}
schedule_pattern ();
schedule_timer_event ();
schedule_pattern ();
printf ("press <Enter> to stop\n");
n = getchar ();
}
}
return 0;
}