def _initialize_performer(performer, session): from abjad.tools import instrumenttools menu = PerformerInventory._make_performer_configuration_menu( performer, session, ) while True: result = menu._run() if menu._session.is_backtracking: return elif not result: continue if result in ('skip', ['skip']): break elif result in ('more', ['more']): inventory = instrumenttools.InstrumentInventory() class_ = inventory._make_item_creator_class() item_creator = class_( session=session, is_ranged=True, ) instruments = item_creator._run() if item_creator._session.is_backtracking: break if instruments is not None: for instrument in instruments: performer.instruments.append(instrument) break elif isinstance(result, list): name = '_default_instrument_name_to_instrument_class' method = getattr(instrumenttools.Instrument, name) for instrument_name in result: instrument_class = method(instrument_name) instrument = instrument_class() performer.instruments.append(instrument) break else: raise Exception("how'd we get here?")
def __init__(self, name=None, instruments=None): from abjad.tools import instrumenttools self._instruments = instrumenttools.InstrumentInventory() self.name = name self.instruments = instruments