tags 769264 +patch
thanks

Hi,

On Wed, Nov 12, 2014 at 11:45:28AM +0100, Lucas Nussbaum wrote:
> > ./fusebirth > fused_loop.c 2>/dev/null
> > make[1]: *** [fused_loop.c] Error 139
 
So what happens here is that fusebirth segfaults on i386 in topo_sort(),
while trying to sort whatever in order to generate fused_loop.c.

Tracing through topo_sort() with a debugger, it seems that after a dozen
or so recursions into it, get_children(node) returns an invalid (but not
NULL) pointer, and on the next iteration we get a segfault in it.

I stared at the code for a few hours, but it doesn't look like this is
how GLib is supposed to be used nowadays, so I went for an alternative
solution: I just included the auto-generated .c code into the source
package and changed the build system to not generate/delete that .c file.  

I made sure the generated source is the same on amd64 and s390x and will
test on a couple more architectures to make sure.

Proposed Debdiff attached.


Michael
diff -u freebirth-0.3.2/Makefile freebirth-0.3.2/Makefile
--- freebirth-0.3.2/Makefile
+++ freebirth-0.3.2/Makefile
@@ -19,14 +19,11 @@
 all: freebirth 
 
 clean: Makefile.deps
-       -rm -f *.o freebirth fusebirth fused_loop.c Makefile.deps *~ 
+       -rm -f *.o freebirth fusebirth Makefile.deps *~ 
 
 freebirth: $(OFILES) fused_loop.o freebirth.o
        $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
 
-fused_loop.c: fusebirth
-       ./fusebirth > fused_loop.c 2>/dev/null
-
 fusebirth: $(OFILES) fuse_loops.o fusebirth.o
        $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
 
