# Path: nord/units.py
# def nm2g2val(nm1midival, nm1vals, g2vals):
# 
# Path: nord/g2/file.py
# NVARIATIONS = 9 # 1-8, init
# NMORPHS = 8     # 8 morphs
# NKNOBS = 120    # 120 knob settings
# NMORPHMAPS = 25 # max morphmaps per variation
# FX, VOICE, SETTINGS = 0, 1, 2
# class G2Error(Exception):
# class Section(object):
# class SectionManager(object):
# class Description(object):
# class PatchDescription(Section):
# class ModuleList(Section):
# class CurrentNote(Section):
# class CableList(Section):
# class SettingsArea(object):
# class ParameterModule(object):
# class Parameter(object):
# class Morph(object):
# class Settings(object):
# class Parameters(Section):
# class MorphParameters(Section):
# class KnobAssignments(Section):
# class CtrlAssignments(Section):
# class Labels(Section):
# class ModuleNames(Section):
# class TextPad(Section):
# class PerformanceDescription(Section):
# class GlobalKnobAssignments(KnobAssignments):
# class Pch2File(object):
# class Prf2File(Pch2File):
#   def __init__(self, value):
#   def __str__(self):
# def read_string(bitstream, l, pad=False):
# def format_string(s, l, pad=False):
# def write_string(bitstream, s, l, pad=False):
# def get_patch_area(patch, area):
#   def __init__(self, **kw):
#   def add(self, class_):
#   def get(self, type, default=None):
#   def parse_description(self, description, bitstream):
#   def format_description(self, description, bitstream):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def fixleds(self, module):
#   def parse_area(self, area, bitstream):
#   def format_area(self, area, bitstream):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def parse(self, patch, data):
#   def format(self, patch, data):
# def invalid_cable(smodule, sconn, direction, dmodule, dconn):
#   def parse_area(self, area, bitstream):
#   def format_area(self, area, bitstream):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def __init__(self):
#   def __init__(self, area, index):
#   def __init__(self, area, mod_index, index, default=0, name='', module=None):
#   def __init__(self, area, index):
#   def __init__(self):
#   def parse_settings(self, settings, bitstream):
#   def format_settings(self, settings, bitstream):
#   def parse_area(self, area, bitstream):
#   def format_area(self, area, bitstream):
#   def parse(self, patch, data):
#   def format(self, patch, data):
# def get_settings_param(patch, index, param):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#       def mod_param_index_cmp(a, b):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def parse_morphs(self, morphs, bitstream):
#   def format_morphs(self, morphs, bitstream):
#   def parse_module(self, module, bitstream):
#   def parse_area(self, area, bitstream):
#   def format_module(self, module, bitstream):
#   def format_area(self, area, bitstream):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def parse_area(self, area, bitstream):
#   def parse(self, patch, data):
#   def format_area(self, area, bitstream):
#   def format(self, patch, data):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def parse(self, performance, data):
#   def format(self, performance, data):
#   def __init__(self, filename=None):
#   def parse_section(self, section, patch_or_perf, memview):
#   def parse_patch(self, patch, memview):
#   def parse(self, memview):
#   def parse_header(self, memview, filename):
#   def read(self, filename):
#   def format_section(self, section, patch_or_perf, memview):
#   def format_patch(self, patch, memview):
#   def format(self, memview):
#   def format_file(self):
#   def write(self, filename=None):
#   def __init__(self, filename=None):
#   def parse(self, memview):
#   def format_performance(self, memview):
#   def format(self, memview):
# 
# Path: nord/g2/colors.py

# 
# Path: nord/convert/version.py

# 
# Path: nord/convert/dx7/dxtable.py



import logging
import os, sys, traceback
from optparse import OptionParser, make_option
from array import array
from nord import units
from nord.g2.file import Pch2File, crc
from nord.g2.colors import g2modulecolors
from nord.convert.version import version as g2oolsversion
from nord.convert.dx7 import dxtable
  from glob import glob
      return vert

    lines = ['Converted by',
           'g2ools-%s' % g2oolsversion,
           'by',
           'Matt Gerassimoff',
           'model by',
           'Sven Roehrig']
    vert = 0
    for module in dxconv.pch2.patch.voice.modules:
      if module.horiz != 0:
        continue
      v = module.vert + module.type.height
      #printf('%s %d %d %d\n', module.name, module.vert, module.type.height, v)
      if v > vert:
        vert = v
    vert = addnamebars(dxconv.pch2, lines, 0, vert+1)
    vert = addnamebars(dxconv.pch2, ['All rights', 'reserved'], 0, vert+1)


    dxconv.pch2.write(outname+'b%d.pch2' % bank)
    bank += 1

