voice.h 510 Bytes
Newer Older
Jacob Vosmaer's avatar
Jacob Vosmaer committed
1 2 3
#ifndef voice_h
#define voice_h

4
#include <stdint.h>
Jacob Vosmaer's avatar
Jacob Vosmaer committed
5 6 7 8 9 10

enum _voices {
	VOICE1,
	VOICE2,
	VOICE3,
	VOICE4,
11
	NUM_VOICES, // dual use: number of voices, but also the "not found" or "empty" response
Jacob Vosmaer's avatar
Jacob Vosmaer committed
12 13
};

Jacob Vosmaer's avatar
Jacob Vosmaer committed
14
#define for_each_voice(var) for (uint8_t var = 0; var < NUM_VOICES; var++)
15

16
void voice_init(void);
17

18 19
// voice_acquire returns a voice number for playing a new note
uint8_t voice_acquire();
20

21 22
// voice_release releases a voice, if playing. If v is not playing this is a no-op.
void voice_release(uint8_t v);
Jacob Vosmaer's avatar
Jacob Vosmaer committed
23 24

#endif