diff -u freebirth-0.3.2/debian/changelog freebirth-0.3.2/debian/changelog
--- freebirth-0.3.2/debian/changelog
+++ freebirth-0.3.2/debian/changelog
@@ -1,3 +1,11 @@
+freebirth (0.3.2-9.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * fused_loop.c: Include auto-generated C-file (closes: #769264).
+  * Makefile: Do not generate or remove fused_loop.c.
+
+ -- Michael Banck <mba...@debian.org>  Sat, 22 Nov 2014 20:36:11 +0100
+
 freebirth (0.3.2-9) unstable; urgency=medium
 
   * debian/control: add homepage, thanks to Francisco Javier Garrote Cruz
only in patch2:
unchanged:
--- freebirth-0.3.2.orig/fused_loop.c
+++ freebirth-0.3.2/fused_loop.c
@@ -0,0 +1,597 @@
+/* generated file -- don't edit */
+#include <unistd.h>
+#include <math.h>
+#include <endian.h>
+#include "freebirth.h"
+/* borrowed from glib2 */
+#define SHORT_SWAP_LE_BE(val)  ((short) ( \
+    (short) ((short) (val) >> 8) |     \
+    (short) ((short) (val) << 8)))
+static void swap_endian(short *data, int length)
+{
+       int i;
+       for (i = 0; i < length; i += 1, data++)
+               *data = SHORT_SWAP_LE_BE(*data);
+}
+
+sample_producer *sp[31];
+
+int play_buffer(gpointer data, gint source, GdkInputCondition condition)
+{
+  int i;
+  short buffer[TBASS_BUFF_SIZE * 2];
+  
+  sample samp0;
+  sample samp1;
+  sample samp2;
+  sample samp3;
+  sample samp4;
+  sample samp5;
+  sample samp6;
+  sample samp7;
+  sample samp8;
+  sample samp9;
+  sample samp10;
+  sample samp11;
+  sample samp12;
+  sample samp13;
+  sample samp14;
+  sample samp15;
+  sample samp16;
+  sample samp17;
+  sample samp18;
+  sample samp19;
+  sample samp20;
+  sample samp21;
+  sample samp22;
+  sample samp23;
+  sample samp24;
+  sample samp25;
+  sample samp26;
+  sample samp27;
+  sample samp28;
+  sample samp29;
+  sample samp30;
+
+  int seq_off = sequencer->current_sample_offset;
+  int seq_spb = sequencer->spb;
+  event_list *el;
+  int j;
+
+  sample *n0_table = ((raw_wave *)sp[0])->table;
+  int n0_length = ((raw_wave *)sp[0])->length;
+  sample n0_s1, n0_s2;
+  double n0_ci_w, n0_ci_f, n0_pitch = ((raw_wave *)sp[0])->pitch;
+
+  sample *n1_table = ((raw_wave *)sp[1])->table;
+  int n1_length = ((raw_wave *)sp[1])->length;
+  sample n1_s1, n1_s2;
+  double n1_ci_w, n1_ci_f, n1_pitch = ((raw_wave *)sp[1])->pitch;
+
+  sample *n2_table = ((raw_wave *)sp[2])->table;
+  int n2_length = ((raw_wave *)sp[2])->length;
+  sample n2_s1, n2_s2;
+  double n2_ci_w, n2_ci_f, n2_pitch = ((raw_wave *)sp[2])->pitch;
+
+  sample *n3_table = ((raw_wave *)sp[3])->table;
+  int n3_length = ((raw_wave *)sp[3])->length;
+  sample n3_s1, n3_s2;
+  double n3_ci_w, n3_ci_f, n3_pitch = ((raw_wave *)sp[3])->pitch;
+
+  sample *n4_table = ((raw_wave *)sp[4])->table;
+  int n4_length = ((raw_wave *)sp[4])->length;
+  sample n4_s1, n4_s2;
+  double n4_ci_w, n4_ci_f, n4_pitch = ((raw_wave *)sp[4])->pitch;
+
+  int n5_phase_offset = ((osc *)sp[5])->phase_offset;
+  double n5_freq_offset = ((osc *)sp[5])->freq_offset;
+  int n5_freq = ((osc *)sp[5])->freq;
+  int n5_phase_factor = n5_phase_offset / n5_freq;
+  sample *n5_table = ((osc *)sp[5])->table;
+  int n5_i = ((osc *)sp[5])->current_index;
+
+  int n6_phase_offset = ((osc *)sp[6])->phase_offset;
+  double n6_freq_offset = ((osc *)sp[6])->freq_offset;
+  int n6_freq = ((osc *)sp[6])->freq;
+  int n6_phase_factor = n6_phase_offset / n6_freq;
+  sample *n6_table = ((osc *)sp[6])->table;
+  int n6_i = ((osc *)sp[6])->current_index;
+
+  int n7_phase_offset = ((osc *)sp[7])->phase_offset;
+  double n7_freq_offset = ((osc *)sp[7])->freq_offset;
+  int n7_freq = ((osc *)sp[7])->freq;
+  int n7_phase_factor = n7_phase_offset / n7_freq;
+  sample *n7_table = ((osc *)sp[7])->table;
+  int n7_i = ((osc *)sp[7])->current_index;
+
+  int n8_blend = ((blender *)sp[8])->blend_factor;
+  int n8_strength0 = ((blender *)sp[8])->strength[0];
+  int n8_strength1 = ((blender *)sp[8])->strength[1];
+  int n8_strength2 = ((blender *)sp[8])->strength[2];
+
+  int n9_attack = ((env *)sp[9])->attack;
+  int n9_release = ((env *)sp[9])->release;
+
+  int n10_fc = ((filter *)sp[10])->fc;
+  float n10_Q = ((filter *)sp[10])->Q;
+  float n10_s;
+
+  int n11_attack = ((env *)sp[11])->attack;
+  int n11_release = ((env *)sp[11])->release;
+
+  int n12_amp0 = ((mixer *)sp[12])->amplitude[0];
+  int n12_amp1 = ((mixer *)sp[12])->amplitude[1];
+  int n12_amp2 = ((mixer *)sp[12])->amplitude[2];
+  int n12_amp3 = ((mixer *)sp[12])->amplitude[3];
+  int n12_amp4 = ((mixer *)sp[12])->amplitude[4];
+  int n12_amp5 = ((mixer *)sp[12])->amplitude[5];
+  int n12_mute0 = ((mixer *)sp[12])->mute_map[0];
+  int n12_mute1 = ((mixer *)sp[12])->mute_map[1];
+  int n12_mute2 = ((mixer *)sp[12])->mute_map[2];
+  int n12_mute3 = ((mixer *)sp[12])->mute_map[3];
+  int n12_mute4 = ((mixer *)sp[12])->mute_map[4];
+  int n12_mute5 = ((mixer *)sp[12])->mute_map[5];
+
+  int n13_i = ((delay *)sp[13])->d_index;
+  int n13_size = ((delay *)sp[13])->delay_size;
+  int n13_feedback = ((delay *)sp[13])->feedback;
+  sample *n13_buf = ((delay *)sp[13])->delay_buffer;
+
+  int n14_i = ((delay *)sp[14])->d_index;
+  int n14_size = ((delay *)sp[14])->delay_size;
+  int n14_feedback = ((delay *)sp[14])->feedback;
+  sample *n14_buf = ((delay *)sp[14])->delay_buffer;
+
+  int n15_i = ((delay *)sp[15])->d_index;
+  int n15_size = ((delay *)sp[15])->delay_size;
+  int n15_feedback = ((delay *)sp[15])->feedback;
+  sample *n15_buf = ((delay *)sp[15])->delay_buffer;
+
+  int n16_amp0 = ((mixer *)sp[16])->amplitude[0];
+  int n16_amp1 = ((mixer *)sp[16])->amplitude[1];
+  int n16_amp2 = ((mixer *)sp[16])->amplitude[2];
+  int n16_mute0 = ((mixer *)sp[16])->mute_map[0];
+  int n16_mute1 = ((mixer *)sp[16])->mute_map[1];
+  int n16_mute2 = ((mixer *)sp[16])->mute_map[2];
+
+
+  int n18_amp0 = ((mixer *)sp[18])->amplitude[0];
+  int n18_amp1 = ((mixer *)sp[18])->amplitude[1];
+  int n18_amp2 = ((mixer *)sp[18])->amplitude[2];
+  int n18_amp3 = ((mixer *)sp[18])->amplitude[3];
+  int n18_amp4 = ((mixer *)sp[18])->amplitude[4];
+  int n18_amp5 = ((mixer *)sp[18])->amplitude[5];
+  int n18_mute0 = ((mixer *)sp[18])->mute_map[0];
+  int n18_mute1 = ((mixer *)sp[18])->mute_map[1];
+  int n18_mute2 = ((mixer *)sp[18])->mute_map[2];
+  int n18_mute3 = ((mixer *)sp[18])->mute_map[3];
+  int n18_mute4 = ((mixer *)sp[18])->mute_map[4];
+  int n18_mute5 = ((mixer *)sp[18])->mute_map[5];
+
+  int n19_i = ((delay *)sp[19])->d_index;
+  int n19_size = ((delay *)sp[19])->delay_size;
+  int n19_feedback = ((delay *)sp[19])->feedback;
+  sample *n19_buf = ((delay *)sp[19])->delay_buffer;
+
+  int n20_i = ((delay *)sp[20])->d_index;
+  int n20_size = ((delay *)sp[20])->delay_size;
+  int n20_feedback = ((delay *)sp[20])->feedback;
+  sample *n20_buf = ((delay *)sp[20])->delay_buffer;
+
+  int n21_i = ((delay *)sp[21])->d_index;
+  int n21_size = ((delay *)sp[21])->delay_size;
+  int n21_feedback = ((delay *)sp[21])->feedback;
+  sample *n21_buf = ((delay *)sp[21])->delay_buffer;
+
+  int n22_i = ((delay *)sp[22])->d_index;
+  int n22_size = ((delay *)sp[22])->delay_size;
+  int n22_feedback = ((delay *)sp[22])->feedback;
+  sample *n22_buf = ((delay *)sp[22])->delay_buffer;
+
+  int n23_i = ((delay *)sp[23])->d_index;
+  int n23_size = ((delay *)sp[23])->delay_size;
+  int n23_feedback = ((delay *)sp[23])->feedback;
+  sample *n23_buf = ((delay *)sp[23])->delay_buffer;
+
+  int n24_i = ((delay *)sp[24])->d_index;
+  int n24_size = ((delay *)sp[24])->delay_size;
+  int n24_feedback = ((delay *)sp[24])->feedback;
+  sample *n24_buf = ((delay *)sp[24])->delay_buffer;
+
+  int n25_amp0 = ((mixer *)sp[25])->amplitude[0];
+  int n25_amp1 = ((mixer *)sp[25])->amplitude[1];
+  int n25_amp2 = ((mixer *)sp[25])->amplitude[2];
+  int n25_amp3 = ((mixer *)sp[25])->amplitude[3];
+  int n25_amp4 = ((mixer *)sp[25])->amplitude[4];
+  int n25_amp5 = ((mixer *)sp[25])->amplitude[5];
+  int n25_mute0 = ((mixer *)sp[25])->mute_map[0];
+  int n25_mute1 = ((mixer *)sp[25])->mute_map[1];
+  int n25_mute2 = ((mixer *)sp[25])->mute_map[2];
+  int n25_mute3 = ((mixer *)sp[25])->mute_map[3];
+  int n25_mute4 = ((mixer *)sp[25])->mute_map[4];
+  int n25_mute5 = ((mixer *)sp[25])->mute_map[5];
+
+  int n26_i = ((all_pass *)sp[26])->d_index;
+  int n26_size = ((all_pass *)sp[26])->delay_size;
+  int n26_feedback = ((all_pass *)sp[26])->feedback;
+  sample *n26_buf = ((all_pass *)sp[26])->delay_buffer;
+
+  int n27_i = ((all_pass *)sp[27])->d_index;
+  int n27_size = ((all_pass *)sp[27])->delay_size;
+  int n27_feedback = ((all_pass *)sp[27])->feedback;
+  sample *n27_buf = ((all_pass *)sp[27])->delay_buffer;
+
+
+  int n29_amp0 = ((mixer *)sp[29])->amplitude[0];
+  int n29_amp1 = ((mixer *)sp[29])->amplitude[1];
+  int n29_amp2 = ((mixer *)sp[29])->amplitude[2];
+  int n29_amp3 = ((mixer *)sp[29])->amplitude[3];
+  int n29_amp4 = ((mixer *)sp[29])->amplitude[4];
+  int n29_amp5 = ((mixer *)sp[29])->amplitude[5];
+  int n29_amp6 = ((mixer *)sp[29])->amplitude[6];
+  int n29_amp7 = ((mixer *)sp[29])->amplitude[7];
+  int n29_mute0 = ((mixer *)sp[29])->mute_map[0];
+  int n29_mute1 = ((mixer *)sp[29])->mute_map[1];
+  int n29_mute2 = ((mixer *)sp[29])->mute_map[2];
+  int n29_mute3 = ((mixer *)sp[29])->mute_map[3];
+  int n29_mute4 = ((mixer *)sp[29])->mute_map[4];
+  int n29_mute5 = ((mixer *)sp[29])->mute_map[5];
+  int n29_mute6 = ((mixer *)sp[29])->mute_map[6];
+  int n29_mute7 = ((mixer *)sp[29])->mute_map[7];
+
+  int n30_amp0 = ((mixer *)sp[30])->amplitude[0];
+  int n30_amp1 = ((mixer *)sp[30])->amplitude[1];
+  int n30_amp2 = ((mixer *)sp[30])->amplitude[2];
+  int n30_amp3 = ((mixer *)sp[30])->amplitude[3];
+  int n30_amp4 = ((mixer *)sp[30])->amplitude[4];
+  int n30_amp5 = ((mixer *)sp[30])->amplitude[5];
+  int n30_amp6 = ((mixer *)sp[30])->amplitude[6];
+  int n30_amp7 = ((mixer *)sp[30])->amplitude[7];
+  int n30_mute0 = ((mixer *)sp[30])->mute_map[0];
+  int n30_mute1 = ((mixer *)sp[30])->mute_map[1];
+  int n30_mute2 = ((mixer *)sp[30])->mute_map[2];
+  int n30_mute3 = ((mixer *)sp[30])->mute_map[3];
+  int n30_mute4 = ((mixer *)sp[30])->mute_map[4];
+  int n30_mute5 = ((mixer *)sp[30])->mute_map[5];
+  int n30_mute6 = ((mixer *)sp[30])->mute_map[6];
+  int n30_mute7 = ((mixer *)sp[30])->mute_map[7];
+
+  for (i = 0; i < TBASS_BUFF_SIZE; i++) {
+    seq_off++;
+    if (seq_off >= seq_spb) {
+      sequencer->current_step++;
+      if (sequencer->current_step >= sequencer->length)
+        sequencer->current_step = 0;
+      sequencer->callback(sequencer->current_step);
+      seq_off -= seq_spb;
+      el = sequencer->event_map[sequencer->current_step];
+      for (j=0; j < el->length; j++) {
+        event *e = el->events[j];
+        e->fire(e, sequencer->victims[e->seq_handle]);
+      }
+    }
+
+    if (((raw_wave *)sp[0])->current_index >= n0_length)
+      samp0 = 0;
+    else {
+      n0_ci_f = modf(((raw_wave *)sp[0])->current_index, &n0_ci_w);
+      n0_s1 = n0_table[(int)n0_ci_w];
+      n0_s2 = n0_table[(int)n0_ci_w +1];
+      ((raw_wave *)sp[0])->current_index += n0_pitch;
+      samp0 = (n0_s2 - n0_s1) * n0_ci_f + n0_s1;
+    }
+
+    if (((raw_wave *)sp[1])->current_index >= n1_length)
+      samp1 = 0;
+    else {
+      n1_ci_f = modf(((raw_wave *)sp[1])->current_index, &n1_ci_w);
+      n1_s1 = n1_table[(int)n1_ci_w];
+      n1_s2 = n1_table[(int)n1_ci_w +1];
+      ((raw_wave *)sp[1])->current_index += n1_pitch;
+      samp1 = (n1_s2 - n1_s1) * n1_ci_f + n1_s1;
+    }
+
+    if (((raw_wave *)sp[2])->current_index >= n2_length)
+      samp2 = 0;
+    else {
+      n2_ci_f = modf(((raw_wave *)sp[2])->current_index, &n2_ci_w);
+      n2_s1 = n2_table[(int)n2_ci_w];
+      n2_s2 = n2_table[(int)n2_ci_w +1];
+      ((raw_wave *)sp[2])->current_index += n2_pitch;
+      samp2 = (n2_s2 - n2_s1) * n2_ci_f + n2_s1;
+    }
+
+    if (((raw_wave *)sp[3])->current_index >= n3_length)
+      samp3 = 0;
+    else {
+      n3_ci_f = modf(((raw_wave *)sp[3])->current_index, &n3_ci_w);
+      n3_s1 = n3_table[(int)n3_ci_w];
+      n3_s2 = n3_table[(int)n3_ci_w +1];
+      ((raw_wave *)sp[3])->current_index += n3_pitch;
+      samp3 = (n3_s2 - n3_s1) * n3_ci_f + n3_s1;
+    }
+
+    if (((raw_wave *)sp[4])->current_index >= n4_length)
+      samp4 = 0;
+    else {
+      n4_ci_f = modf(((raw_wave *)sp[4])->current_index, &n4_ci_w);
+      n4_s1 = n4_table[(int)n4_ci_w];
+      n4_s2 = n4_table[(int)n4_ci_w +1];
+      ((raw_wave *)sp[4])->current_index += n4_pitch;
+      samp4 = (n4_s2 - n4_s1) * n4_ci_f + n4_s1;
+    }
+
+    samp5 = n5_table[n5_i + n5_phase_factor];
+    n5_i += n5_freq + (n5_freq * n5_freq_offset) / MAX_FREQ_OFFSET;
+    if (n5_i + n5_phase_factor >= RATE)
+      n5_i = n5_i + n5_phase_factor - RATE;
+
+    samp6 = n6_table[n6_i + n6_phase_factor];
+    n6_i += n6_freq + (n6_freq * n6_freq_offset) / MAX_FREQ_OFFSET;
+    if (n6_i + n6_phase_factor >= RATE)
+      n6_i = n6_i + n6_phase_factor - RATE;
+
+    samp7 = n7_table[n7_i + n7_phase_factor];
+    n7_i += n7_freq + (n7_freq * n7_freq_offset) / MAX_FREQ_OFFSET;
+    if (n7_i + n7_phase_factor >= RATE)
+      n7_i = n7_i + n7_phase_factor - RATE;
+
+    samp8 = (samp5 * n8_strength0 / n8_blend) + (samp6 * n8_strength1 / 
n8_blend) + (samp7 * n8_strength2 / n8_blend);
+
+    if (((env *)sp[9])->current_index < n9_attack)
+      samp9 = (SAMPLE_MAX - ((env *)sp[9])->start)  * ((env 
*)sp[9])->current_index / n9_attack + ((env *)sp[9])->start;
+    else if (((env *)sp[9])->current_index < (n9_attack + n9_release))
+      samp9 = -SAMPLE_MAX * (((env *)sp[9])->current_index - n9_attack) / 
n9_release + SAMPLE_MAX;
+    else
+      samp9 = 0;
+    ((env *)sp[9])->current_index++;
+
+    filter_set_coeffs((filter *)sp[10], n10_fc *
+                      (samp9 * (SAMPLE_MAX - LIMIT) / SAMPLE_MAX + LIMIT) /
+                      SAMPLE_MAX, n10_Q);
+    n10_s = filter_process_sample((filter *)sp[10], samp8);
+    if (n10_s > SAMPLE_MAX) n10_s = SAMPLE_MAX;
+    else if (n10_s < SAMPLE_MIN) n10_s = SAMPLE_MIN;
+    samp10 = n10_s;
+
+    if (((env *)sp[11])->current_index < n11_attack)
+      samp11 = ((SAMPLE_MAX - ((env *)sp[11])->start)  * ((env 
*)sp[11])->current_index /
+           n11_attack + ((env *)sp[11])->start) * samp10 / SAMPLE_MAX;
+    else if (((env *)sp[11])->current_index < (n11_attack + n11_release))
+      samp11 = (-SAMPLE_MAX * (((env *)sp[11])->current_index - n11_attack) / 
n11_release + SAMPLE_MAX) *
+           samp10 / SAMPLE_MAX;
+    else
+      samp11 = 0;
+    ((env *)sp[11])->current_index++;
+
+    if(n12_mute0 > 0)
+        n12_amp0 = 0;
+if(n12_mute1 > 0)
+        n12_amp1 = 0;
+if(n12_mute2 > 0)
+        n12_amp2 = 0;
+if(n12_mute3 > 0)
+        n12_amp3 = 0;
+if(n12_mute4 > 0)
+        n12_amp4 = 0;
+if(n12_mute5 > 0)
+        n12_amp5 = 0;
+
+    samp12 = (samp0 * n12_amp0 / MIX_MAX_AMP) + (samp1 * n12_amp1 / 
MIX_MAX_AMP) + (samp2 * n12_amp2 / MIX_MAX_AMP) + (samp3 * n12_amp3 / 
MIX_MAX_AMP) + (samp4 * n12_amp4 / MIX_MAX_AMP) + (samp11 * n12_amp5 / 
MIX_MAX_AMP);
+
+    if (n13_i >= n13_size)
+      n13_i = 0;
+    samp13 = n13_buf[n13_i];
+    n13_buf[n13_i] = samp12 + n13_buf[n13_i] * n13_feedback / MAX_FEEDBACK;
+    n13_i++;
+
+    if (n14_i >= n14_size)
+      n14_i = 0;
+    samp14 = n14_buf[n14_i];
+    n14_buf[n14_i] = samp13 + n14_buf[n14_i] * n14_feedback / MAX_FEEDBACK;
+    n14_i++;
+
+    if (n15_i >= n15_size)
+      n15_i = 0;
+    samp15 = n15_buf[n15_i];
+    n15_buf[n15_i] = samp14 + n15_buf[n15_i] * n15_feedback / MAX_FEEDBACK;
+    n15_i++;
+
+    if(n16_mute0 > 0)
+        n16_amp0 = 0;
+if(n16_mute1 > 0)
+        n16_amp1 = 0;
+if(n16_mute2 > 0)
+        n16_amp2 = 0;
+
+    samp16 = (samp13 * n16_amp0 / MIX_MAX_AMP) + (samp14 * n16_amp1 / 
MIX_MAX_AMP) + (samp15 * n16_amp2 / MIX_MAX_AMP);
+
+    samp17 = samp16;
+
+    if(n18_mute0 > 0)
+        n18_amp0 = 0;
+if(n18_mute1 > 0)
+        n18_amp1 = 0;
+if(n18_mute2 > 0)
+        n18_amp2 = 0;
+if(n18_mute3 > 0)
+        n18_amp3 = 0;
+if(n18_mute4 > 0)
+        n18_amp4 = 0;
+if(n18_mute5 > 0)
+        n18_amp5 = 0;
+
+    samp18 = (samp0 * n18_amp0 / MIX_MAX_AMP) + (samp1 * n18_amp1 / 
MIX_MAX_AMP) + (samp2 * n18_amp2 / MIX_MAX_AMP) + (samp3 * n18_amp3 / 
MIX_MAX_AMP) + (samp4 * n18_amp4 / MIX_MAX_AMP) + (samp11 * n18_amp5 / 
MIX_MAX_AMP);
+
+    if (n19_i >= n19_size)
+      n19_i = 0;
+    samp19 = n19_buf[n19_i];
+    n19_buf[n19_i] = samp18 + n19_buf[n19_i] * n19_feedback / MAX_FEEDBACK;
+    n19_i++;
+
+    if (n20_i >= n20_size)
+      n20_i = 0;
+    samp20 = n20_buf[n20_i];
+    n20_buf[n20_i] = samp18 + n20_buf[n20_i] * n20_feedback / MAX_FEEDBACK;
+    n20_i++;
+
+    if (n21_i >= n21_size)
+      n21_i = 0;
+    samp21 = n21_buf[n21_i];
+    n21_buf[n21_i] = samp18 + n21_buf[n21_i] * n21_feedback / MAX_FEEDBACK;
+    n21_i++;
+
+    if (n22_i >= n22_size)
+      n22_i = 0;
+    samp22 = n22_buf[n22_i];
+    n22_buf[n22_i] = samp18 + n22_buf[n22_i] * n22_feedback / MAX_FEEDBACK;
+    n22_i++;
+
+    if (n23_i >= n23_size)
+      n23_i = 0;
+    samp23 = n23_buf[n23_i];
+    n23_buf[n23_i] = samp18 + n23_buf[n23_i] * n23_feedback / MAX_FEEDBACK;
+    n23_i++;
+
+    if (n24_i >= n24_size)
+      n24_i = 0;
+    samp24 = n24_buf[n24_i];
+    n24_buf[n24_i] = samp18 + n24_buf[n24_i] * n24_feedback / MAX_FEEDBACK;
+    n24_i++;
+
+    if(n25_mute0 > 0)
+        n25_amp0 = 0;
+if(n25_mute1 > 0)
+        n25_amp1 = 0;
+if(n25_mute2 > 0)
+        n25_amp2 = 0;
+if(n25_mute3 > 0)
+        n25_amp3 = 0;
+if(n25_mute4 > 0)
+        n25_amp4 = 0;
+if(n25_mute5 > 0)
+        n25_amp5 = 0;
+
+    samp25 = (samp19 * n25_amp0 / MIX_MAX_AMP) + (samp20 * n25_amp1 / 
MIX_MAX_AMP) + (samp21 * n25_amp2 / MIX_MAX_AMP) + (samp22 * n25_amp3 / 
MIX_MAX_AMP) + (samp23 * n25_amp4 / MIX_MAX_AMP) + (samp24 * n25_amp5 / 
MIX_MAX_AMP);
+
+    if (n26_i >= n26_size)
+      n26_i = 0;
+    samp26 = (long)n26_buf[n26_i] +
+         (samp25 * -n26_feedback / MAX_FEEDBACK);
+    n26_buf[n26_i] = samp25 + (long)n26_buf[n26_i] * n26_feedback / 
MAX_FEEDBACK;
+    n26_i++;
+
+    if (n27_i >= n27_size)
+      n27_i = 0;
+    samp27 = (long)n27_buf[n27_i] +
+         (samp26 * -n27_feedback / MAX_FEEDBACK);
+    n27_buf[n27_i] = samp26 + (long)n27_buf[n27_i] * n27_feedback / 
MAX_FEEDBACK;
+    n27_i++;
+
+    samp28 = samp27;
+
+    if(n29_mute0 > 0)
+        n29_amp0 = 0;
+if(n29_mute1 > 0)
+        n29_amp1 = 0;
+if(n29_mute2 > 0)
+        n29_amp2 = 0;
+if(n29_mute3 > 0)
+        n29_amp3 = 0;
+if(n29_mute4 > 0)
+        n29_amp4 = 0;
+if(n29_mute5 > 0)
+        n29_amp5 = 0;
+if(n29_mute6 > 0)
+        n29_amp6 = 0;
+if(n29_mute7 > 0)
+        n29_amp7 = 0;
+
+    samp29 = (samp0 * n29_amp0 / MIX_MAX_AMP) + (samp1 * n29_amp1 / 
MIX_MAX_AMP) + (samp2 * n29_amp2 / MIX_MAX_AMP) + (samp3 * n29_amp3 / 
MIX_MAX_AMP) + (samp4 * n29_amp4 / MIX_MAX_AMP) + (samp11 * n29_amp5 / 
MIX_MAX_AMP) + (samp17 * n29_amp6 / MIX_MAX_AMP) + (samp28 * n29_amp7 / 
MIX_MAX_AMP);
+
+    if(n30_mute0 > 0)
+        n30_amp0 = 0;
+if(n30_mute1 > 0)
+        n30_amp1 = 0;
+if(n30_mute2 > 0)
+        n30_amp2 = 0;
+if(n30_mute3 > 0)
+        n30_amp3 = 0;
+if(n30_mute4 > 0)
+        n30_amp4 = 0;
+if(n30_mute5 > 0)
+        n30_amp5 = 0;
+if(n30_mute6 > 0)
+        n30_amp6 = 0;
+if(n30_mute7 > 0)
+        n30_amp7 = 0;
+
+    samp30 = (samp0 * n30_amp0 / MIX_MAX_AMP) + (samp1 * n30_amp1 / 
MIX_MAX_AMP) + (samp2 * n30_amp2 / MIX_MAX_AMP) + (samp3 * n30_amp3 / 
MIX_MAX_AMP) + (samp4 * n30_amp4 / MIX_MAX_AMP) + (samp11 * n30_amp5 / 
MIX_MAX_AMP) + (samp17 * n30_amp6 / MIX_MAX_AMP) + (samp28 * n30_amp7 / 
MIX_MAX_AMP);
+    if ((samp29 < CLIP) && (samp29 >-CLIP))
+      buffer[2 * i] = (short)samp29;
+    else if (samp29 > 0)
+      buffer[2 * i] = (short)MIX_MAX_AMP-(CLIP_A/(CLIP_B+samp29));
+    else
+      buffer[2 * i] = (short)-(MIX_MAX_AMP-(CLIP_A/(CLIP_B-samp29)));
+    if ((samp30 < CLIP) && (samp30 >-CLIP))
+      buffer[2 * i + 1] = (short)samp30;
+    else if (samp30 > 0)
+      buffer[2 * i + 1] = (short)MIX_MAX_AMP-(CLIP_A/(CLIP_B+samp30));
+    else
+      buffer[2 * i + 1] = (short)-(MIX_MAX_AMP-(CLIP_A/(CLIP_B-samp30)));
+  }
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+  swap_endian(buffer, 2 * TBASS_BUFF_SIZE);
+#endif
+  write(fd, buffer, 2 * TBASS_BUFF_SIZE * sizeof(short));
+
+  sequencer->current_sample_offset = seq_off;
+
+
+
+
+
+
+  ((osc *)sp[5])->current_index = n5_i;
+
+  ((osc *)sp[6])->current_index = n6_i;
+
+  ((osc *)sp[7])->current_index = n7_i;
+
+
+
+
+
+
+  ((delay *)sp[13])->d_index = n13_i;
+
+  ((delay *)sp[14])->d_index = n14_i;
+
+  ((delay *)sp[15])->d_index = n15_i;
+
+
+
+
+  ((delay *)sp[19])->d_index = n19_i;
+
+  ((delay *)sp[20])->d_index = n20_i;
+
+  ((delay *)sp[21])->d_index = n21_i;
+
+  ((delay *)sp[22])->d_index = n22_i;
+
+  ((delay *)sp[23])->d_index = n23_i;
+
+  ((delay *)sp[24])->d_index = n24_i;
+
+
+  ((all_pass *)sp[26])->d_index = n26_i;
+
+  ((all_pass *)sp[27])->d_index = n27_i;
+
+
+
+
+  return 1;
+}

Reply via email to