1 /* FluidSynth - A Software Synthesizer
3 * Copyright (C) 2003 Peter Hanappe and others.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1 of
8 * the License, or (at your option) any later version.
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 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 #ifndef _FLUIDSYNTH_EVENT_H
22 #define _FLUIDSYNTH_EVENT_H
30 * @brief Sequencer event functions and defines.
32 * Functions and constants for creating/processing sequencer events.
36 * Sequencer event type enumeration.
38 enum fluid_seq_event_type
40 FLUID_SEQ_NOTE
= 0, /**< Note event with duration */
41 FLUID_SEQ_NOTEON
, /**< Note on event */
42 FLUID_SEQ_NOTEOFF
, /**< Note off event */
43 FLUID_SEQ_ALLSOUNDSOFF
, /**< All sounds off event */
44 FLUID_SEQ_ALLNOTESOFF
, /**< All notes off event */
45 FLUID_SEQ_BANKSELECT
, /**< Bank select message */
46 FLUID_SEQ_PROGRAMCHANGE
, /**< Program change message */
47 FLUID_SEQ_PROGRAMSELECT
, /**< Program select message */
48 FLUID_SEQ_PITCHBEND
, /**< Pitch bend message */
49 FLUID_SEQ_PITCHWHEELSENS
, /**< Pitch wheel sensitivity set message @since 1.1.0 was mispelled previously */
50 FLUID_SEQ_MODULATION
, /**< Modulation controller event */
51 FLUID_SEQ_SUSTAIN
, /**< Sustain controller event */
52 FLUID_SEQ_CONTROLCHANGE
, /**< MIDI control change event */
53 FLUID_SEQ_PAN
, /**< Stereo pan set event */
54 FLUID_SEQ_VOLUME
, /**< Volume set event */
55 FLUID_SEQ_REVERBSEND
, /**< Reverb send set event */
56 FLUID_SEQ_CHORUSSEND
, /**< Chorus send set event */
57 FLUID_SEQ_TIMER
, /**< Timer event (useful for giving a callback at a certain time) */
58 FLUID_SEQ_ANYCONTROLCHANGE
, /**< Any control change message (only internally used for remove_events) */
59 FLUID_SEQ_CHANNELPRESSURE
, /**< Channel aftertouch event @since 1.1.0 */
60 FLUID_SEQ_KEYPRESSURE
, /**< Polyphonic aftertouch event @since 2.0.0 */
61 FLUID_SEQ_SYSTEMRESET
, /**< System reset event @since 1.1.0 */
62 FLUID_SEQ_UNREGISTERING
, /**< Called when a sequencer client is being unregistered. @since 1.1.0 */
64 FLUID_SEQ_LASTEVENT
/**< @internal Defines the count of events enums @warning This symbol is not part of the public API and ABI stability guarantee and may change at any time! */
68 /* Event alloc/free */
69 FLUIDSYNTH_API fluid_event_t
*new_fluid_event(void);
70 FLUIDSYNTH_API
void delete_fluid_event(fluid_event_t
*evt
);
72 /* Initializing events */
73 FLUIDSYNTH_API
void fluid_event_set_source(fluid_event_t
*evt
, fluid_seq_id_t src
);
74 FLUIDSYNTH_API
void fluid_event_set_dest(fluid_event_t
*evt
, fluid_seq_id_t dest
);
77 FLUIDSYNTH_API
void fluid_event_timer(fluid_event_t
*evt
, void *data
);
80 FLUIDSYNTH_API
void fluid_event_note(fluid_event_t
*evt
, int channel
,
82 unsigned int duration
);
84 FLUIDSYNTH_API
void fluid_event_noteon(fluid_event_t
*evt
, int channel
, short key
, short vel
);
85 FLUIDSYNTH_API
void fluid_event_noteoff(fluid_event_t
*evt
, int channel
, short key
);
86 FLUIDSYNTH_API
void fluid_event_all_sounds_off(fluid_event_t
*evt
, int channel
);
87 FLUIDSYNTH_API
void fluid_event_all_notes_off(fluid_event_t
*evt
, int channel
);
89 /* Instrument selection */
90 FLUIDSYNTH_API
void fluid_event_bank_select(fluid_event_t
*evt
, int channel
, short bank_num
);
91 FLUIDSYNTH_API
void fluid_event_program_change(fluid_event_t
*evt
, int channel
, short preset_num
);
92 FLUIDSYNTH_API
void fluid_event_program_select(fluid_event_t
*evt
, int channel
, unsigned int sfont_id
, short bank_num
, short preset_num
);
94 /* Real-time generic instrument controllers */
96 void fluid_event_control_change(fluid_event_t
*evt
, int channel
, short control
, short val
);
98 /* Real-time instrument controllers shortcuts */
99 FLUIDSYNTH_API
void fluid_event_pitch_bend(fluid_event_t
*evt
, int channel
, int val
);
100 FLUIDSYNTH_API
void fluid_event_pitch_wheelsens(fluid_event_t
*evt
, int channel
, short val
);
101 FLUIDSYNTH_API
void fluid_event_modulation(fluid_event_t
*evt
, int channel
, short val
);
102 FLUIDSYNTH_API
void fluid_event_sustain(fluid_event_t
*evt
, int channel
, short val
);
103 FLUIDSYNTH_API
void fluid_event_pan(fluid_event_t
*evt
, int channel
, short val
);
104 FLUIDSYNTH_API
void fluid_event_volume(fluid_event_t
*evt
, int channel
, short val
);
105 FLUIDSYNTH_API
void fluid_event_reverb_send(fluid_event_t
*evt
, int channel
, short val
);
106 FLUIDSYNTH_API
void fluid_event_chorus_send(fluid_event_t
*evt
, int channel
, short val
);
108 FLUIDSYNTH_API
void fluid_event_key_pressure(fluid_event_t
*evt
, int channel
, short key
, short val
);
109 FLUIDSYNTH_API
void fluid_event_channel_pressure(fluid_event_t
*evt
, int channel
, short val
);
110 FLUIDSYNTH_API
void fluid_event_system_reset(fluid_event_t
*evt
);
113 /* Only for removing events */
114 FLUIDSYNTH_API
void fluid_event_any_control_change(fluid_event_t
*evt
, int channel
);
116 /* Only when unregistering clients */
117 FLUIDSYNTH_API
void fluid_event_unregistering(fluid_event_t
*evt
);
119 /* Accessing event data */
120 FLUIDSYNTH_API
int fluid_event_get_type(fluid_event_t
*evt
);
121 FLUIDSYNTH_API fluid_seq_id_t
fluid_event_get_source(fluid_event_t
*evt
);
122 FLUIDSYNTH_API fluid_seq_id_t
fluid_event_get_dest(fluid_event_t
*evt
);
123 FLUIDSYNTH_API
int fluid_event_get_channel(fluid_event_t
*evt
);
124 FLUIDSYNTH_API
short fluid_event_get_key(fluid_event_t
*evt
);
125 FLUIDSYNTH_API
short fluid_event_get_velocity(fluid_event_t
*evt
);
126 FLUIDSYNTH_API
short fluid_event_get_control(fluid_event_t
*evt
);
127 FLUIDSYNTH_API
short fluid_event_get_value(fluid_event_t
*evt
);
128 FLUIDSYNTH_API
short fluid_event_get_program(fluid_event_t
*evt
);
129 FLUIDSYNTH_API
void *fluid_event_get_data(fluid_event_t
*evt
);
130 FLUIDSYNTH_API
unsigned int fluid_event_get_duration(fluid_event_t
*evt
);
131 FLUIDSYNTH_API
short fluid_event_get_bank(fluid_event_t
*evt
);
132 FLUIDSYNTH_API
int fluid_event_get_pitch(fluid_event_t
*evt
);
133 FLUIDSYNTH_API
unsigned int fluid_event_get_sfont_id(fluid_event_t
*evt
);
138 #endif /* _FLUIDSYNTH_EVENT_H */