# Path: modtools/utils.py
# def init():
#     utils.init()
# 
# def cleanup():
#     utils.cleanup()
# 
# def get_pedalboard_info(bundle):
#     info = utils.get_pedalboard_info(bundle.encode("utf-8"))
#     if not info:
#         raise Exception
#     return structToDict(info.contents)
# 
# def get_plugin_info(uri):
#     info = utils.get_plugin_info(uri.encode("utf-8"))
#     if not info:
#         raise Exception
#     return structToDict(info.contents)
# 
# def get_plugin_gui(uri):
#     info = utils.get_plugin_gui(uri.encode("utf-8"))
#     if not info:
#         raise Exception
#     return structToDict(info.contents)
# 
# def set_cpu_affinity(cpu):
#     utils.set_cpu_affinity(cpu)


import argparse
import base64
import json
import os
from enum import Enum
from PIL import Image
from modtools.utils import (
    init as lv2_init,
    cleanup as lv2_cleanup,
    get_pedalboard_info,
    get_plugin_info,
    get_plugin_gui,
    set_cpu_affinity,
)
        from aggdraw import Draw, Pen, Symbol
                    else:
                        in_ports[ix]['connected_img'] = midi_input_connected
                        in_ports[ix]['offset'] = (67, 9)
                        in_ports[ix]['type'] = 'midi'
            if not all('connector' in p for p in in_ports):
                raise Exception('Connector detection for input ports of plugin {0} failed'.format(p['uri']))

        if len(out_ports) > 0:
            audio_out_ix = len(data['ports']['audio']['output'])
            cv_out_ix = len(data['ports']['cv']['output']) + audio_out_ix
            for ix, conn in enumerate(chunks(columns['out_ports'], 2)):
                if ix < len(out_ports):
                    out_ports[ix]['connector'] = conn
                    if ix < audio_out_ix:
                        out_ports[ix]['connected_img'] = audio_output_connected
                        out_ports[ix]['offset'] = (8, 15)
                        out_ports[ix]['type'] = 'audio'
                    elif ix < cv_out_ix:
                        out_ports[ix]['connected_img'] = cv_output_connected
                        out_ports[ix]['offset'] = (11, 22)
                        out_ports[ix]['type'] = 'cv'
                    else:
                        out_ports[ix]['connected_img'] = midi_output_connected
                        out_ports[ix]['offset'] = (8, 9)
                        out_ports[ix]['type'] = 'midi'
            if not all('connector' in p for p in out_ports):
                raise Exception('Connector detection for output ports of plugin {0} failed'.format(p['uri']))

        plugin_map[p['instance']] = p


# Path: modtools/utils.py
# def init():
#     utils.init()
# 
# def cleanup():
#     utils.cleanup()
# 
# def get_pedalboard_info(bundle):
#     info = utils.get_pedalboard_info(bundle.encode("utf-8"))
#     if not info:
#         raise Exception
#     return structToDict(info.contents)
# 
# def get_plugin_info(uri):
#     info = utils.get_plugin_info(uri.encode("utf-8"))
#     if not info:
#         raise Exception
#     return structToDict(info.contents)
# 
# def get_plugin_gui(uri):
#     info = utils.get_plugin_gui(uri.encode("utf-8"))
#     if not info:
#         raise Exception
#     return structToDict(info.contents)
# 
# def set_cpu_affinity(cpu):
#     utils.set_cpu_affinity(cpu)


# Path: modtools/pedalboard.py
import argparse
import base64
import json
import os
from enum import Enum
from PIL import Image
from modtools.utils import (
    init as lv2_init,
    cleanup as lv2_cleanup,
    get_pedalboard_info,
    get_plugin_info,
    get_plugin_gui,
    set_cpu_affinity,
)
        from aggdraw import Draw, Pen, Symbol

                    else:
                        in_ports[ix]['connected_img'] = midi_input_connected
                        in_ports[ix]['offset'] = (67, 9)
                        in_ports[ix]['type'] = 'midi'
            if not all('connector' in p for p in in_ports):
                raise Exception('Connector detection for input ports of plugin {0} failed'.format(p['uri']))

        if len(out_ports) > 0:
            audio_out_ix = len(data['ports']['audio']['output'])
            cv_out_ix = len(data['ports']['cv']['output']) + audio_out_ix
            for ix, conn in enumerate(chunks(columns['out_ports'], 2)):
                if ix < len(out_ports):
                    out_ports[ix]['connector'] = conn
                    if ix < audio_out_ix:
                        out_ports[ix]['connected_img'] = audio_output_connected
                        out_ports[ix]['offset'] = (8, 15)
                        out_ports[ix]['type'] = 'audio'
                    elif ix < cv_out_ix:
                        out_ports[ix]['connected_img'] = cv_output_connected
                        out_ports[ix]['offset'] = (11, 22)
                        out_ports[ix]['type'] = 'cv'
                    else:
                        out_ports[ix]['connected_img'] = midi_output_connected
                        out_ports[ix]['offset'] = (8, 9)
                        out_ports[ix]['type'] = 'midi'
            if not all('connector' in p for p in out_ports):
                raise Exception('Connector detection for output ports of plugin {0} failed'.format(p['uri']))

        plugin_map[p['instance']] = p


    lv2_cleanup()