コード例 #1
0
 def _initialize_topological_sort(ugens):
     ugens = list(ugens)
     sort_bundles = collections.OrderedDict()
     width_first_antecedents = []
     for ugen in ugens:
         sort_bundles[ugen] = UGenSortBundle(ugen, width_first_antecedents)
         if isinstance(ugen, WidthFirstUGen):
             width_first_antecedents.append(ugen)
     for ugen in ugens:
         sort_bundle = sort_bundles[ugen]
         sort_bundle._initialize_topological_sort(sort_bundles)
         sort_bundle.descendants[:] = sorted(
             sort_bundles[ugen].descendants,
             key=lambda x: ugens.index(ugen))
     return sort_bundles
コード例 #2
0
ファイル: SynthDef.py プロジェクト: tchiwinpiti/supriya
 def _cleanup_pv_chains(ugens):
     import supriya.ugens
     input_mapping = SynthDef._build_input_mapping(ugens)
     for antecedent, descendants in input_mapping.items():
         if len(descendants) == 1:
             continue
         for descendant, input_index in descendants[:-1]:
             fft_size = antecedent.fft_size
             new_buffer = supriya.ugens.LocalBuf(fft_size)
             pv_copy = supriya.ugens.PV_Copy(antecedent, new_buffer)
             inputs = list(descendant._inputs)
             inputs[input_index] = pv_copy[0]
             descendant._inputs = tuple(inputs)
             index = ugens.index(descendant)
             ugens[index:index] = [fft_size, new_buffer, pv_copy]
     return ugens
コード例 #3
0
    def _initialize_topological_sort(ugens):
        import supriya.synthdefs
        import supriya.ugens

        ugens = list(ugens)
        sort_bundles = collections.OrderedDict()
        width_first_antecedents = []
        for ugen in ugens:
            sort_bundles[ugen] = supriya.synthdefs.UGenSortBundle(
                ugen, width_first_antecedents
            )
            if isinstance(ugen, supriya.ugens.WidthFirstUGen):
                width_first_antecedents.append(ugen)
        for ugen in ugens:
            sort_bundle = sort_bundles[ugen]
            sort_bundle._initialize_topological_sort(sort_bundles)
            sort_bundle.descendants[:] = sorted(
                sort_bundles[ugen].descendants, key=lambda x: ugens.index(ugen)
            )
        return sort_bundles
コード例 #4
0
ファイル: SynthDef.py プロジェクト: ocaml-pirates/supriya
    def _cleanup_pv_chains(ugens):
        import supriya.ugens

        input_mapping = SynthDef._build_input_mapping(ugens)
        for antecedent, descendants in input_mapping.items():
            if len(descendants) == 1:
                continue
            for descendant, input_index in descendants[:-1]:
                fft_size = antecedent.fft_size
                new_buffer = supriya.ugens.LocalBuf(fft_size)
                pv_copy = supriya.ugens.PV_Copy(antecedent, new_buffer)
                inputs = list(descendant._inputs)
                inputs[input_index] = pv_copy[0]
                descendant._inputs = tuple(inputs)
                index = ugens.index(descendant)
                replacement = []
                if isinstance(fft_size, supriya.synthdefs.UGenMethodMixin):
                    replacement.append(fft_size)
                replacement.extend([new_buffer, pv_copy])
                ugens[index:index] = replacement
        return ugens
コード例 #5
0
    def _cleanup_pv_chains(ugens):
        import supriya.ugens

        input_mapping = SynthDef._build_input_mapping(ugens)
        for antecedent, descendants in input_mapping.items():
            if len(descendants) == 1:
                continue
            for descendant, input_index in descendants[:-1]:
                fft_size = antecedent.fft_size
                new_buffer = supriya.ugens.LocalBuf(fft_size)
                pv_copy = supriya.ugens.PV_Copy(antecedent, new_buffer)
                inputs = list(descendant._inputs)
                inputs[input_index] = pv_copy[0]
                descendant._inputs = tuple(inputs)
                index = ugens.index(descendant)
                replacement = []
                if isinstance(fft_size, supriya.synthdefs.UGenMethodMixin):
                    replacement.append(fft_size)
                replacement.extend([new_buffer, pv_copy])
                ugens[index:index] = replacement
        return ugens