Update Fluidsynth to 2.0.1
[ardour.git] / libs / fluidsynth / src / fluid_event.h
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 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.
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  * Lesser General Public License for more details.
14  *
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
18  * 02110-1301, USA
19  */
20
21
22 #ifndef _FLUID_EVENT_PRIV_H
23 #define _FLUID_EVENT_PRIV_H
24
25 #include "fluidsynth.h"
26 #include "fluid_sys.h"
27
28 /* Private data for event */
29 /* ?? should be optimized in size, using unions */
30 struct _fluid_event_t
31 {
32     unsigned int time;
33     int type;
34     fluid_seq_id_t src;
35     fluid_seq_id_t dest;
36     int channel;
37     short key;
38     short vel;
39     short control;
40     short value;
41     short id; //?? unused ?
42     int pitch;
43     unsigned int duration;
44     void *data;
45 };
46
47 unsigned int fluid_event_get_time(fluid_event_t *evt);
48 void fluid_event_set_time(fluid_event_t *evt, unsigned int time);
49
50 void fluid_event_clear(fluid_event_t *evt);
51
52 /* private data for sorter + heap */
53 enum fluid_evt_entry_type
54 {
55     FLUID_EVT_ENTRY_INSERT = 0,
56     FLUID_EVT_ENTRY_REMOVE
57 };
58
59 typedef struct _fluid_evt_entry fluid_evt_entry;
60 struct _fluid_evt_entry
61 {
62     fluid_evt_entry *next;
63     short entryType;
64     fluid_event_t evt;
65 };
66
67 #define HEAP_WITH_DYNALLOC 1
68 /* #undef HEAP_WITH_DYNALLOC */
69
70 typedef struct _fluid_evt_heap_t
71 {
72 #ifdef HEAP_WITH_DYNALLOC
73     fluid_evt_entry *freelist;
74     fluid_mutex_t mutex;
75 #else
76     fluid_evt_entry *head;
77     fluid_evt_entry *tail;
78     fluid_evt_entry pool;
79 #endif
80 } fluid_evt_heap_t;
81
82 fluid_evt_heap_t *_fluid_evt_heap_init(int nbEvents);
83 void _fluid_evt_heap_free(fluid_evt_heap_t *heap);
84 fluid_evt_entry *_fluid_seq_heap_get_free(fluid_evt_heap_t *heap);
85 void _fluid_seq_heap_set_free(fluid_evt_heap_t *heap, fluid_evt_entry *evt);
86
87 #endif /* _FLUID_EVENT_PRIV_H */