Brickworks > API documentation > bw_voice_alloc

bw_voice_alloc

Description

Basic voice allocator with low/high note priority.

Info

Module type: utility

Version: 1.0.1

Requires:

API

bw_voice_alloc_priority

typedef enum {
	bw_voice_alloc_priority_low,
	bw_voice_alloc_priority_high
} bw_voice_alloc_priority;

Note priority:

bw_voice_alloc_opts

typedef struct {
	bw_voice_alloc_priority priority;

	void (*note_on)(
		void * BW_RESTRICT voice,
		unsigned char      note,
		float              velocity);

	void (*note_off)(
		void * BW_RESTRICT voice,
		float              velocity);

	unsigned char (*get_note)(
		const void * BW_RESTRICT voice);

	char (*is_free)(
		const void * BW_RESTRICT voice);
} bw_voice_alloc_opts;

Voice allocation options:

bw_voice_alloc()

void bw_voice_alloc(
	const bw_voice_alloc_opts * BW_RESTRICT opts,
	bw_note_queue * BW_RESTRICT             queue,
	void * BW_RESTRICT const * BW_RESTRICT  voices,
	size_t                                  n_voices);

It performs voice allocation according to opts and using the events in queue.

voices is the array of opaque voice pointers and n_voices indicates the number of elements in voices.

ChangeLog