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 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 */ 30struct _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 46unsigned int fluid_event_get_time(fluid_event_t* evt); 47void fluid_event_set_time(fluid_event_t* evt, unsigned int time); 48 49/* private data for sorter + heap */ 50enum fluid_evt_entry_type { 51 FLUID_EVT_ENTRY_INSERT = 0, 52 FLUID_EVT_ENTRY_REMOVE 53}; 54 55typedef struct _fluid_evt_entry fluid_evt_entry; 56struct _fluid_evt_entry { 57 fluid_evt_entry *next; 58 short entryType; 59 fluid_event_t evt; 60}; 61 62#define HEAP_WITH_DYNALLOC 1 63/* #undef HEAP_WITH_DYNALLOC */ 64 65typedef struct _fluid_evt_heap_t { 66#ifdef HEAP_WITH_DYNALLOC 67 fluid_evt_entry* freelist; 68 fluid_mutex_t mutex; 69#else 70 fluid_evt_entry* head; 71 fluid_evt_entry* tail; 72 fluid_evt_entry pool; 73#endif 74} fluid_evt_heap_t; 75 76fluid_evt_heap_t* _fluid_evt_heap_init(int nbEvents); 77void _fluid_evt_heap_free(fluid_evt_heap_t* heap); 78fluid_evt_entry* _fluid_seq_heap_get_free(fluid_evt_heap_t* heap); 79void _fluid_seq_heap_set_free(fluid_evt_heap_t* heap, fluid_evt_entry* evt); 80 81#endif /* _FLUID_EVENT_PRIV_H */ 82