/* schedule a note on message */
void
schedule_noteon (int chan, short key, unsigned int ticks)
{
    fluid_event_t *ev = new_fluid_event ();
    fluid_event_set_source (ev, -1);
    fluid_event_set_dest (ev, synth_destination);
    fluid_event_noteon (ev, chan, key, 127);
    fluid_sequencer_send_at (sequencer, ev, ticks, 1);
    delete_fluid_event (ev);
}
/* schedule a timer event (shall trigger the callback) */
void
schedule_timer_event ()
{
    fluid_event_t *ev = new_fluid_event ();
    fluid_event_set_source (ev, -1);
    fluid_event_set_dest (ev, client_destination);
    fluid_event_timer (ev, NULL);
    fluid_sequencer_send_at (sequencer, ev, time_marker, 1);
    delete_fluid_event (ev);
}
Example #3
0
/**
 * Unregister a previously registered client.
 * @param seq Sequencer object
 * @param id Client ID as returned by fluid_sequencer_register_client().
 */
void
fluid_sequencer_unregister_client (fluid_sequencer_t* seq, short id)
{
	fluid_list_t *tmp;
	fluid_event_t* evt;

	if (seq->clients == NULL) return;

	evt = new_fluid_event();
	if (evt != NULL) {
		fluid_event_unregistering(evt);
		fluid_event_set_dest(evt, id);
	}

	tmp = seq->clients;
	while (tmp) {
  		fluid_sequencer_client_t *client = (fluid_sequencer_client_t*)tmp->data;

  		if (client->id == id) {
			/* What should we really do if evt is null due to out-of-memory? */
			if (client->callback != NULL && evt != NULL)
				(client->callback)(fluid_sequencer_get_tick(seq),
						 evt, seq, client->data);
   			if (client->name)
				FLUID_FREE(client->name);
			seq->clients = fluid_list_remove_link(seq->clients, tmp);
			delete1_fluid_list(tmp);
			FLUID_FREE(client);
			delete_fluid_event(evt);
			return;
  		}
   		tmp = tmp->next;
	}
	delete_fluid_event(evt);
	return;
}
Example #4
0
static void delete_data(Data *data){
  if(data->event!=NULL)
    delete_fluid_event(data->event);

  if(data->sequencer!=NULL)
    delete_fluid_sequencer(data->sequencer);

  if(data->synth!=NULL)
    delete_fluid_synth(data->synth);

  if(data->settings!=NULL)
    delete_fluid_settings(data->settings);

  if(data->filename!=NULL)
    free((wchar_t*)data->filename);

  if(data->signal_from_RT!=NULL)
    RSEMAPHORE_delete(data->signal_from_RT);

  free(data);
}