Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 4 commits
  • 4 files changed
  • 0 comments
  • 1 contributor
3  src/compiler/compiler.c
@@ -568,7 +568,8 @@ struct patch *patch_copy(struct patch *p)
568 568
 		pixbuf_inc_ref(img->pixbuf);
569 569
 	}
570 570
 	new_patch->stim = stim_get(p->stim);
571  
-	stim_redirect(p->stim, new_patch);
  571
+	if(p->stim)
  572
+		stim_redirect(p->stim, new_patch);
572 573
 	return new_patch;
573 574
 }
574 575
 
2  src/compiler/parser.y
@@ -315,7 +315,7 @@ assignment ::= ident(I) TOK_ASSIGN TOK_MIDI TOK_LPAREN expr(A) TOK_COMMA
315 315
 	sym->stim_regs = stim_add_midi_ctrl(stim,
316 316
 	    A->contents.constant, B->contents.constant, P);
317 317
 	if(!sym->stim_regs) {
318  
-		FAIL("cannot add stimulus for MIDI channel %d control %d\n",
  318
+		FAIL("cannot add stimulus for MIDI channel %d control %d",
319 319
 		    (int) A->contents.constant, (int) B->contents.constant);
320 320
 		return;
321 321
 	}
88  src/compiler/test/stim
... ...
@@ -0,0 +1,88 @@
  1
+#!/bin/sh
  2
+. ./Common
  3
+
  4
+###############################################################################
  5
+
  6
+ptest "stimuli: midi(0, 0)" -c -q << EOF
  7
+foo = midi(0, 0)
  8
+EOF
  9
+expect <<EOF
  10
+EOF
  11
+
  12
+#------------------------------------------------------------------------------
  13
+
  14
+ptest "stimuli: midi(15, 127)" -c -q << EOF
  15
+foo = midi(15, 127)
  16
+EOF
  17
+expect <<EOF
  18
+EOF
  19
+
  20
+#------------------------------------------------------------------------------
  21
+
  22
+ptest_fail "stimuli: midi(16, 0)" -c -q << EOF
  23
+foo = midi(16, 0)
  24
+EOF
  25
+expect <<EOF
  26
+line 2: cannot add stimulus for MIDI channel 16 control 0 near 'EOF'
  27
+EOF
  28
+
  29
+#------------------------------------------------------------------------------
  30
+
  31
+ptest_fail "stimuli: midi(0, 128)" -c -q << EOF
  32
+foo = midi(0, 128)
  33
+EOF
  34
+expect <<EOF
  35
+line 2: cannot add stimulus for MIDI channel 0 control 128 near 'EOF'
  36
+EOF
  37
+
  38
+#------------------------------------------------------------------------------
  39
+
  40
+ptest_fail "stimuli: midi(-1, 0)" -c -q << EOF
  41
+foo = midi(-1, 0)
  42
+EOF
  43
+expect <<EOF
  44
+line 2: cannot add stimulus for MIDI channel -1 control 0 near 'EOF'
  45
+EOF
  46
+
  47
+#------------------------------------------------------------------------------
  48
+
  49
+ptest_fail "stimuli: midi(0, -1)" -c -q << EOF
  50
+foo = midi(0, -1)
  51
+EOF
  52
+expect <<EOF
  53
+line 2: cannot add stimulus for MIDI channel 0 control -1 near 'EOF'
  54
+EOF
  55
+
  56
+#------------------------------------------------------------------------------
  57
+
  58
+ptest "stimuli: midi(0, 0, linear)" -c -q << EOF
  59
+foo = midi(0, 0, linear)
  60
+EOF
  61
+expect <<EOF
  62
+EOF
  63
+
  64
+#------------------------------------------------------------------------------
  65
+
  66
+ptest "stimuli: midi(0, 0, accel_linear)" -c -q << EOF
  67
+foo = midi(0, 0, accel_linear)
  68
+EOF
  69
+expect <<EOF
  70
+EOF
  71
+
  72
+#------------------------------------------------------------------------------
  73
+
  74
+ptest "stimuli: midi(0, 0, accel_unbounded)" -c -q << EOF
  75
+foo = midi(0, 0, accel_unbounded)
  76
+EOF
  77
+expect <<EOF
  78
+EOF
  79
+
  80
+#------------------------------------------------------------------------------
  81
+
  82
+ptest "stimuli: midi(0, 0, accel_cyclic)" -c -q << EOF
  83
+foo = midi(0, 0, accel_cyclic)
  84
+EOF
  85
+expect <<EOF
  86
+EOF
  87
+
  88
+###############################################################################
2  src/renderer/stimuli.c
@@ -8,9 +8,9 @@
8 8
  * the Free Software Foundation, version 3 of the License.
9 9
  */
10 10
 
  11
+#include <stddef.h>
11 12
 #include <stdlib.h>
12 13
 #include <string.h>
13  
-#include <sys/types.h>
14 14
 
15 15
 #include "stimuli.h"
16 16
 

No commit comments for this range

Something went wrong with that request. Please try again.