
The presence of this pool allows allocation and releasing memory for events in constant time, and with no memory overhead.
On-line statistics will be kept to see the current number in use and peak number in use of:
5.1.1 Free list
The elements in the pool of free cells are implemented as records that form
a linked list. This makes memory allocation an constant time operation and
there will be no fragmentation problems.
Following (internal) functions are provided:
/* release this cell */ extern void snd_seq_cell_free(snd_seq_event_cell_t* cell); /* return pointer to cell, NULL on failure */ extern snd_seq_event_cell_t *snd_seq_cell_alloc(void); /* duplicate event, NULL on failure */ extern snd_seq_event_cell_t *snd_seq_event_dup(snd_seq_event_t *event); /* duplicate event cell, NULL on failure */ extern snd_seq_event_cell_t *snd_seq_cell_dup(snd_seq_event_cell_t *event); /* return number of unused (free) cells */ extern int snd_seq_unused_cells(void); /* return total number of allocated cells */ extern int snd_seq_total_cells(void);

Following (internal) functions are provided:
/* initialise fifo */ extern void snd_seq_fifo_init(fifo_t *f); /* enqueue cell to fifo */ extern void snd_seq_fifo_cell_in(fifo_t *f, snd_seq_event_cell_t *cell); /* dequeue cell from fifo */ extern snd_seq_event_cell_t *snd_seq_fifo_cell_out(fifo_t *f); /* return number of events available in fifo */ extern int snd_seq_fifo_avail(fifo_t *f); /* peek at cell at the head of the fifo */ extern snd_seq_event_cell_t *snd_seq_fifo_cell_peek(fifo_t *f);
Insertions in the middle take more time when the queue becomes longer. Try to keep not more than a few hundered events queued if possible.
In a future this priority queue can be optimised by using a better, more efficient algorithm (e.g. heap). Care should be taken no to make the common cases much worse than they are now.
Following (internal) functions are provided:
/* initialise prioq */ extern void snd_seq_prioq_init(prioq_t *f); /* enqueue cell to prioq */ extern void snd_seq_prioq_cell_in(prioq_t *f, snd_seq_event_cell_t *cell); /* dequeue cell from prioq */ extern snd_seq_event_cell_t *snd_seq_prioq_cell_out(prioq_t *f); /* return number of events available in prioq */ extern int snd_seq_prioq_avail(prioq_t *f); /* peek at cell at the head of the prioq */ extern snd_seq_event_cell_t *snd_seq_prioq_cell_peek(prioq_t *f);
| Version 0.036, April 2nd, 1999 | Usage: |
| Copyright (c) 1998 by Frank van de Pol, Netherlands | Advanced Linux Sound Architecture |