seq.h
上传用户:tjmskj2
上传日期:2020-08-17
资源大小:577k
文件大小:3k
源码类别:

midi

开发平台:

C/C++

  1. /* FluidSynth - A Software Synthesizer
  2.  *
  3.  * Copyright (C) 2003  Peter Hanappe and others.
  4.  *
  5.  * This library is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU Library General Public License
  7.  * as published by the Free Software Foundation; either version 2 of
  8.  * the License, or (at your option) any later version.
  9.  *
  10.  * This library is distributed in the hope that it will be useful, but
  11.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * Library General Public License for more details.
  14.  *  
  15.  * You should have received a copy of the GNU Library General Public
  16.  * License along with this library; if not, write to the Free
  17.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  18.  * 02111-1307, USA
  19.  */
  20. #ifndef _FLUIDSYNTH_SEQ_H
  21. #define _FLUIDSYNTH_SEQ_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /**
  26.  * @file seq.h
  27.  * @brief MIDI event sequencer.
  28.  */
  29. /**
  30.  * Event callback prototype for destination clients.
  31.  * @param time Current sequencer tick value (see fluid_sequencer_get_tick()).
  32.  * @param event The event being received
  33.  * @param seq The sequencer instance
  34.  * @param data User defined data registered with the client
  35.  */
  36. typedef void (*fluid_event_callback_t)(unsigned int time, fluid_event_t* event, 
  37.       fluid_sequencer_t* seq, void* data);
  38. FLUIDSYNTH_API fluid_sequencer_t* new_fluid_sequencer(void);
  39. FLUIDSYNTH_API fluid_sequencer_t* new_fluid_sequencer2(int use_system_timer);
  40. FLUIDSYNTH_API void delete_fluid_sequencer(fluid_sequencer_t* seq);
  41. FLUIDSYNTH_API int fluid_sequencer_get_use_system_timer(fluid_sequencer_t* seq);
  42. FLUIDSYNTH_API 
  43. short fluid_sequencer_register_client(fluid_sequencer_t* seq, const char *name, 
  44.      fluid_event_callback_t callback, void* data);
  45. FLUIDSYNTH_API void fluid_sequencer_unregister_client(fluid_sequencer_t* seq, short id);
  46. FLUIDSYNTH_API int fluid_sequencer_count_clients(fluid_sequencer_t* seq);
  47. FLUIDSYNTH_API short fluid_sequencer_get_client_id(fluid_sequencer_t* seq, int index);
  48. FLUIDSYNTH_API char* fluid_sequencer_get_client_name(fluid_sequencer_t* seq, int id);
  49. FLUIDSYNTH_API int fluid_sequencer_client_is_dest(fluid_sequencer_t* seq, int id);
  50. FLUIDSYNTH_API void fluid_sequencer_process(fluid_sequencer_t* seq, unsigned int msec);
  51. FLUIDSYNTH_API void fluid_sequencer_send_now(fluid_sequencer_t* seq, fluid_event_t* evt);
  52. FLUIDSYNTH_API 
  53. int fluid_sequencer_send_at(fluid_sequencer_t* seq, fluid_event_t* evt, 
  54.    unsigned int time, int absolute);
  55. FLUIDSYNTH_API 
  56. void fluid_sequencer_remove_events(fluid_sequencer_t* seq, short source, short dest, int type);
  57. FLUIDSYNTH_API unsigned int fluid_sequencer_get_tick(fluid_sequencer_t* seq);
  58. FLUIDSYNTH_API void fluid_sequencer_set_time_scale(fluid_sequencer_t* seq, double scale);
  59. FLUIDSYNTH_API double fluid_sequencer_get_time_scale(fluid_sequencer_t* seq);
  60. // Compile in internal traceing functions
  61. #define FLUID_SEQ_WITH_TRACE 0
  62. #if FLUID_SEQ_WITH_TRACE
  63. FLUIDSYNTH_API char * fluid_seq_gettrace(fluid_sequencer_t* seq);
  64. FLUIDSYNTH_API void fluid_seq_cleartrace(fluid_sequencer_t* seq);
  65. #endif
  66. #ifdef __cplusplus
  67. }
  68. #endif
  69. #endif /* _FLUIDSYNTH_SEQ_H */