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
21#ifndef _FLUIDSYNTH_EVENT_H
22#define _FLUIDSYNTH_EVENT_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/**
29 * @file event.h
30 * @brief Sequencer event functions and defines.
31 *
32 * Functions and constants for creating/processing sequencer events.
33 */
34
35/**
36 * Sequencer event type enumeration.
37 */
38enum fluid_seq_event_type {
39  FLUID_SEQ_NOTE = 0,		/**< Note event (DOCME) */
40  FLUID_SEQ_NOTEON,		/**< Note on event */
41  FLUID_SEQ_NOTEOFF,		/**< Note off event */
42  FLUID_SEQ_ALLSOUNDSOFF,	/**< All sounds off event */
43  FLUID_SEQ_ALLNOTESOFF,	/**< All notes off event */
44  FLUID_SEQ_BANKSELECT,		/**< Bank select message */
45  FLUID_SEQ_PROGRAMCHANGE,	/**< Program change message */
46  FLUID_SEQ_PROGRAMSELECT,	/**< Program select message (DOCME) */
47  FLUID_SEQ_PITCHBEND,		/**< Pitch bend message */
48  FLUID_SEQ_PITCHWHHELSENS,	/**< Pitch wheel sensitivity set message */
49  FLUID_SEQ_MODULATION,		/**< Modulation controller event */
50  FLUID_SEQ_SUSTAIN,		/**< Sustain controller event */
51  FLUID_SEQ_CONTROLCHANGE,	/**< MIDI control change event */
52  FLUID_SEQ_PAN,		/**< Stereo pan set event */
53  FLUID_SEQ_VOLUME,		/**< Volume set event */
54  FLUID_SEQ_REVERBSEND,		/**< Reverb send set event */
55  FLUID_SEQ_CHORUSSEND,		/**< Chorus send set event */
56  FLUID_SEQ_TIMER,		/**< Timer event (DOCME) */
57  FLUID_SEQ_ANYCONTROLCHANGE,	/**< DOCME (used for remove_events only) */
58  FLUID_SEQ_LASTEVENT		/**< Defines the count of event enums */
59};
60
61/* Event alloc/free */
62FLUIDSYNTH_API fluid_event_t* new_fluid_event(void);
63FLUIDSYNTH_API void delete_fluid_event(fluid_event_t* evt);
64
65/* Initializing events */
66FLUIDSYNTH_API void fluid_event_set_source(fluid_event_t* evt, short src);
67FLUIDSYNTH_API void fluid_event_set_dest(fluid_event_t* evt, short dest);
68
69/* Timer events */
70FLUIDSYNTH_API void fluid_event_timer(fluid_event_t* evt, void* data);
71
72/* Note events */
73FLUIDSYNTH_API void fluid_event_note(fluid_event_t* evt, int channel,
74				   short key, short vel,
75				   unsigned int duration);
76
77FLUIDSYNTH_API void fluid_event_noteon(fluid_event_t* evt, int channel, short key, short vel);
78FLUIDSYNTH_API void fluid_event_noteoff(fluid_event_t* evt, int channel, short key);
79FLUIDSYNTH_API void fluid_event_all_sounds_off(fluid_event_t* evt, int channel);
80FLUIDSYNTH_API void fluid_event_all_notes_off(fluid_event_t* evt, int channel);
81
82/* Instrument selection */
83FLUIDSYNTH_API void fluid_event_bank_select(fluid_event_t* evt, int channel, short bank_num);
84FLUIDSYNTH_API void fluid_event_program_change(fluid_event_t* evt, int channel, short preset_num);
85FLUIDSYNTH_API void fluid_event_program_select(fluid_event_t* evt, int channel, unsigned int sfont_id, short bank_num, short preset_num);
86
87/* Real-time generic instrument controllers */
88FLUIDSYNTH_API
89void fluid_event_control_change(fluid_event_t* evt, int channel, short control, short val);
90
91/* Real-time instrument controllers shortcuts */
92FLUIDSYNTH_API void fluid_event_pitch_bend(fluid_event_t* evt, int channel, int val);
93FLUIDSYNTH_API void fluid_event_pitch_wheelsens(fluid_event_t* evt, int channel, short val);
94FLUIDSYNTH_API void fluid_event_modulation(fluid_event_t* evt, int channel, short val);
95FLUIDSYNTH_API void fluid_event_sustain(fluid_event_t* evt, int channel, short val);
96FLUIDSYNTH_API void fluid_event_pan(fluid_event_t* evt, int channel, short val);
97FLUIDSYNTH_API void fluid_event_volume(fluid_event_t* evt, int channel, short val);
98FLUIDSYNTH_API void fluid_event_reverb_send(fluid_event_t* evt, int channel, short val);
99FLUIDSYNTH_API void fluid_event_chorus_send(fluid_event_t* evt, int channel, short val);
100
101/* Only for removing events */
102FLUIDSYNTH_API void fluid_event_any_control_change(fluid_event_t* evt, int channel);
103
104/* Accessing event data */
105FLUIDSYNTH_API int fluid_event_get_type(fluid_event_t* evt);
106FLUIDSYNTH_API short fluid_event_get_source(fluid_event_t* evt);
107FLUIDSYNTH_API short fluid_event_get_dest(fluid_event_t* evt);
108FLUIDSYNTH_API int fluid_event_get_channel(fluid_event_t* evt);
109FLUIDSYNTH_API short fluid_event_get_key(fluid_event_t* evt);
110FLUIDSYNTH_API short fluid_event_get_velocity(fluid_event_t* evt);
111FLUIDSYNTH_API short fluid_event_get_control(fluid_event_t* evt);
112FLUIDSYNTH_API short fluid_event_get_value(fluid_event_t* evt);
113FLUIDSYNTH_API short fluid_event_get_program(fluid_event_t* evt);
114FLUIDSYNTH_API void* fluid_event_get_data(fluid_event_t* evt);
115FLUIDSYNTH_API unsigned int fluid_event_get_duration(fluid_event_t* evt);
116FLUIDSYNTH_API short fluid_event_get_bank(fluid_event_t* evt);
117FLUIDSYNTH_API int fluid_event_get_pitch(fluid_event_t* evt);
118FLUIDSYNTH_API unsigned int fluid_event_get_sfont_id(fluid_event_t* evt);
119
120#ifdef __cplusplus
121}
122#endif
123#endif /* _FLUIDSYNTH_EVENT_H */
124