Diff of /trunk/synth/synth.cpp [r79] .. [r80]  Maximize  Restore

Switch to side-by-side view

--- a/trunk/synth/synth.cpp
+++ b/trunk/synth/synth.cpp
@@ -264,7 +264,7 @@
         unsigned char *old = old_play_state;
         unsigned char *cur = play_state;
         // for speed, compare 4 voices at a time
-        while (voice < num_voices) {
+        while (voice < num_voices + EXTRA_VOICES) {
             if (*(int64_t *)old != *(int64_t *)cur) { // if at least one voice changed
                 for (int i = 0; i < 8; i += 2) { // check each voice in 8-byte range
                     if (*(short *)(old) != *(short *)(cur)) { // changed?
@@ -283,7 +283,7 @@
         }
     }
     memset(output_buffer, 0, sizeof(sample) * VL * 2); // stereo, interleaved
-    for (int v = 0; v < num_voices; v++) {
+    for (int v = 0; v < num_voices + EXTRA_VOICES; v++) {
         voice_type vptr = &(voices[v]);
         int chan = (v & 1); // alternate voices
         if (vptr->state == PLAY_STATE) {
@@ -395,7 +395,7 @@
 
 void note_on(int vi, int pitch, int velocity)
 {
-    if (vi < 0 || vi >= num_voices) return;
+    if (vi < 0 || vi >= num_voices + EXTRA_VOICES) return;
     voice_type v = &(voices[vi]);
     if (pitch < v->first_pitch || pitch >= v->first_pitch + v->num_pitches)
         return;
@@ -422,7 +422,7 @@
 
 void note_off(int vi)
 {
-    if (vi < 0 || vi >= num_voices) return;
+    if (vi < 0 || vi >= num_voices + EXTRA_VOICES) return;
     voice_type v = &(voices[vi]);
     if (v->state == PLAY_STATE) {
         v->gain_delta = v->gain / FADE_SAMPLES;

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks