def set_instruments(all_instruments): """ setter """ global instruments instruments = all_instruments max.send_instruments()
def update_instrument(instrument_id, message_type, note): """ Update this note within the instrument (creating, moving, or deleting) """ global instruments instrument = instruments[instrument_id] if message_type is 'change_note': for index, instrument_note in enumerate(instrument): if instrument_note['id'] == note['id']: instrument[index] = note elif message_type is 'add_note': instrument.append(note) elif message_type is 'remove_note': for index, instrument_note in enumerate(instrument): if instrument_note['id'] == note['id']: instrument.pop(index) max.send_instruments()