diff options
Diffstat (limited to 'apps/plugins/midi/sequencer.c')
-rw-r--r-- | apps/plugins/midi/sequencer.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/apps/plugins/midi/sequencer.c b/apps/plugins/midi/sequencer.c index 27d960ccdb..b2756f296f 100644 --- a/apps/plugins/midi/sequencer.c +++ b/apps/plugins/midi/sequencer.c | |||
@@ -21,13 +21,20 @@ | |||
21 | #include "guspat.h" | 21 | #include "guspat.h" |
22 | #include "synth.h" | 22 | #include "synth.h" |
23 | 23 | ||
24 | void setVolScale(int a); | ||
25 | |||
26 | extern struct plugin_api * rb; | 24 | extern struct plugin_api * rb; |
27 | 25 | ||
28 | long tempo=375000; | 26 | long tempo=375000; |
29 | 27 | ||
30 | inline void setVol(int ch, int vol) | 28 | /* Sets the volume scaling by channel volume and note volume */ |
29 | /* This way we can do the multiplication/indexing once per */ | ||
30 | /* MIDI event at the most, instead of once per sample. */ | ||
31 | static inline void setVolScale(int a) | ||
32 | { | ||
33 | struct SynthObject * so = &voices[a]; | ||
34 | so->volscale = ((signed short int)so->vol*(signed short int)chVol[so->ch]); | ||
35 | } | ||
36 | |||
37 | static inline void setVol(int ch, int vol) | ||
31 | { | 38 | { |
32 | int a=0; | 39 | int a=0; |
33 | chVol[ch]=vol; | 40 | chVol[ch]=vol; |
@@ -39,7 +46,7 @@ inline void setVol(int ch, int vol) | |||
39 | setVolScale(a); | 46 | setVolScale(a); |
40 | } | 47 | } |
41 | 48 | ||
42 | inline void setPan(int ch, int pan) | 49 | static inline void setPan(int ch, int pan) |
43 | { | 50 | { |
44 | // printf("\npanning[%d] %d ==> %d", ch, chPanRight[ch], pan); | 51 | // printf("\npanning[%d] %d ==> %d", ch, chPanRight[ch], pan); |
45 | 52 | ||
@@ -48,7 +55,7 @@ inline void setPan(int ch, int pan) | |||
48 | } | 55 | } |
49 | 56 | ||
50 | 57 | ||
51 | inline void setPatch(int ch, int pat) | 58 | static inline void setPatch(int ch, int pat) |
52 | { | 59 | { |
53 | chPat[ch]=pat; | 60 | chPat[ch]=pat; |
54 | } | 61 | } |
@@ -123,7 +130,7 @@ const uint32_t pitchTbl[] ICONST_ATTR={ | |||
123 | 73297,73330,73363,73396,73429,73462,73495,73528 | 130 | 73297,73330,73363,73396,73429,73462,73495,73528 |
124 | }; | 131 | }; |
125 | 132 | ||
126 | void findDelta(struct SynthObject * so, int ch, int note) | 133 | static void findDelta(struct SynthObject * so, int ch, int note) |
127 | { | 134 | { |
128 | 135 | ||
129 | struct GWaveform * wf = patchSet[chPat[ch]]->waveforms[patchSet[chPat[ch]]->noteTable[note]]; | 136 | struct GWaveform * wf = patchSet[chPat[ch]]->waveforms[patchSet[chPat[ch]]->noteTable[note]]; |
@@ -136,7 +143,7 @@ void findDelta(struct SynthObject * so, int ch, int note) | |||
136 | so->delta = delta; | 143 | so->delta = delta; |
137 | } | 144 | } |
138 | 145 | ||
139 | inline void setPW(int ch, int msb, int lsb) | 146 | static inline void setPW(int ch, int msb, int lsb) |
140 | { | 147 | { |
141 | chPW[ch] = msb<<2|lsb>>5; | 148 | chPW[ch] = msb<<2|lsb>>5; |
142 | 149 | ||
@@ -150,16 +157,7 @@ inline void setPW(int ch, int msb, int lsb) | |||
150 | } | 157 | } |
151 | } | 158 | } |
152 | 159 | ||
153 | /* Sets the volume scaling by channel volume and note volume */ | 160 | static void pressNote(int ch, int note, int vol) |
154 | /* This way we can do the multiplication/indexing once per */ | ||
155 | /* MIDI event at the most, instead of once per sample. */ | ||
156 | void setVolScale(int a) | ||
157 | { | ||
158 | struct SynthObject * so = &voices[a]; | ||
159 | so->volscale = ((signed short int)so->vol*(signed short int)chVol[so->ch]); | ||
160 | } | ||
161 | |||
162 | void pressNote(int ch, int note, int vol) | ||
163 | { | 161 | { |
164 | static int lastKill = 0; | 162 | static int lastKill = 0; |
165 | /* Silences all channels but one, for easy debugging, for me. */ | 163 | /* Silences all channels but one, for easy debugging, for me. */ |
@@ -251,9 +249,8 @@ void pressNote(int ch, int note, int vol) | |||
251 | } | 249 | } |
252 | } | 250 | } |
253 | } | 251 | } |
254 | inline void stopVoice(struct SynthObject * so); | ||
255 | 252 | ||
256 | void releaseNote(int ch, int note) | 253 | static void releaseNote(int ch, int note) |
257 | { | 254 | { |
258 | 255 | ||
259 | if(ch==9) | 256 | if(ch==9) |