Module oxcable::voice_array
[−]
[src]
A polyphonic voice array.
The voice array maintains a set of identical voices, and is designed to simplify building polyphonic instruments.
Each voice may be in two states: playing or free. The array tracks the play state and note of each voice, and uses them to select a voice to handle new note events.
When a voice is selected to start or stop playing, a reference to that voice is then returned so the implementor can trigger any changes needed in the voice.
Example
For an example instrument that uses VoiceArray
, see
test_voice_array.rs.
Note selection
When selecting which voice to use for a new note event, several criteria are used:
- If the triggered note is already playing, return the same voice already playing it.
- If there are free voices, return the voice that has been free the longest.
- If there are no free voices, return the voice that has been held the longest.
Structs
VoiceArray |
A manager for a polyphonic set of voices. |