Sfoglia il codice sorgente

Trying out autopep8

master
Pete Shadbolt 10 anni fa
parent
commit
83bf40d039
2 ha cambiato i file con 13 aggiunte e 35 eliminazioni
  1. +0
    -24
      main.ck
  2. +13
    -11
      main.py

+ 0
- 24
main.ck Vedi File

@@ -131,30 +131,6 @@ public class LoopPedal
//spork ~plip();
//spork ~vu_meter();

fun void vu_meter()
{
// Analysis stuff
adc => FFT fft =^ RMS rms => blackhole;
1<<12 => int fftsize;
fftsize => fft.size;
Windowing.hann(fftsize) => fft.window;

// Comms
OscOut xmit; xmit.dest( "localhost", 6649 );

// Infinite loop: get RMS and send to GUI
while(true)
{
rms.upchuck() @=> UAnaBlob blob;
xmit.start("/vu");
blob.fval(0) => xmit.add;
xmit.send();
fft.size()::samp => now;
}
}



// TODO timing here should be done using events
fun void metronome()
{


+ 13
- 11
main.py Vedi File

@@ -1,4 +1,3 @@
from libs.simpleosc import *
import wx

#TODO: standardize methods for adding/removing arrays of widgets
@@ -11,18 +10,25 @@ def sendOSCSafe(channel, data):
print "OSC comms error"

class OSCSlider(wx.Panel):
''' A GUI slider '''
def __init__(self, parent, label, min_value=0, max_value=1, default_value=0, align=True):
''' Constructor '''
""" A GUI slider """
def __init__(self, parent, label, min_value=0, max_value=1, default_value=0, align=True, rescale=100.):
""" Constructor """
self.rescale=rescale
wx.Panel.__init__(self, parent)
sizer=wx.BoxSizer(wx.HORIZONTAL)
label=wx.StaticText(self, label=label, size=(100,15) if align else None)
label=wx.StaticText(self, label=label, \
size=(100,15) if align else None)
sizer.Add(label, 0, wx.RIGHT, 10)
self.slider=wx.Slider(self, value=default_value*100, minValue=min_value*100, maxValue=max_value*100)
self.slider=wx.Slider(self, value=default_value*self.rescale, \
minValue=min_value*self.rescale, maxValue=max_value*self.rescale)
sizer.Add(self.slider, 1, wx.EXPAND)

self.SetSizerAndFit(sizer)
self.Bind=self.slider.Bind
self.GetValue=self.slider.GetValue

def GetValue(self):
""" Make sure that we rescale """
return self.slider.GetValue()/self.rescale

class CommsPanel(wx.Panel):
""" OSC comms """
@@ -283,10 +289,6 @@ class MainGUI(wx.Frame):

def run(self): self.app.MainLoop()

def update_vu(self, a,b,c,d):
level=int(1000000*c[0])
self.output.gauge.SetValue(level)

def build(self):
""" Builds the various pieces of the GUI """
wx.Frame.__init__(self, None, title="DELAY LORD")


Loading…
Annulla
Salva