# include/fluidsynth/midi.h

Go to the documentation of this file.

    00001 /* FluidSynth - A Software Synthesizer
    00002  *
    00003  * Copyright (C) 2003  Peter Hanappe and others.
    00004  *
    00005  * This library is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU Library General Public License
    00007  * as published by the Free Software Foundation; either version 2 of
    00008  * the License, or (at your option) any later version.
    00009  *
    00010  * This library is distributed in the hope that it will be useful, but
    00011  * WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * Library General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Library General Public
    00016  * License along with this library; if not, write to the Free
    00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    00018  * 02111-1307, USA
    00019  */
    00020
    00021 #ifndef _FLUIDSYNTH_MIDI_H
    00022 #define _FLUIDSYNTH_MIDI_H
    00023
    00024 #ifdef __cplusplus
    00025 extern "C" {
    00026 #endif
    00027
    00033 FLUIDSYNTH_API fluid_midi_event_t* new_fluid_midi_event(void);
    00034 FLUIDSYNTH_API int delete_fluid_midi_event(fluid_midi_event_t* event);
    00035
    00036 FLUIDSYNTH_API int fluid_midi_event_set_type(fluid_midi_event_t* evt, int type);
    00037 FLUIDSYNTH_API int fluid_midi_event_get_type(fluid_midi_event_t* evt);
    00038 FLUIDSYNTH_API int fluid_midi_event_set_channel(fluid_midi_event_t* evt, int chan);
    00039 FLUIDSYNTH_API int fluid_midi_event_get_channel(fluid_midi_event_t* evt);
    00040 FLUIDSYNTH_API int fluid_midi_event_get_key(fluid_midi_event_t* evt);
    00041 FLUIDSYNTH_API int fluid_midi_event_set_key(fluid_midi_event_t* evt, int key);
    00042 FLUIDSYNTH_API int fluid_midi_event_get_velocity(fluid_midi_event_t* evt);
    00043 FLUIDSYNTH_API int fluid_midi_event_set_velocity(fluid_midi_event_t* evt, int vel);
    00044 FLUIDSYNTH_API int fluid_midi_event_get_control(fluid_midi_event_t* evt);
    00045 FLUIDSYNTH_API int fluid_midi_event_set_control(fluid_midi_event_t* evt, int ctrl);
    00046 FLUIDSYNTH_API int fluid_midi_event_get_value(fluid_midi_event_t* evt);
    00047 FLUIDSYNTH_API int fluid_midi_event_set_value(fluid_midi_event_t* evt, int val);
    00048 FLUIDSYNTH_API int fluid_midi_event_get_program(fluid_midi_event_t* evt);
    00049 FLUIDSYNTH_API int fluid_midi_event_set_program(fluid_midi_event_t* evt, int val);
    00050 FLUIDSYNTH_API int fluid_midi_event_get_pitch(fluid_midi_event_t* evt);
    00051 FLUIDSYNTH_API int fluid_midi_event_set_pitch(fluid_midi_event_t* evt, int val);
    00052
    00053
    00066 typedef int (*handle_midi_event_func_t)(void* data, fluid_midi_event_t* event);
    00067
    00068 /*
    00069  *  MIDI router
    00070  *
    00071  *  The MIDI handler forwards incoming MIDI events to the synthesizer
    00072  */
    00073
    00074 FLUIDSYNTH_API fluid_midi_router_t* new_fluid_midi_router(fluid_settings_t* settings,
    00075                                                        handle_midi_event_func_t handler,
    00076                                                        void* event_handler_data);
    00077
    00078 FLUIDSYNTH_API int delete_fluid_midi_router(fluid_midi_router_t* handler);
    00079 FLUIDSYNTH_API int fluid_midi_router_handle_midi_event(void* data, fluid_midi_event_t* event);
    00080 FLUIDSYNTH_API int fluid_midi_dump_prerouter(void* data, fluid_midi_event_t* event);
    00081 FLUIDSYNTH_API int fluid_midi_dump_postrouter(void* data, fluid_midi_event_t* event);
    00082
    00083 /*
    00084  *  MIDI driver
    00085  *
    00086  *  The MIDI handler forwards incoming MIDI events to the synthesizer
    00087  */
    00088
    00089 FLUIDSYNTH_API
    00090 fluid_midi_driver_t* new_fluid_midi_driver(fluid_settings_t* settings,
    00091                                          handle_midi_event_func_t handler,
    00092                                          void* event_handler_data);
    00093
    00094 FLUIDSYNTH_API void delete_fluid_midi_driver(fluid_midi_driver_t* driver);
    00095
    00096
    00097
    00098 /*
    00099  *  MIDI file player
    00100  *
    00101  *  The MIDI player allows you to play MIDI files with the FLUID Synth
    00102  */
    00103
    00104 FLUIDSYNTH_API fluid_player_t* new_fluid_player(fluid_synth_t* synth);
    00105 FLUIDSYNTH_API int delete_fluid_player(fluid_player_t* player);
    00106 FLUIDSYNTH_API int fluid_player_add(fluid_player_t* player, char* midifile);
    00107 FLUIDSYNTH_API int fluid_player_play(fluid_player_t* player);
    00108 FLUIDSYNTH_API int fluid_player_stop(fluid_player_t* player);
    00109 FLUIDSYNTH_API int fluid_player_join(fluid_player_t* player);
    00110 FLUIDSYNTH_API int fluid_player_set_loop(fluid_player_t* player, int loop);
    00111 FLUIDSYNTH_API int fluid_player_set_midi_tempo(fluid_player_t* player, int tempo);
    00112 FLUIDSYNTH_API int fluid_player_set_bpm(fluid_player_t* player, int bpm);
    00113
    00114 #ifdef __cplusplus
    00115 }
    00116 #endif
    00117
    00118 #endif /* _FLUIDSYNTH_MIDI_H */