def _coerce_pattern_pairs(self, patterns): import supriya.patterns patterns = dict(patterns) for name, pattern in sorted(patterns.items()): if not isinstance(pattern, supriya.patterns.Pattern): pattern = supriya.patterns.Pseq([pattern], None) patterns[name] = iter(pattern) return patterns
def __init__(self, synthdef=None, **patterns): import supriya.patterns import supriya.synthdefs assert isinstance( synthdef, (supriya.synthdefs.SynthDef, supriya.patterns.Pattern, type(None)) ) self._synthdef = synthdef self._patterns = tuple(sorted(patterns.items()))
def _coerce_pattern_pairs(self, patterns): import supriya.patterns patterns = dict(patterns) for name, pattern in sorted(patterns.items()): if not isinstance(pattern, supriya.patterns.Pattern): pattern = supriya.patterns.Pseq([pattern], None) patterns[name] = iter(pattern) return patterns
def __init__(self, synthdef=None, **patterns): import supriya.patterns import supriya.synthdefs assert isinstance( synthdef, (supriya.synthdefs.SynthDef, supriya.patterns.Pattern, type(None))) self._synthdef = synthdef self._patterns = tuple(sorted(patterns.items()))
def _iterate(self, state=None): patterns = self._coerce_pattern_pairs(self._patterns) while True: expr = {} for name, pattern in sorted(patterns.items()): try: expr[name] = next(pattern) except StopIteration: return expr = self._coerce_iterator_output(expr) should_stop = yield expr if should_stop: return
def _iterate(self, state=None): patterns = self._coerce_pattern_pairs(self._patterns) while True: expr = {} for name, pattern in sorted(patterns.items()): try: expr[name] = next(pattern) except StopIteration: return expr = self._coerce_iterator_output(expr) should_stop = yield expr if should_stop: return
def __init__(self, event_pattern=None, **patterns): import supriya.patterns assert isinstance(event_pattern, supriya.patterns.Pattern) self._event_pattern = event_pattern self._patterns = tuple(sorted(patterns.items()))
def __init__(self, event_pattern=None, **patterns): import supriya.patterns assert isinstance(event_pattern, supriya.patterns.Pattern) self._event_pattern = event_pattern self._patterns = tuple(sorted(patterns.items()))