mirror of
https://github.com/StyledStrike/musical-keyboard.git
synced 2025-03-04 03:13:36 -05:00
Prevent errors from missing MIDI instruments
This commit is contained in:
parent
3963e9e16b
commit
97e3c6353d
@ -220,7 +220,7 @@ function MKeyboard:OnNoteOn( note, velocity, instrument, isMidi )
|
||||
velocity = velocity or self.settings.velocity
|
||||
instrument = instrument or self.settings.instrument
|
||||
|
||||
local instr = self.instruments[instrument]
|
||||
local instr = self.instruments[instrument] or self.instruments[1]
|
||||
if note < instr.firstNote or note > instr.lastNote then return end
|
||||
|
||||
self.entity:EmitNote( note, velocity, 80, instrument, isMidi )
|
||||
|
Loading…
Reference in New Issue
Block a user