File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 77#endif
88
99#define PRECISION 0
10- #define OSCRELOADVAL (0x3FF << PRECISION)
10+ #define OSCRELOADVAL (0x400 << PRECISION)
1111#define AMP (X ) ((unsigned int )(17 .0f * pow (double (X), 1.5f)))
1212
1313unsigned int TED::masterVolume;
@@ -248,12 +248,20 @@ void TED::renderSound(unsigned int nrsamples, short *buffer)
248248 oscCount[0 ] = OscReload[0 ] + (oscCount[0 ] - OSCRELOADVAL);
249249 }
250250 // Channel 2
251+ static bool channelOverFlow = false ;
251252 if (dcOutput[1 ]) {
252253 FlipFlop[1 ] = 1 ;
253- } else if ((oscCount[1 ] += oscStep) >= OSCRELOADVAL) {
254- NoiseCounter = (NoiseCounter + 1 ) % 255 ;
255- FlipFlop[1 ] ^= 1 ;
256- oscCount[1 ] = OscReload[1 ] + (oscCount[1 ] - OSCRELOADVAL);
254+ }
255+ else {
256+ if (channelOverFlow)
257+ NoiseCounter = (NoiseCounter + 1 ) % 255 ;
258+ if ((oscCount[1 ] += oscStep) >= OSCRELOADVAL) {
259+ channelOverFlow = true ;
260+ FlipFlop[1 ] ^= 1 ;
261+ oscCount[1 ] = OscReload[1 ] + (oscCount[1 ] - OSCRELOADVAL);
262+ }
263+ else
264+ channelOverFlow = false ;
257265 }
258266 int s1on = (Snd1Status && FlipFlop[0 ]);
259267 int s2on = (Snd2Status && FlipFlop[1 ]);
You can’t perform that action at this time.
0 commit comments