Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 8 files changed
  • 0 comments
  • 1 contributor
Jan 12, 2012
Werner Almesberger compiler: off-by-one error in forall_syms
test/wundef found this, but only sometimes.
5a386a3
Werner Almesberger added FN variable "frame" 5163408
2  src/compiler/compiler.h
@@ -77,6 +77,7 @@ enum {
77 77
 	pfv_tex_wrap,
78 78
 
79 79
 	pfv_time,
  80
+	pfv_frame,
80 81
 	pfv_bass,
81 82
 	pfv_mid,
82 83
 	pfv_treb,
@@ -164,6 +165,7 @@ enum {
164 165
 	pvv_zoom,
165 166
 
166 167
 	pvv_time,
  168
+	pvv_frame,
167 169
 	pvv_bass,
168 170
 	pvv_mid,
169 171
 	pvv_treb,
1  src/compiler/fnp.ids
@@ -60,6 +60,7 @@ mv_a		pfv_mv_a	-1
60 60
 bTexWrap	pfv_tex_wrap	-1
61 61
 
62 62
 time		pfv_time	pvv_time
  63
+frame		pfv_frame	pvv_frame
63 64
 bass		pfv_bass	pvv_bass
64 65
 mid		pfv_mid		pvv_mid
65 66
 treb		pfv_treb	pvv_treb
2  src/compiler/symtab.h
@@ -34,7 +34,7 @@ extern int num_user_syms;
34 34
 
35 35
 #define	forall_syms(p) \
36 36
 	for ((p) = well_known; (p) != user_syms+num_user_syms; \
37  
-	    (p) = (p) == well_known+num_well_known ? user_syms : (p)+1)
  37
+	    (p) = (p) == well_known+num_well_known-1 ? user_syms : (p)+1)
38 38
 
39 39
 void symtab_init(void);
40 40
 struct sym *unique(const char *s);
2  src/compiler/test/nsyms
@@ -26,7 +26,7 @@ forall_patches count_syms
26 26
 echo $max,$ns/$np >_out
27 27
 
28 28
 expect <<EOF
29  
-12,112/60
  29
+12,111/60
30 30
 EOF
31 31
 
32 32
 ###############################################################################
4  src/gui/monitor.c
@@ -31,7 +31,7 @@ static int appid;
31 31
 
32 32
 static int w_open;
33 33
 
34  
-static float time2;
  34
+static float time2, frame;
35 35
 static float bass, mid, treb;
36 36
 static float bass_att, mid_att, treb_att;
37 37
 static float idmx[IDMX_COUNT];
@@ -43,6 +43,7 @@ static void sampler_callback(struct frame_descriptor *frd)
43 43
 	int i;
44 44
 	
45 45
 	time2 = frd->time;
  46
+	frame = frd->frame;
46 47
 
47 48
 	bass = frd->bass;
48 49
 	mid = frd->mid;
@@ -64,6 +65,7 @@ static void sampler_callback(struct frame_descriptor *frd)
64 65
 static float *get_variable(const char *name)
65 66
 {
66 67
 	if(strcmp(name, "time") == 0) return &time2;
  68
+	if(strcmp(name, "frame") == 0) return &frame;
67 69
 
68 70
 	else if(strcmp(name, "bass") == 0) return &bass;
69 71
 	else if(strcmp(name, "mid") == 0) return &mid;
2  src/renderer/eval.c
@@ -72,6 +72,7 @@ static void transfer_pvv_regs(struct patch *p)
72 72
 	write_pvv(p, pvv_zoom, read_pfv(p, pfv_zoom));
73 73
 
74 74
 	write_pvv(p, pvv_time, read_pfv(p, pfv_time));
  75
+	write_pvv(p, pvv_frame, read_pfv(p, pfv_frame));
75 76
 	write_pvv(p, pvv_bass, read_pfv(p, pfv_bass));
76 77
 	write_pvv(p, pvv_mid, read_pfv(p, pfv_mid));
77 78
 	write_pvv(p, pvv_treb, read_pfv(p, pfv_treb));
@@ -135,6 +136,7 @@ static void reinit_all_pfv(struct patch *p)
135 136
 static void set_pfv_from_frd(struct patch *p, struct frame_descriptor *frd)
136 137
 {
137 138
 	write_pfv(p, pfv_time, frd->time);
  139
+	write_pfv(p, pfv_time, frd->frame);
138 140
 	write_pfv(p, pfv_bass, frd->bass);
139 141
 	write_pfv(p, pfv_mid, frd->mid);
140 142
 	write_pfv(p, pfv_treb, frd->treb);
1  src/renderer/framedescriptor.h
@@ -49,6 +49,7 @@ struct frame_descriptor {
49 49
 	int status;
50 50
 
51 51
 	float time;
  52
+	float frame;
52 53
 	struct snd_buffer *snd_buf;
53 54
 	float bass, mid, treb;
54 55
 	float bass_att, mid_att, treb_att;
5  src/renderer/sampler.c
@@ -104,6 +104,7 @@ static rtems_task sampler_task(rtems_task_argument argument)
104 104
 	frd_callback callback = (frd_callback)argument;
105 105
 	rtems_event_set dummy;
106 106
 	float time;
  107
+	int frame;
107 108
 
108 109
 	snd_fd = open("/dev/snd", O_RDWR);
109 110
 	if(snd_fd == -1) {
@@ -128,7 +129,8 @@ static rtems_task sampler_task(rtems_task_argument argument)
128 129
 		}
129 130
 	}
130 131
 
131  
-	time = 0.0;
  132
+	time = 0;
  133
+	frame = 0;
132 134
 
133 135
 	while(rtems_event_receive(RTEMS_EVENT_0, RTEMS_NO_WAIT, RTEMS_NO_TIMEOUT, &dummy) != RTEMS_SUCCESSFUL) {
134 136
 		struct snd_buffer *recorded_buf;
@@ -188,6 +190,7 @@ static rtems_task sampler_task(rtems_task_argument argument)
188 190
 		recorded_descriptor = (struct frame_descriptor *)recorded_buf->user;
189 191
 		/* Analyze */
190 192
 		analyze_snd(recorded_descriptor, &history);
  193
+		recorded_descriptor->frame = frame++;
191 194
 		recorded_descriptor->time = time;
192 195
 		time += 1.0/FPS;
193 196
 		/* Get DMX/OSC/MIDI inputs */

No commit comments for this range

Something went wrong with that request. Please try again.