def LFOtype(val=None): # value in LFOtypes try: if val != None: if isinstance(val, int): LFO.setType(val) else: LFO.setType(gv.getindex(val, LFO.effects, True)) return LFO.effect except: return 0
def do_POST(self): inval = 0 length = int(self.headers.getheader('content-length')) field_data = self.rfile.read(length) fields = parse_qs(field_data) #print fields if "SB_RenewMedia" in fields: if fields["SB_RenewMedia"][0] == "Yes": gv.basename = "None" self.LoadSamples() return if "SB_Preset" in fields: inval = gv.presetlist[int(fields["SB_Preset"][0])][0] if gv.PRESET != inval: gv.PRESET = inval self.LoadSamples() return if "SB_DefinitionTxt" in fields: if gv.DefinitionTxt != fields["SB_DefinitionTxt"][0]: gv.DefinitionTxt = fields["SB_DefinitionTxt"][0] #print gv.DefinitionTxt subprocess.call(['mount', '-vo', 'remount,rw', gv.samplesdir]) fname = gv.samplesdir + gv.presetlist[gv.getindex( gv.PRESET, gv.presetlist)][1] + "/" + gv.SAMPLESDEF with open(fname, 'w') as definitionfile: definitionfile.write(gv.DefinitionTxt) subprocess.call(['mount', '-vo', 'remount,ro', gv.samplesdir]) gv.basename = "None" # do a renew to sync the update self.LoadSamples() return if "SB_MidiChannel" in fields: gv.MIDI_CHANNEL = int(fields["SB_MidiChannel"][0]) if "SB_SoundVolume" in fields: gv.setvolume(int(fields["SB_SoundVolume"][0])) if "SB_MidiVolume" in fields: gv.volumeCC = float(fields["SB_MidiVolume"][0]) / 100 if "SB_Gain" in fields: gv.globalgain = float(fields["SB_Gain"][0]) / 100 if "SB_Pitchrange" in fields: gv.pitchnotes = int(fields["SB_Pitchrange"][0]) * 2 if "SB_Voice" in fields: if gv.voicelist[0][0] == 0: i = 1 else: i = 0 gv.MC[gv.getindex(gv.VOICES, gv.MC)][2](int(fields["SB_Voice"][0]) + i, 0) if "SB_Notemap" in fields: gv.MC[gv.getindex(gv.NOTEMAPS, gv.MC)][2](int(fields["SB_Notemap"][0])) if "SB_Scale" in fields: inval = int(fields["SB_Scale"][0]) if gv.currscale == inval: scalechange = False else: scalechange = True gv.currscale = inval if gv.last_musicnote < 0: gv.currchord = 0 else: gv.currchord = gv.scalechord[gv.currscale][ gv.last_musicnote] if "SB_Chord" in fields and not scalechange: inval = int(fields["SB_Chord"][0]) if not gv.currchord == inval: gv.currchord = inval gv.currscale = 0 if "SB_CHOrus" in fields: CHOrus.setType( gv.getindex(fields["SB_CHOrus"][0], ["Off", "On"], True)) if "SB_CHOdepth" in fields: CHOrus.setdepth((float(fields["SB_CHOdepth"][0]) - 2) * 9.77) if "SB_CHOgain" in fields: CHOrus.setgain((float(fields["SB_CHOgain"][0]) - 30) * 2.54) if "SB_FVtype" in fields: Cpp.FVsetType( gv.getindex(fields["SB_FVtype"][0], ["Off", "On"], True)) if "SB_FVroomsize" in fields: Cpp.FVsetroomsize(float(fields["SB_FVroomsize"][0]) * 1.27) if "SB_FVdamp" in fields: Cpp.FVsetdamp(float(fields["SB_FVdamp"][0]) * 1.27) if "SB_FVlevel" in fields: Cpp.FVsetlevel(float(fields["SB_FVlevel"][0]) * 1.27) if "SB_FVwidth" in fields: Cpp.FVsetwidth(float(fields["SB_FVwidth"][0]) * 1.27) if "SB_AWtype" in fields: Cpp.AWsetType(gv.getindex(fields["SB_AWtype"][0], gv.AWtypes, True)) if "SB_AWmixing" in fields: Cpp.AWsetMixing(float(fields["SB_AWmixing"][0]) * 1.27) if "SB_AWattack" in fields: Cpp.AWsetAttack(float(fields["SB_AWattack"][0]) * 0.254) if "SB_AWrelease" in fields: Cpp.AWsetRelease(float(fields["SB_AWrelease"][0]) * 0.254) if "SB_AWminfreq" in fields: Cpp.AWsetMinFreq(float(fields["SB_AWminfreq"][0]) * 0.254) if "SB_AWmaxfreq" in fields: Cpp.AWsetMaxFreq(float(fields["SB_AWmaxfreq"][0]) * 0.0127) if "SB_AWqfactor" in fields: Cpp.AWsetQualityFactor(float(fields["SB_AWqfactor"][0]) * 0.0508) if "SB_AWspeed" in fields: Cpp.AWsetSpeed((float(fields["SB_AWspeed"][0]) - 100) * 0.127) if "SB_AWlvlrange" in fields: Cpp.AWsetLVLrange(float(fields["SB_AWlvlrange"][0]) * 1.27) if "SB_DLYtype" in fields: Cpp.DLYsetType( gv.getindex(fields["SB_DLYtype"][0], gv.DLYtypes, True)) if "SB_DLYfb" in fields: Cpp.DLYsetfb(float(fields["SB_DLYfb"][0]) * 1.27) if "SB_DLYwet" in fields: Cpp.DLYsetwet(float(fields["SB_DLYwet"][0]) * 1.27) if "SB_DLYdry" in fields: Cpp.DLYsetdry(float(fields["SB_DLYdry"][0]) * 1.27) if "SB_DLYtime" in fields: Cpp.DLYsettime( (float(fields["SB_DLYtime"][0]) - 1000) / 600 * 1.27) if "SB_DLYsteep" in fields: Cpp.DLYsetsteep((float(fields["SB_DLYsteep"][0]) - 1) * 12.7) if "SB_DLYsteplen" in fields: Cpp.DLYsetsteplen( (float(fields["SB_DLYsteplen"][0]) - 300) / 30 * 1.27) if "SB_DLYmin" in fields: Cpp.DLYsetmin((float(fields["SB_DLYmin"][0]) - 5) * 5.36) if "SB_DLYmax" in fields: Cpp.DLYsetmax((float(fields["SB_DLYmax"][0]) - 50) * 1.27) if "SB_LFtype" in fields: Cpp.LFsetType( gv.getindex(fields["SB_LFtype"][0], ["Off", "On"], True)) if "SB_LFresonance" in fields: Cpp.LFsetResonance(float(fields["SB_LFresonance"][0]) / 38 * 127) if "SB_LFcutoff" in fields: Cpp.LFsetCutoff( (float(fields["SB_LFcutoff"][0]) - 1000) / 100 * 1.27) if "SB_LFdrive" in fields: Cpp.LFsetDrive( (float(fields["SB_LFdrive"][0]) - 1) * 6.35) # =/20.0*127) if "SB_LFlvl" in fields: Cpp.LFsetLvl((float(fields["SB_LFlvl"][0])) * 1.27) if "SB_LFgain" in fields: Cpp.LFsetGain((float(fields["SB_LFgain"][0]) - 10) * 1.27) if "SB_LFOtype" in fields: LFO.setType(gv.getindex(fields["SB_LFOtype"][0], gv.LFOtypes, True)) if "SB_VIBRpitch" in fields: gv.VIBRpitch = float(fields["SB_VIBRpitch"][0]) / 16 if "SB_VIBRspeed" in fields: LFO.VibrSetspeed(int(fields["SB_VIBRspeed"][0]) * 4) if "SB_VIBRtrill" in fields: if fields["SB_VIBRtrill"][0].title() == "On": gv.VIBRtrill = True else: gv.VIBRtrill = False if "SB_TREMampl" in fields: gv.TREMampl = float(fields["SB_TREMampl"][0]) / 100 if "SB_TREMspeed" in fields: LFO.TremSetspeed(int(fields["SB_TREMspeed"][0]) * 4) if "SB_TREMtrill" in fields: if fields["SB_TREMtrill"][0].title() == "On": gv.TREMtrill = True else: gv.TREMtrill = False if "SB_PANwidth" in fields: gv.PANwidth = float(fields["SB_PANwidth"][0]) / 20 if "SB_PANspeed" in fields: LFO.PanSetspeed(int(fields["SB_PANspeed"][0]) * 4) if "SB_ARPord" in fields: arp.ordnum(gv.getindex(fields["SB_ARPord"][0], gv.ARPtypes, True)) if "SB_ARPstep" in fields: arp.tempo(int(fields["SB_ARPstep"][0]) * 1.27) if "SB_ARPsustain" in fields: arp.sustain(int(fields["SB_ARPsustain"][0]) * 1.27) if "SB_ARPloop" in fields: if fields["SB_ARPloop"][0].title() == "On": arp.loop = True else: arp.loop = False if "SB_ARP2end" in fields: if fields["SB_ARP2end"][0].title() == "On": arp.play2end = True else: arp.play2end = False if "SB_ARPfade" in fields: arp.fadeout(1.27 * int(fields["SB_ARPfade"][0])) gv.display("") # show it on the box self.do_GET() # as well as on the gui