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 * 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 unsigned int time; 32 int type; 33 short src; 34 short dest; 35 int channel; 36 short key; 37 short vel; 38 short control; 39 short value; 40 short id; //?? unused ? 41 int pitch; 42 unsigned int duration; 43 void* data; 44 }; 45 46 unsigned int fluid_event_get_time(fluid_event_t* evt); 47 void fluid_event_set_time(fluid_event_t* evt, unsigned int time); 48 49 void fluid_event_clear(fluid_event_t* evt); 50 51 /* private data for sorter + heap */ 52 enum fluid_evt_entry_type { 53 FLUID_EVT_ENTRY_INSERT = 0, 54 FLUID_EVT_ENTRY_REMOVE 55 }; 56 57 typedef struct _fluid_evt_entry fluid_evt_entry; 58 struct _fluid_evt_entry { 59 fluid_evt_entry *next; 60 short entryType; 61 fluid_event_t evt; 62 }; 63 64 #define HEAP_WITH_DYNALLOC 1 65 /* #undef HEAP_WITH_DYNALLOC */ 66 67 typedef struct _fluid_evt_heap_t { 68 #ifdef HEAP_WITH_DYNALLOC 69 fluid_evt_entry* freelist; 70 fluid_mutex_t mutex; 71 #else 72 fluid_evt_entry* head; 73 fluid_evt_entry* tail; 74 fluid_evt_entry pool; 75 #endif 76 } fluid_evt_heap_t; 77 78 fluid_evt_heap_t* _fluid_evt_heap_init(int nbEvents); 79 void _fluid_evt_heap_free(fluid_evt_heap_t* heap); 80 fluid_evt_entry* _fluid_seq_heap_get_free(fluid_evt_heap_t* heap); 81 void _fluid_seq_heap_set_free(fluid_evt_heap_t* heap, fluid_evt_entry* evt); 82 83 #endif /* _FLUID_EVENT_PRIV_H */ 84