Created
June 12, 2017 22:20
-
-
Save piedoom/17b088b2783f5ece4fcc9f16fda034d5 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_off(&mut self, note_data: NoteData){ | |
for voice in &mut self.voices { | |
match voice.state { | |
// we only care if the note is currently on | |
VoiceState::On => { | |
// check if this voice is currently playing the note desired to be turned off | |
if voice.note_data.note == note_data.note { | |
// success - we found the voice to turn off | |
// replace the stored `voice.note_data` with our new `note_data` | |
voice.note_data = note_data; | |
} | |
} | |
// we don't care about anything else here | |
_ => return | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment