summaryrefslogtreecommitdiff
path: root/apps/plugins/midi/synth.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/midi/synth.h')
-rw-r--r--apps/plugins/midi/synth.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/apps/plugins/midi/synth.h b/apps/plugins/midi/synth.h
index 223b5974e2..2b7187e819 100644
--- a/apps/plugins/midi/synth.h
+++ b/apps/plugins/midi/synth.h
@@ -25,7 +25,7 @@ static inline void synthSample(int * mixL, int * mixR)
25 int i; 25 int i;
26 register int dL=0; 26 register int dL=0;
27 register int dR=0; 27 register int dR=0;
28 register short sample = 0; 28 register int sample = 0;
29 register struct SynthObject *voicept=voices; 29 register struct SynthObject *voicept=voices;
30 30
31 for(i=MAX_VOICES/2; i > 0; i--) 31 for(i=MAX_VOICES/2; i > 0; i--)
@@ -33,15 +33,17 @@ static inline void synthSample(int * mixL, int * mixR)
33 if(voicept->isUsed==1) 33 if(voicept->isUsed==1)
34 { 34 {
35 sample = synthVoice(voicept); 35 sample = synthVoice(voicept);
36 dL += (sample*chPanLeft[voicept->ch])>>7; 36 dL += sample;
37 dR += (sample*chPanRight[voicept->ch])>>7; 37 sample *= chPan[voicept->ch];
38 dR += sample;
38 } 39 }
39 voicept++; 40 voicept++;
40 if(voicept->isUsed==1) 41 if(voicept->isUsed==1)
41 { 42 {
42 sample = synthVoice(voicept); 43 sample = synthVoice(voicept);
43 dL += (sample*chPanLeft[voicept->ch])>>7; 44 dL += sample;
44 dR += (sample*chPanRight[voicept->ch])>>7; 45 sample *= chPan[voicept->ch];
46 dR += sample;
45 } 47 }
46 voicept++; 48 voicept++;
47 } 49 }
@@ -51,19 +53,22 @@ static inline void synthSample(int * mixL, int * mixR)
51 if(voicept->isUsed==1) 53 if(voicept->isUsed==1)
52 { 54 {
53 sample = synthVoice(voicept); 55 sample = synthVoice(voicept);
54 dL += (sample*chPanLeft[voicept->ch])>>7; 56 dL += sample;
55 dR += (sample*chPanRight[voicept->ch])>>7; 57 sample *= chPan[voicept->ch];
58 dR += sample;
56 } 59 }
57 voicept++; 60 voicept++;
58 } 61 }
59 62
60 *mixL=dL; 63 dL = (dL << 7) - dR;
61 *mixR=dR; 64
65 *mixL=dL >> 7;
66 *mixR=dR >> 7;
62 67
63 /* TODO: Automatic Gain Control, anyone? */ 68 /* TODO: Automatic Gain Control, anyone? */
64 /* Or, should this be implemented on the DSP's output volume instead? */ 69 /* Or, should this be implemented on the DSP's output volume instead? */
65 70
66 return; /* No more ghetto lowpass filter.. linear intrpolation works well. */ 71 return; /* No more ghetto lowpass filter. Linear interpolation works well. */
67} 72}
68 73
69static inline struct Event * getEvent(struct Track * tr, int evNum) 74static inline struct Event * getEvent(struct Track * tr, int evNum)