summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2007-09-30 11:21:25 +0000
committerNils Wallménius <nils@rockbox.org>2007-09-30 11:21:25 +0000
commit6386dbe861bc3395dff1bca5b98e8cbe33ddc703 (patch)
tree0ab9bd6c105cac6ec0a77673fb2b60badd756302
parente108964ec08f70a46e1db430288283d68a906c56 (diff)
downloadrockbox-6386dbe861bc3395dff1bca5b98e8cbe33ddc703.tar.gz
rockbox-6386dbe861bc3395dff1bca5b98e8cbe33ddc703.zip
static/inline/iram raid gives nice speedup
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14915 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugins/midi/midiplay.c5
-rw-r--r--apps/plugins/midi/midiutil.h2
-rw-r--r--apps/plugins/midi/sequencer.c35
-rw-r--r--apps/plugins/midi/synth.c2
-rw-r--r--apps/plugins/midi/synth.h1
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];
97int quit=0; 97int quit=0;
98struct plugin_api * rb; 98struct plugin_api * rb;
99 99
100static int midimain(void * filename);
101
100enum plugin_status plugin_start(struct plugin_api* api, void* parameter) 102enum 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
199int midimain(void * filename) 200static 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
140int printf(const char *fmt, ...); 140int printf(const char *fmt, ...);
141int midimain(void * filename);
142unsigned char readChar(int file); 141unsigned char readChar(int file);
143inline void setPoint(struct SynthObject * so, int pt);
144int readTwoBytes(int file); 142int readTwoBytes(int file);
145int readFourBytes(int file); 143int readFourBytes(int file);
146int readVarData(int file); 144int 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
24void setVolScale(int a);
25
26extern struct plugin_api * rb; 24extern struct plugin_api * rb;
27 25
28long tempo=375000; 26long tempo=375000;
29 27
30inline 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. */
31static 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
37static 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
42inline void setPan(int ch, int pan) 49static 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
51inline void setPatch(int ch, int pat) 58static 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
126void findDelta(struct SynthObject * so, int ch, int note) 133static 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
139inline void setPW(int ch, int msb, int lsb) 146static 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 */ 160static 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. */
156void 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
162void 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}
254inline void stopVoice(struct SynthObject * so);
255 252
256void releaseNote(int ch, int note) 253static 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
194void setPoint(struct SynthObject * so, int pt) ICODE_ATTR;
194void setPoint(struct SynthObject * so, int pt) 195void 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
251inline void stopVoice(struct SynthObject * so) 251inline 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
20int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig); 20int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig);
21signed short int synthVoice(struct SynthObject * so); 21signed short int synthVoice(struct SynthObject * so);
22void setPoint(struct SynthObject * so, int pt);
22 23
23static inline void synthSample(int * mixL, int * mixR) 24static inline void synthSample(int * mixL, int * mixR)
24{ 25{