diff options
Diffstat (limited to 'apps/plugins/midi')
-rw-r--r-- | apps/plugins/midi/midiutil.c | 3 | ||||
-rw-r--r-- | apps/plugins/midi/midiutil.h | 3 | ||||
-rw-r--r-- | apps/plugins/midi/sequencer.c | 11 | ||||
-rw-r--r-- | apps/plugins/midi/synth.c | 5 | ||||
-rw-r--r-- | apps/plugins/midi/synth.h | 25 |
5 files changed, 20 insertions, 27 deletions
diff --git a/apps/plugins/midi/midiutil.c b/apps/plugins/midi/midiutil.c index 7cb128fb84..aba56c5a8c 100644 --- a/apps/plugins/midi/midiutil.c +++ b/apps/plugins/midi/midiutil.c | |||
@@ -22,8 +22,7 @@ | |||
22 | extern struct plugin_api * rb; | 22 | extern struct plugin_api * rb; |
23 | 23 | ||
24 | int chVol[16] IBSS_ATTR; /* Channel volume */ | 24 | int chVol[16] IBSS_ATTR; /* Channel volume */ |
25 | int chPanLeft[16] IBSS_ATTR; /* Channel panning */ | 25 | int chPan[16] IBSS_ATTR; /* Channel panning */ |
26 | int chPanRight[16] IBSS_ATTR; | ||
27 | int chPat[16] IBSS_ATTR; /* Channel patch */ | 26 | int chPat[16] IBSS_ATTR; /* Channel patch */ |
28 | int chPW[16] IBSS_ATTR; /* Channel pitch wheel, MSB only */ | 27 | int chPW[16] IBSS_ATTR; /* Channel pitch wheel, MSB only */ |
29 | 28 | ||
diff --git a/apps/plugins/midi/midiutil.h b/apps/plugins/midi/midiutil.h index 6968c83c9a..3604f422a5 100644 --- a/apps/plugins/midi/midiutil.h +++ b/apps/plugins/midi/midiutil.h | |||
@@ -152,8 +152,7 @@ void * my_malloc(int size); | |||
152 | extern struct SynthObject voices[MAX_VOICES]; | 152 | extern struct SynthObject voices[MAX_VOICES]; |
153 | 153 | ||
154 | extern int chVol[16]; /* Channel volume */ | 154 | extern int chVol[16]; /* Channel volume */ |
155 | extern int chPanLeft[16]; /* Channel panning */ | 155 | extern int chPan[16]; /* Channel panning */ |
156 | extern int chPanRight[16]; | ||
157 | extern int chPat[16]; /* Channel patch */ | 156 | extern int chPat[16]; /* Channel patch */ |
158 | extern int chPW[16]; /* Channel pitch wheel, MSB only */ | 157 | extern int chPW[16]; /* Channel pitch wheel, MSB only */ |
159 | 158 | ||
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c index 82da3efbcf..1a00c078c6 100644 --- a/apps/plugins/midi/sequencer.c +++ b/apps/plugins/midi/sequencer.c | |||
@@ -46,15 +46,6 @@ static inline void setVol(int ch, int vol) | |||
46 | setVolScale(a); | 46 | setVolScale(a); |
47 | } | 47 | } |
48 | 48 | ||
49 | static inline void setPan(int ch, int pan) | ||
50 | { | ||
51 | // printf("\npanning[%d] %d ==> %d", ch, chPanRight[ch], pan); | ||
52 | |||
53 | chPanLeft[ch]=128-pan; | ||
54 | chPanRight[ch]=pan; | ||
55 | } | ||
56 | |||
57 | |||
58 | static inline void setPatch(int ch, int pat) | 49 | static inline void setPatch(int ch, int pat) |
59 | { | 50 | { |
60 | chPat[ch]=pat; | 51 | chPat[ch]=pat; |
@@ -286,7 +277,7 @@ static void sendEvent(struct Event * ev) | |||
286 | } | 277 | } |
287 | case CTRL_PANNING: | 278 | case CTRL_PANNING: |
288 | { | 279 | { |
289 | setPan((status_low), d2); | 280 | chPan[status_low]=d2; |
290 | return; | 281 | return; |
291 | } | 282 | } |
292 | } | 283 | } |
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c index 4936afb655..322d0f792d 100644 --- a/apps/plugins/midi/synth.c +++ b/apps/plugins/midi/synth.c | |||
@@ -62,10 +62,9 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig) | |||
62 | for(a=0; a<16; a++) | 62 | for(a=0; a<16; a++) |
63 | { | 63 | { |
64 | chVol[a]=100; /* Default, not quite full blast.. */ | 64 | chVol[a]=100; /* Default, not quite full blast.. */ |
65 | chPanLeft[a]=64; /* Center */ | 65 | chPan[a]=64; /* Center */ |
66 | chPanRight[a]=64; /* Center */ | ||
67 | chPat[a]=0; /* Ac Gr Piano */ | 66 | chPat[a]=0; /* Ac Gr Piano */ |
68 | chPW[a]=256; /* .. not .. bent ? */ | 67 | chPW[a]=256; /* .. not .. bent ? */ |
69 | } | 68 | } |
70 | for(a=0; a<128; a++) | 69 | for(a=0; a<128; a++) |
71 | { | 70 | { |
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 | ||
69 | static inline struct Event * getEvent(struct Track * tr, int evNum) | 74 | static inline struct Event * getEvent(struct Track * tr, int evNum) |