dx2g2_options = [
  make_option('-d', '--debug', action='store_true',
      dest='debug', default=False,
      help='Allow exceptions to terminate application'),
  make_option('-r', '--recursive', action='store_true',
      dest='recursive', default=False,
      help='On dir arguments, convert all .pch files'),

# Path: nord/units.py
# def nm2g2val(nm1midival, nm1vals, g2vals):
# 
# Path: nord/g2/file.py
# NVARIATIONS = 9 # 1-8, init
# NMORPHS = 8     # 8 morphs
# NKNOBS = 120    # 120 knob settings
# NMORPHMAPS = 25 # max morphmaps per variation
# FX, VOICE, SETTINGS = 0, 1, 2
# class G2Error(Exception):
# class Section(object):
# class SectionManager(object):
# class Description(object):
# class PatchDescription(Section):
# class ModuleList(Section):
# class CurrentNote(Section):
# class CableList(Section):
# class SettingsArea(object):
# class ParameterModule(object):
# class Parameter(object):
# class Morph(object):
# class Settings(object):
# class Parameters(Section):
# class MorphParameters(Section):
# class KnobAssignments(Section):
# class CtrlAssignments(Section):
# class Labels(Section):
# class ModuleNames(Section):
# class TextPad(Section):
# class PerformanceDescription(Section):
# class GlobalKnobAssignments(KnobAssignments):
# class Pch2File(object):
# class Prf2File(Pch2File):
#   def __init__(self, value):
#   def __str__(self):
# def read_string(bitstream, l, pad=False):
# def format_string(s, l, pad=False):
# def write_string(bitstream, s, l, pad=False):
# def get_patch_area(patch, area):
#   def __init__(self, **kw):
#   def add(self, class_):
#   def get(self, type, default=None):
#   def parse_description(self, description, bitstream):
#   def format_description(self, description, bitstream):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def fixleds(self, module):
#   def parse_area(self, area, bitstream):
#   def format_area(self, area, bitstream):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def parse(self, patch, data):
#   def format(self, patch, data):
# def invalid_cable(smodule, sconn, direction, dmodule, dconn):
#   def parse_area(self, area, bitstream):
#   def format_area(self, area, bitstream):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def __init__(self):
#   def __init__(self, area, index):
#   def __init__(self, area, mod_index, index, default=0, name='', module=None):
#   def __init__(self, area, index):
#   def __init__(self):
#   def parse_settings(self, settings, bitstream):
#   def format_settings(self, settings, bitstream):
#   def parse_area(self, area, bitstream):
#   def format_area(self, area, bitstream):
#   def parse(self, patch, data):
#   def format(self, patch, data):
# def get_settings_param(patch, index, param):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#       def mod_param_index_cmp(a, b):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def parse_morphs(self, morphs, bitstream):
#   def format_morphs(self, morphs, bitstream):
#   def parse_module(self, module, bitstream):
#   def parse_area(self, area, bitstream):
#   def format_module(self, module, bitstream):
#   def format_area(self, area, bitstream):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def parse_area(self, area, bitstream):
#   def parse(self, patch, data):
#   def format_area(self, area, bitstream):
#   def format(self, patch, data):
#   def parse(self, patch, data):
#   def format(self, patch, data):
#   def parse(self, performance, data):
#   def format(self, performance, data):
#   def __init__(self, filename=None):
#   def parse_section(self, section, patch_or_perf, memview):
#   def parse_patch(self, patch, memview):
#   def parse(self, memview):
#   def parse_header(self, memview, filename):
#   def read(self, filename):
#   def format_section(self, section, patch_or_perf, memview):
#   def format_patch(self, patch, memview):
#   def format(self, memview):
#   def format_file(self):
#   def write(self, filename=None):
#   def __init__(self, filename=None):
#   def parse(self, memview):
#   def format_performance(self, memview):
#   def format(self, memview):
# 
# Path: nord/g2/colors.py

# 
# Path: nord/convert/version.py

# 
# Path: nord/convert/dx7/dxtable.py



# Path: dx2g2.py
import logging
import os, sys, traceback
from optparse import OptionParser, make_option
from array import array
from nord import units
from nord.g2.file import Pch2File, crc
from nord.g2.colors import g2modulecolors
from nord.convert.version import version as g2oolsversion
from nord.convert.dx7 import dxtable
  from glob import glob

      return vert

    lines = ['Converted by',
           'g2ools-%s' % g2oolsversion,
           'by',
           'Matt Gerassimoff',
           'model by',
           'Sven Roehrig']
    vert = 0
    for module in dxconv.pch2.patch.voice.modules:
      if module.horiz != 0:
        continue
      v = module.vert + module.type.height
      #printf('%s %d %d %d\n', module.name, module.vert, module.type.height, v)
      if v > vert:
        vert = v
    vert = addnamebars(dxconv.pch2, lines, 0, vert+1)
    vert = addnamebars(dxconv.pch2, ['All rights', 'reserved'], 0, vert+1)


    dxconv.pch2.write(outname+'b%d.pch2' % bank)
    bank += 1

dx2g2_options = [
  make_option('-d', '--debug', action='store_true',
      dest='debug', default=False,
      help='Allow exceptions to terminate application'),
  make_option('-r', '--recursive', action='store_true',
      dest='recursive', default=False,
      help='On dir arguments, convert all .pch files'),

  make_option('-v', '--verbose', action='store',