def xoption(opt, args): """ Xtra, seldom used, options """ opt = opt.upper() if opt == 'NOCREDIT': gbl.noCredit = True return elif opt == 'CHORDS': # check a list of chords on the cmd line for validity if not args: MMA.options.usage() checkChords(args) sys.exit(0) # don't return ... all we can do is the chords elif opt == 'CHECKFILE': # check a input file for valid chords if len(args) != 1: error( "-xCheckFile: Exactly one filename required. Use '-xCheckFile <FILENAME>'." ) checkFile(args[0]) elif opt == "GROOVES": listGrooves(args) elif opt == "PRINT": from MMA.macro import macros for a in args: if a[0] == '$': # strip off option leading $ a = a[1:] a = a.upper() if a[0] == '_': # system var ex = macros.sysvar(a[1:]) else: error( "Only system variables (with a leading _) are defined, not %s." % a) print("$%s = %s" % (a, ex)) sys.exit(0) elif opt == "TSPLIT": if MMA.writeMid.splitOutput: warning("-xTSPLIT overwriting prior setting.") MMA.writeMid.splitOutput = 'TRACKS' elif opt == 'CSPLIT': if MMA.writeMid.splitOutput: warning("-xCSPLIT overwriting prior setting.") MMA.writeMid.splitOutput = 'CHANNELS' else: error("'%s' is an unknown -x option" % opt)
def trackSet(track, func): """ Print a debug message for functions which set a track setting. track - name of the track (Chord-Sus ... ) name - the name of the function (Strum, Compress ...) By using the macro formatting functions we get consistent output between debug and macro expansion. """ print("Set %s %s: %s" % (track, func, macros.sysvar("%s_%s" % (track, func.upper()))))
def trackSet(track, func): """ Print a debug message for functions which set a track setting. track - name of the track (Chord-Sus ... ) name - the name of the function (Strum, Compress ...) By using the macro formatting functions we get consistent output between debug and macro expansion. """ # Need to do this way to avoid circular import problem from MMA.macro import macros from MMA.common import dPrint dPrint("Set %s %s: %s" % (track, func, macros.sysvar("%s_%s" % (track, func.upper()))))
def printVars(): from MMA.macro import macros print(args) for a in args: if a[0] == '$': # strip off option leading $ a = a[1:] a = a.upper() if a[0] == '_': # system var ex = macros.sysvar(a[1:]) else: error( "Only system variables (with a leading _) are defined, not %s." % a) print("$%s = %s" % (a, ex)) sys.exit(0)
def getSysVar(name): return macros.sysvar(name)