Created
June 13, 2017 04:39
-
-
Save piedoom/2b47ba860a0c6127996c6d16b36c8b2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn set_voice_note_on(&mut self, note_data: NoteData){ | |
// loop over all available voices | |
for voice in &mut self.voices { | |
// check the `VoiceState` and find one that's off | |
if voice.state == VoiceState::Off { | |
// send a note to an unused voice. | |
voice.note_data = note_data; | |
// add our voice to our vector of used voice references | |
self.voices_in_use.push(voice); // <===== compiles if removed | |
break | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment