Browse Source

Added reverse, half, double speed. Currently they de-sync the loop

Pete Shadbolt 4 years ago
parent
commit
1daf7a8d33
2 changed files with 11 additions and 5 deletions
  1. 7
    1
      main.ck
  2. 4
    4
      main.py

+ 7
- 1
main.ck View File

@@ -65,6 +65,10 @@ while (true) {
65 65
             msg.getInt(0) => int i;
66 66
             pedals[i].setLoopPoint(globalLoopTime * msg.getFloat(1));
67 67
         }
68
+        else if(msg.address=="/direction"){
69
+            msg.getInt(0) => int i;
70
+            pedals[i].setDirection(msg.getFloat(1));
71
+        }
68 72
         else if(msg.address=="/arm") {
69 73
             msg.getInt(0) => int channel;
70 74
             (channel<0) => adcThruMute;
@@ -111,6 +115,9 @@ class LoopPedal
111 115
     public void setLoopPoint( dur length ) { 
112 116
         length => loopTime => sample.loopEnd => sample.loopEndRec; 
113 117
     }
118
+    public void setDirection( float direction ) { 
119
+        direction => sample.rate;
120
+    }
114 121
     public void setFeedback( float fb ) { fb => sample.feedback; }
115 122
     public void setGain( float gain ) { gain => sample.gain; }
116 123
     public void setPan( float pan ) { pan => dry.pan; }
@@ -139,7 +146,6 @@ class Metronome
139 146
     // A simple metronome
140 147
     SinOsc s => ADSR a;
141 148
     60 => s.freq;
142
-    0.5 => s.gain;
143 149
     0.6 => s.gain;
144 150
     a.set(0.001, .1, .5, .13);
145 151
     10::ms => dur plipTime;

+ 4
- 4
main.py View File

@@ -188,7 +188,7 @@ class Channel(wx.Panel):
188 188
         self.speed.SetValue(choices[0])
189 189
         sizer.Add(self.speed, 0, wx.ALL | wx.EXPAND, 3)
190 190
 
191
-        choices = ["Live →", "Live ←", "Live ↔", "Half speed"]
191
+        choices = ["Forward", "Back", "Half", "Double"]
192 192
         self.direction = wx.ComboBox(self, choices=choices, style=wx.CB_READONLY, size=(25, 25))
193 193
         self.direction.SetValue(choices[0])
194 194
         sizer.Add(self.direction, 0, wx.ALL | wx.EXPAND, 3)
@@ -199,7 +199,7 @@ class Channel(wx.Panel):
199 199
         self.pan.Bind(wx.EVT_SCROLL, self.update)
200 200
         self.fxsend.Bind(wx.EVT_SCROLL, self.update)
201 201
         self.speed.Bind(wx.EVT_COMBOBOX, self.update_multiplier)
202
-        self.direction.Bind(wx.EVT_TOGGLEBUTTON, self.update_direction)
202
+        self.direction.Bind(wx.EVT_COMBOBOX, self.update_direction)
203 203
         self.mute.Bind(wx.EVT_TOGGLEBUTTON, self.update)
204 204
         self.update()
205 205
 
@@ -217,9 +217,9 @@ class Channel(wx.Panel):
217 217
 
218 218
     def update_direction(self, evt=None):
219 219
         #multiplierTable = {"1 bar": 1., "2 bars": 2., "4 bars": 4., "Dephase": 1.3}
220
-        directionTable = {"Live →":0, "Live ←"1, "Live ↔"2, "Half speed"3}
220
+        directionTable = {"Forward":1., "Back":-1., "Half":.5, "Double":2.}
221 221
 
222
-        direction = directionTable[self.speed.GetValue()]
222
+        direction = directionTable[self.direction.GetValue()]
223 223
         sendOSCSafe("/direction", [self.index, direction])
224 224
 
225 225