From 1daf7a8d33454f0ac4cf9b0c9306f2c10ba50639 Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Fri, 23 Jan 2015 20:07:32 +0000 Subject: [PATCH] Added reverse, half, double speed. Currently they de-sync the loop --- main.ck | 8 +++++++- main.py | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/main.ck b/main.ck index 04b7fcc..aa89077 100644 --- a/main.ck +++ b/main.ck @@ -65,6 +65,10 @@ while (true) { msg.getInt(0) => int i; pedals[i].setLoopPoint(globalLoopTime * msg.getFloat(1)); } + else if(msg.address=="/direction"){ + msg.getInt(0) => int i; + pedals[i].setDirection(msg.getFloat(1)); + } else if(msg.address=="/arm") { msg.getInt(0) => int channel; (channel<0) => adcThruMute; @@ -111,6 +115,9 @@ class LoopPedal public void setLoopPoint( dur length ) { length => loopTime => sample.loopEnd => sample.loopEndRec; } + public void setDirection( float direction ) { + direction => sample.rate; + } public void setFeedback( float fb ) { fb => sample.feedback; } public void setGain( float gain ) { gain => sample.gain; } public void setPan( float pan ) { pan => dry.pan; } @@ -139,7 +146,6 @@ class Metronome // A simple metronome SinOsc s => ADSR a; 60 => s.freq; - 0.5 => s.gain; 0.6 => s.gain; a.set(0.001, .1, .5, .13); 10::ms => dur plipTime; diff --git a/main.py b/main.py index aa0dea7..be698d4 100644 --- a/main.py +++ b/main.py @@ -188,7 +188,7 @@ class Channel(wx.Panel): self.speed.SetValue(choices[0]) sizer.Add(self.speed, 0, wx.ALL | wx.EXPAND, 3) - choices = ["Live →", "Live ←", "Live ↔", "Half speed"] + choices = ["Forward", "Back", "Half", "Double"] self.direction = wx.ComboBox(self, choices=choices, style=wx.CB_READONLY, size=(25, 25)) self.direction.SetValue(choices[0]) sizer.Add(self.direction, 0, wx.ALL | wx.EXPAND, 3) @@ -199,7 +199,7 @@ class Channel(wx.Panel): self.pan.Bind(wx.EVT_SCROLL, self.update) self.fxsend.Bind(wx.EVT_SCROLL, self.update) self.speed.Bind(wx.EVT_COMBOBOX, self.update_multiplier) - self.direction.Bind(wx.EVT_TOGGLEBUTTON, self.update_direction) + self.direction.Bind(wx.EVT_COMBOBOX, self.update_direction) self.mute.Bind(wx.EVT_TOGGLEBUTTON, self.update) self.update() @@ -217,9 +217,9 @@ class Channel(wx.Panel): def update_direction(self, evt=None): #multiplierTable = {"1 bar": 1., "2 bars": 2., "4 bars": 4., "Dephase": 1.3} - directionTable = {"Live →":0, "Live ←"1, "Live ↔"2, "Half speed"3} + directionTable = {"Forward":1., "Back":-1., "Half":.5, "Double":2.} - direction = directionTable[self.speed.GetValue()] + direction = directionTable[self.direction.GetValue()] sendOSCSafe("/direction", [self.index, direction])