Пример #1
0
 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
Пример #2
0
    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()))
Пример #3
0
    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
Пример #4
0
    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()))
Пример #5
0
 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
Пример #6
0
 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
Пример #7
0
 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()))
Пример #8
0
    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()))