denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Denemo-devel] Fluidsynth build


From: Richard Shann
Subject: Re: [Denemo-devel] Fluidsynth build
Date: Wed, 28 Oct 2009 18:55:03 +0000

On Wed, 2009-10-28 at 11:08 -0500, Jeremiah Benham wrote:
> > > 
> > > If this is all we have we will have to fire this off at the time
> of each
> > > midi event. Would we use a similar timer that would increment an
> index
> > > in midi ticks for time then run fluid_synth_noteon in a for loop.
> > > Something like is sudo code:
> > > 
> > > for (;;){
> > >   if (smf->midi_tick = NULL){ //end of song
> > >     EndOfSong = TRUE;
> > >     break;
> > >   }
> > >   if (index smf->event->midi_tick)
> > >     fluid_synth_noteon(synth, channel, key, velocity);
> > > 
> > >   smf->event = smf_next_event();    
> > > }
> > > 
> > > The the timer would be stopped and index reset to 0 when EndOfSong
> ==
> > > TRUE; 
> > > 
> > > Am I on the right track with that?
> > 
> > I think you may need:
> > 
> > fluid_synth_t fluid_synth_handle_midi_event() calls the appropriate
> > synth routine (noteon, pitch bend etc).
> > 
> > which I found at 
> > 
> > https://resonance.org/svn/fluidsynth/api/index.html
> 
> 
> Would I implement a timer as I mentioned above?

I was imagining we can do the control using the same code as we use to
control the content and timing of the output of MIDI events to JACK,
just at the last moment call fluid_synth_handle_midi_event() rather than
shovelling the data out to JACK. But thinking about it, the feed to JACK
is interrupt driven, so you would need something to move the feed to
fluidsynth on. But the for(;;) looks wrong. There is a callback for when
gtk is idle, in that callback you could look to see if there was a song
in progress and if the next smf_event was due and put it out if so.
So on play with fluidsynth you would set the idle callback to a callback
- fluidsynth_out(), say - and this callback would look at the current
time and the time of the smf_peek_event and call
fluid_synth_handle_midi_event() if it is due and end the timer if no
more events.


Richard














reply via email to

[Prev in Thread] Current Thread [Next in Thread]