@@ -46,6 +46,7 @@ class ProbabilityDivider : public HemisphereApplet {
4646 loop_index = 0 ;
4747 loop_step = 0 ;
4848 skip_steps = 0 ;
49+ bypass_loop = false ;
4950 ForEachChannel (ch) {
5051 GateOut (ch, false );
5152 }
@@ -63,7 +64,7 @@ class ProbabilityDivider : public HemisphereApplet {
6364 // TODO: regenerate if changing from 0?
6465 }
6566
66- loop_linker.SetLooping (loop_length_mod > 0 );
67+ loop_linker.SetLooping (loop_length_mod > 0 && !bypass_loop );
6768
6869 // reset
6970 if (Clock (1 )) {
@@ -87,6 +88,12 @@ class ProbabilityDivider : public HemisphereApplet {
8788 reseed_high = false ;
8889 }
8990
91+ if (reseed < -(HEMISPHERE_MAX_CV >> 1 )) {
92+ bypass_loop = true ;
93+ } else {
94+ bypass_loop = false ;
95+ }
96+
9097 // reset loop
9198 if (loop_length_mod > 0 && loop_step >= loop_length_mod) {
9299 loop_step = 0 ;
@@ -107,10 +114,12 @@ class ProbabilityDivider : public HemisphereApplet {
107114 return ;
108115 }
109116
110- // get next weighted div or next div from loop
117+ // always advance the loop if looping is active
111118 if (loop_length_mod > 0 ) {
112119 skip_steps = GetNextLoopDiv ();
113- } else {
120+ }
121+ // get a random div if loop is not active or if loop is in bypass, this might replace the value above
122+ if (loop_length_mod == 0 || bypass_loop) {
114123 skip_steps = GetNextWeightedDiv ();
115124 }
116125
@@ -136,19 +145,11 @@ class ProbabilityDivider : public HemisphereApplet {
136145 }
137146
138147 void View () {
139- if (showDebug) {
140- DrawDebug ();
141- } else {
142- DrawInterface ();
143- }
148+ DrawInterface ();
144149 }
145150
146151 // void OnButtonPress() { }
147152
148- void AuxButton () {
149- showDebug = !showDebug;
150- }
151-
152153 void OnEncoderMove (int direction) {
153154 if (!EditMode ()) {
154155 MoveCursor (cursor, direction, LAST_SETTING );
@@ -230,8 +231,7 @@ class ProbabilityDivider : public HemisphereApplet {
230231 int loop_step;
231232 // used to keep track of reseed cv inputs so it only reseeds on rising edge
232233 bool reseed_high;
233-
234- bool showDebug = false ;
234+ bool bypass_loop;
235235
236236 int skip_steps;
237237 int pulse_animation = 0 ;
@@ -275,29 +275,6 @@ class ProbabilityDivider : public HemisphereApplet {
275275 }
276276 }
277277
278- void DrawDebug () {
279- int disp_seed = loop_linker.GetSeed (); // 0xABCD // test display accuracy
280- char sz[2 ];
281- sz[1 ] = 0 ; // Null terminated string for easy print
282- gfxPos (1 , 15 );
283- for (int i = 3 ; i >= 0 ; --i) {
284- // Grab each nibble in turn, starting with most significant
285- int nib = (disp_seed >> (i * 4 )) & 0xF ;
286- if (nib <= 9 ) {
287- gfxPrint (nib);
288- } else {
289- sz[0 ] = ' a' + nib - 10 ;
290- gfxPrint (static_cast <const char *>(sz));
291- }
292- }
293- for (int i = 0 ; i < 16 ; i++) {
294- int xOffset = (i % 4 ) * 12 ;
295- int yOffset = (i / 4 ) * 10 ;
296- gfxPrint (1 + xOffset, 25 + yOffset, loop[i]);
297- gfxPrint (" ," );
298- }
299- }
300-
301278 int GetNextWeightedDiv () {
302279 int total_weights = 0 ;
303280
0 commit comments