summaryrefslogtreecommitdiff
path: root/audio/soundtracker/files/patch-app_tracer.c
blob: 8b137b3944618163e9ac7ba65015226cd01ac5c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- app/tracer.c.orig	2006-02-25 12:30:54 UTC
+++ app/tracer.c
@@ -361,15 +361,19 @@ static st_mixer mixer_tracer = {
 void 
 tracer_trace (int mixfreq, int songpos, int patpos)
 {
+    st_mixer *real_mixer;
+    int stopsongpos, stoppatpos;
+    double rest, previous;
+
     /* Attemp to take pitchband into account */
     /* Test if tempo and BPM are traced */
-    st_mixer *real_mixer = mixer;
+    real_mixer = mixer;
     mixer = &mixer_tracer;
 
-    int stopsongpos = songpos;
-    int stoppatpos = patpos;
+    stopsongpos = songpos;
+    stoppatpos = patpos;
 
-    double rest = 0, previous = 0; /* Fractional part of the samples */
+    rest = 0, previous = 0; /* Fractional part of the samples */
     
     if((stoppatpos -= 1) < 0){
 	stopsongpos -= 1;
@@ -381,12 +385,13 @@ tracer_trace (int mixfreq, int songpos, 
 
     while(1) {
 	double t;
+	guint32 samples;
 	
 	double current = xmplayer_play();
 	t = current - previous + rest;
 	previous = current;
 	
-	guint32 samples = t * mixfreq;
+	samples = t * mixfreq;
 	rest = t - (double)samples / (double)mixfreq;
 	
 	tracer_mix(NULL, samples, NULL, 0);