diff options
-rw-r--r-- | apps/plugins/midi/midiplay.c | 5 | ||||
-rw-r--r-- | apps/plugins/midi/midiutil.h | 2 | ||||
-rw-r--r-- | apps/plugins/midi/sequencer.c | 35 | ||||
-rw-r--r-- | apps/plugins/midi/synth.c | 2 | ||||
-rw-r--r-- | apps/plugins/midi/synth.h | 1 |
5 files changed, 21 insertions, 24 deletions
diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c index 52a538880c..d6cb15190e 100644 --- a/apps/plugins/midi/midiplay.c +++ b/apps/plugins/midi/midiplay.c | |||
@@ -97,6 +97,8 @@ int32_t gmbuf[BUF_SIZE*NBUF]; | |||
97 | int quit=0; | 97 | int quit=0; |
98 | struct plugin_api * rb; | 98 | struct plugin_api * rb; |
99 | 99 | ||
100 | static int midimain(void * filename); | ||
101 | |||
100 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 102 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
101 | { | 103 | { |
102 | int retval = 0; | 104 | int retval = 0; |
@@ -134,7 +136,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
134 | #if defined(HAVE_ADJUSTABLE_CPU_FREQ) | 136 | #if defined(HAVE_ADJUSTABLE_CPU_FREQ) |
135 | rb->cpu_boost(false); | 137 | rb->cpu_boost(false); |
136 | #endif | 138 | #endif |
137 | |||
138 | rb->splash(HZ, "FINISHED PLAYING"); | 139 | rb->splash(HZ, "FINISHED PLAYING"); |
139 | 140 | ||
140 | if(retval == -1) | 141 | if(retval == -1) |
@@ -196,7 +197,7 @@ void get_more(unsigned char** start, size_t* size) | |||
196 | #endif | 197 | #endif |
197 | } | 198 | } |
198 | 199 | ||
199 | int midimain(void * filename) | 200 | static int midimain(void * filename) |
200 | { | 201 | { |
201 | int notesUsed = 0; | 202 | int notesUsed = 0; |
202 | int a=0; | 203 | int a=0; |
diff --git a/apps/plugins/midi/midiutil.h b/apps/plugins/midi/midiutil.h index b15ba832fa..6968c83c9a 100644 --- a/apps/plugins/midi/midiutil.h +++ b/apps/plugins/midi/midiutil.h | |||
@@ -138,9 +138,7 @@ struct Track | |||
138 | }; | 138 | }; |
139 | 139 | ||
140 | int printf(const char *fmt, ...); | 140 | int printf(const char *fmt, ...); |
141 | int midimain(void * filename); | ||
142 | unsigned char readChar(int file); | 141 | unsigned char readChar(int file); |
143 | inline void setPoint(struct SynthObject * so, int pt); | ||
144 | int readTwoBytes(int file); | 142 | int readTwoBytes(int file); |
145 | int readFourBytes(int file); | 143 | int readFourBytes(int file); |
146 | int readVarData(int file); | 144 | int readVarData(int file); |
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) |
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c index 44d42c0c78..4936afb655 100644 --- a/apps/plugins/midi/synth.c +++ b/apps/plugins/midi/synth.c | |||
@@ -191,6 +191,7 @@ int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig) | |||
191 | 191 | ||
192 | #define getSample(s,wf) ((short *)(wf)->data)[s] | 192 | #define getSample(s,wf) ((short *)(wf)->data)[s] |
193 | 193 | ||
194 | void setPoint(struct SynthObject * so, int pt) ICODE_ATTR; | ||
194 | void setPoint(struct SynthObject * so, int pt) | 195 | void setPoint(struct SynthObject * so, int pt) |
195 | { | 196 | { |
196 | if(so->ch==9) /* Drums, no ADSR */ | 197 | if(so->ch==9) /* Drums, no ADSR */ |
@@ -247,7 +248,6 @@ void setPoint(struct SynthObject * so, int pt) | |||
247 | so->curOffset = 0; | 248 | so->curOffset = 0; |
248 | } | 249 | } |
249 | 250 | ||
250 | |||
251 | inline void stopVoice(struct SynthObject * so) | 251 | inline void stopVoice(struct SynthObject * so) |
252 | { | 252 | { |
253 | if(so->state == STATE_RAMPDOWN) | 253 | if(so->state == STATE_RAMPDOWN) |
diff --git a/apps/plugins/midi/synth.h b/apps/plugins/midi/synth.h index f85e3d1cef..5edaf2b7bf 100644 --- a/apps/plugins/midi/synth.h +++ b/apps/plugins/midi/synth.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig); | 20 | int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig); |
21 | signed short int synthVoice(struct SynthObject * so); | 21 | signed short int synthVoice(struct SynthObject * so); |
22 | void setPoint(struct SynthObject * so, int pt); | ||
22 | 23 | ||
23 | static inline void synthSample(int * mixL, int * mixR) | 24 | static inline void synthSample(int * mixL, int * mixR) |
24 | { | 25 | { |