Main Page   Data Structures   File List   Data Fields   Globals  

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 
00028 
00029 
00030 FLUIDSYNTH_API fluid_midi_event_t* new_fluid_midi_event(void);
00031 FLUIDSYNTH_API int delete_fluid_midi_event(fluid_midi_event_t* event);
00032 
00033 FLUIDSYNTH_API int fluid_midi_event_set_type(fluid_midi_event_t* evt, int type);
00034 FLUIDSYNTH_API int fluid_midi_event_get_type(fluid_midi_event_t* evt);
00035 FLUIDSYNTH_API int fluid_midi_event_set_channel(fluid_midi_event_t* evt, int chan);
00036 FLUIDSYNTH_API int fluid_midi_event_get_channel(fluid_midi_event_t* evt);
00037 FLUIDSYNTH_API int fluid_midi_event_get_key(fluid_midi_event_t* evt);
00038 FLUIDSYNTH_API int fluid_midi_event_set_key(fluid_midi_event_t* evt, int key);
00039 FLUIDSYNTH_API int fluid_midi_event_get_velocity(fluid_midi_event_t* evt);
00040 FLUIDSYNTH_API int fluid_midi_event_set_velocity(fluid_midi_event_t* evt, int vel);
00041 FLUIDSYNTH_API int fluid_midi_event_get_control(fluid_midi_event_t* evt);
00042 FLUIDSYNTH_API int fluid_midi_event_set_control(fluid_midi_event_t* evt, int ctrl);
00043 FLUIDSYNTH_API int fluid_midi_event_get_value(fluid_midi_event_t* evt);
00044 FLUIDSYNTH_API int fluid_midi_event_set_value(fluid_midi_event_t* evt, int val);
00045 FLUIDSYNTH_API int fluid_midi_event_get_program(fluid_midi_event_t* evt);
00046 FLUIDSYNTH_API int fluid_midi_event_set_program(fluid_midi_event_t* evt, int val);
00047 FLUIDSYNTH_API int fluid_midi_event_get_pitch(fluid_midi_event_t* evt);
00048 FLUIDSYNTH_API int fluid_midi_event_set_pitch(fluid_midi_event_t* evt, int val);
00049 
00050 
00051   /* Generic callback function for MIDI events.
00052    * Will be used between
00053    * - MIDI driver and MIDI router
00054    * - MIDI router and synth
00055    * to communicate events.
00056    * In the not-so-far future...
00057    */
00058 typedef int (*handle_midi_event_func_t)(void* data, fluid_midi_event_t* event);
00059 
00060   /*
00061    *
00062    *  MIDI router
00063    *
00064    *  The MIDI handler forwards incoming MIDI events to the synthesizer
00065    *
00066    */
00067 
00071 FLUIDSYNTH_API fluid_midi_router_t* new_fluid_midi_router(fluid_settings_t* settings,
00072                                                        handle_midi_event_func_t handler, 
00073                                                        void* event_handler_data); 
00074 
00080 FLUIDSYNTH_API int delete_fluid_midi_router(fluid_midi_router_t* handler); 
00081 
00084 FLUIDSYNTH_API int fluid_midi_router_handle_midi_event(void* data, fluid_midi_event_t* event);
00085 
00088 FLUIDSYNTH_API int fluid_midi_dump_prerouter(void* data, fluid_midi_event_t* event); 
00089 
00092 FLUIDSYNTH_API int fluid_midi_dump_postrouter(void* data, fluid_midi_event_t* event); 
00093 
00094 /*
00095  *
00096  *  MIDI driver
00097  *
00098  *  The MIDI handler forwards incoming MIDI events to the synthesizer
00099  *
00100  */
00101 
00102 
00103 FLUIDSYNTH_API 
00104 fluid_midi_driver_t* new_fluid_midi_driver(fluid_settings_t* settings, 
00105                                          handle_midi_event_func_t handler, 
00106                                          void* event_handler_data);
00107 
00108 FLUIDSYNTH_API void delete_fluid_midi_driver(fluid_midi_driver_t* driver);
00109 
00110 
00111 
00112 /*
00113  *
00114  *  MIDI file player
00115  *
00116  *  The MIDI player allows you to play MIDI files with the FLUID Synth
00117  *
00118  */
00119 
00120 FLUIDSYNTH_API fluid_player_t* new_fluid_player(fluid_synth_t* synth);
00121 FLUIDSYNTH_API int delete_fluid_player(fluid_player_t* player);
00122 FLUIDSYNTH_API int fluid_player_add(fluid_player_t* player, char* midifile);
00123 FLUIDSYNTH_API int fluid_player_play(fluid_player_t* player);
00124 FLUIDSYNTH_API int fluid_player_stop(fluid_player_t* player);
00125 FLUIDSYNTH_API int fluid_player_join(fluid_player_t* player);
00126 FLUIDSYNTH_API int fluid_player_set_loop(fluid_player_t* player, int loop);
00127 FLUIDSYNTH_API int fluid_player_set_midi_tempo(fluid_player_t* player, int tempo);
00128 FLUIDSYNTH_API int fluid_player_set_bpm(fluid_player_t* player, int bpm);
00129 
00130 #ifdef __cplusplus
00131 }
00132 #endif
00133 
00134 #endif /* _FLUIDSYNTH_MIDI_H */

Generated on Thu Mar 13 19:09:34 2003 for libfluidsynth by doxygen1.2.15