/[svn]/linuxsampler/trunk/src/engines/gig/Synthesizer.cpp
ViewVC logotype

Annotation of /linuxsampler/trunk/src/engines/gig/Synthesizer.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 320 - (hide annotations) (download)
Mon Dec 13 00:53:16 2004 UTC (19 years, 4 months ago) by schoenebeck
File size: 14877 byte(s)
* introduced 'synthesis mode' to reduce the amount of code and conditionals
  for the current synthesis case in the main synthesis loop
* support for MMX and SSE(1) in the core synthesis algorithms (CPU feature
  detection at runtime, only x86 so far)

1 schoenebeck 320 /***************************************************************************
2     * *
3     * LinuxSampler - modular, streaming capable sampler *
4     * *
5     * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6     * *
7     * This program is free software; you can redistribute it and/or modify *
8     * it under the terms of the GNU General Public License as published by *
9     * the Free Software Foundation; either version 2 of the License, or *
10     * (at your option) any later version. *
11     * *
12     * This program is distributed in the hope that it will be useful, *
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15     * GNU General Public License for more details. *
16     * *
17     * You should have received a copy of the GNU General Public License *
18     * along with this program; if not, write to the Free Software *
19     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20     * MA 02111-1307 USA *
21     ***************************************************************************/
22    
23     #include <unistd.h>
24     #include <stdlib.h>
25     #include <stdio.h>
26    
27     #include "Synthesizer.h"
28    
29     #define SYNTHESIZE(IMPL,CHAN,FILTER,INTERPOLATE,LOOP,CONSTPITCH) \
30     Synthesizer<IMPL,CHAN,FILTER,INTERPOLATE,LOOP,CONSTPITCH>::SynthesizeFragment( \
31     voice, samples, pSrc, skip)
32    
33     namespace LinuxSampler { namespace gig {
34    
35     void SynthesizeFragment_mode1(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
36     SYNTHESIZE(CPP,MONO,0,0,0,1);
37     }
38    
39     void SynthesizeFragment_mode2(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
40     SYNTHESIZE(CPP,MONO,0,0,1,1);
41     }
42    
43     void SynthesizeFragment_mode3(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
44     SYNTHESIZE(CPP,MONO,0,0,1,1);
45     }
46    
47     void SynthesizeFragment_mode4(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
48     SYNTHESIZE(CPP,MONO,0,1,0,0);
49     }
50    
51     void SynthesizeFragment_mode5(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
52     SYNTHESIZE(CPP,MONO,0,1,0,1);
53     }
54    
55     void SynthesizeFragment_mode6(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
56     SYNTHESIZE(CPP,MONO,0,1,1,0);
57     }
58    
59     void SynthesizeFragment_mode7(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
60     SYNTHESIZE(CPP,MONO,0,1,1,1);
61     }
62    
63     void SynthesizeFragment_mode8(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
64     SYNTHESIZE(CPP,MONO,1,0,0,1);
65     }
66    
67     void SynthesizeFragment_mode9(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
68     SYNTHESIZE(CPP,MONO,1,0,0,1);
69     }
70    
71     void SynthesizeFragment_mode10(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
72     SYNTHESIZE(CPP,MONO,1,0,1,1);
73     }
74    
75     void SynthesizeFragment_mode11(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
76     SYNTHESIZE(CPP,MONO,1,0,1,1);
77     }
78    
79     void SynthesizeFragment_mode12(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
80     SYNTHESIZE(CPP,MONO,1,1,0,0);
81     }
82    
83     void SynthesizeFragment_mode13(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
84     SYNTHESIZE(CPP,MONO,1,1,0,1);
85     }
86    
87     void SynthesizeFragment_mode14(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
88     SYNTHESIZE(CPP,MONO,1,1,1,0);
89     }
90    
91     void SynthesizeFragment_mode15(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
92     SYNTHESIZE(CPP,MONO,1,1,1,1);
93     }
94    
95     void SynthesizeFragment_mode16(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
96     SYNTHESIZE(CPP,STEREO,0,0,0,1);
97     }
98    
99     void SynthesizeFragment_mode17(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
100     SYNTHESIZE(CPP,STEREO,0,0,0,1);
101     }
102    
103     void SynthesizeFragment_mode18(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
104     SYNTHESIZE(CPP,STEREO,0,0,1,1);
105     }
106    
107     void SynthesizeFragment_mode19(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
108     SYNTHESIZE(CPP,STEREO,0,0,1,1);
109     }
110    
111     void SynthesizeFragment_mode20(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
112     SYNTHESIZE(CPP,STEREO,0,1,0,0);
113     }
114    
115     void SynthesizeFragment_mode21(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
116     SYNTHESIZE(CPP,STEREO,0,1,0,1);
117     }
118    
119     void SynthesizeFragment_mode22(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
120     SYNTHESIZE(CPP,STEREO,0,1,1,0);
121     }
122    
123     void SynthesizeFragment_mode23(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
124     SYNTHESIZE(CPP,STEREO,0,1,1,1);
125     }
126    
127     void SynthesizeFragment_mode24(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
128     SYNTHESIZE(CPP,STEREO,1,0,0,1);
129     }
130    
131     void SynthesizeFragment_mode25(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
132     SYNTHESIZE(CPP,STEREO,1,0,0,1);
133     }
134    
135     void SynthesizeFragment_mode26(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
136     SYNTHESIZE(CPP,STEREO,1,0,1,1);
137     }
138    
139     void SynthesizeFragment_mode27(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
140     SYNTHESIZE(CPP,STEREO,1,0,1,1);
141     }
142    
143     void SynthesizeFragment_mode28(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
144     SYNTHESIZE(CPP,STEREO,1,1,0,0);
145     }
146    
147     void SynthesizeFragment_mode29(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
148     SYNTHESIZE(CPP,STEREO,1,1,0,1);
149     }
150    
151     void SynthesizeFragment_mode30(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
152     SYNTHESIZE(CPP,STEREO,1,1,1,0);
153     }
154    
155     void SynthesizeFragment_mode31(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
156     SYNTHESIZE(CPP,STEREO,1,1,1,1);
157     }
158    
159     void SynthesizeFragment_mode32(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
160     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,0,0,0,1);
161     }
162    
163     void SynthesizeFragment_mode33(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
164     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,0,0,0,1);
165     }
166    
167     void SynthesizeFragment_mode34(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
168     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,0,0,1,1);
169     }
170    
171     void SynthesizeFragment_mode35(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
172     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,0,0,1,1);
173     }
174    
175     void SynthesizeFragment_mode36(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
176     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,0,1,0,0);
177     }
178    
179     void SynthesizeFragment_mode37(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
180     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,0,1,0,1);
181     }
182    
183     void SynthesizeFragment_mode38(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
184     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,0,1,1,0);
185     }
186    
187     void SynthesizeFragment_mode39(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
188     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,0,1,1,1);
189     }
190    
191     void SynthesizeFragment_mode40(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
192     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,1,0,0,1);
193     }
194    
195     void SynthesizeFragment_mode41(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
196     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,1,0,0,1);
197     }
198    
199     void SynthesizeFragment_mode42(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
200     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,1,0,1,1);
201     }
202    
203     void SynthesizeFragment_mode43(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
204     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,1,0,1,1);
205     }
206    
207     void SynthesizeFragment_mode44(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
208     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,1,1,0,0);
209     }
210    
211     void SynthesizeFragment_mode45(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
212     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,1,1,0,1);
213     }
214    
215     void SynthesizeFragment_mode46(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
216     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,1,1,1,0);
217     }
218    
219     void SynthesizeFragment_mode47(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
220     SYNTHESIZE(ASM_X86_MMX_SSE,MONO,1,1,1,1);
221     }
222    
223     void SynthesizeFragment_mode48(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
224     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,0,0,0,1);
225     }
226    
227     void SynthesizeFragment_mode49(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
228     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,0,0,0,1);
229     }
230    
231     void SynthesizeFragment_mode50(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
232     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,0,0,1,1);
233     }
234    
235     void SynthesizeFragment_mode51(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
236     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,0,0,1,1);
237     }
238    
239     void SynthesizeFragment_mode52(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
240     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,0,1,0,0);
241     }
242    
243     void SynthesizeFragment_mode53(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
244     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,0,1,0,1);
245     }
246    
247     void SynthesizeFragment_mode54(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
248     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,0,1,1,0);
249     }
250    
251     void SynthesizeFragment_mode55(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
252     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,0,1,1,1);
253     }
254    
255     void SynthesizeFragment_mode56(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
256     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,1,0,0,1);
257     }
258    
259     void SynthesizeFragment_mode57(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
260     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,1,0,0,1);
261     }
262    
263     void SynthesizeFragment_mode58(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
264     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,1,0,1,1);
265     }
266    
267     void SynthesizeFragment_mode59(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
268     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,1,0,1,1);
269     }
270    
271     void SynthesizeFragment_mode60(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
272     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,1,1,0,0);
273     }
274    
275     void SynthesizeFragment_mode61(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
276     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,1,1,0,1);
277     }
278    
279     void SynthesizeFragment_mode62(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
280     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,1,1,1,0);
281     }
282    
283     void SynthesizeFragment_mode63(VOICE &voice, uint samples, sample_t* pSrc, int skip) {
284     SYNTHESIZE(ASM_X86_MMX_SSE,STEREO,1,1,1,1);
285     }
286    
287     void* GetSynthesisFunction(const int SynthesisMode) {
288     // Mode Bits: IMPL,CHAN,FILT,INTERP,LOOP,CONSTPITCH
289     switch (SynthesisMode) {
290     case 0: // redundant
291     case 1: return (void*) SynthesizeFragment_mode1;
292     #if 1
293     case 2: // redundant
294     case 3: return (void*) SynthesizeFragment_mode3;
295     case 4: return (void*) SynthesizeFragment_mode4;
296     case 5: return (void*) SynthesizeFragment_mode5;
297     case 6: return (void*) SynthesizeFragment_mode6;
298     case 7: return (void*) SynthesizeFragment_mode7;
299     case 8: // redundant
300     case 9: return (void*) SynthesizeFragment_mode9;
301     case 10: // redundant
302     case 11: return (void*) SynthesizeFragment_mode11;
303     case 12: return (void*) SynthesizeFragment_mode12;
304     case 13: return (void*) SynthesizeFragment_mode13;
305     case 14: return (void*) SynthesizeFragment_mode14;
306     case 15: return (void*) SynthesizeFragment_mode15;
307     case 16: // redundant
308     case 17: return (void*) SynthesizeFragment_mode17;
309     case 18: // redundant
310     case 19: return (void*) SynthesizeFragment_mode19;
311     case 20: return (void*) SynthesizeFragment_mode20;
312     case 21: return (void*) SynthesizeFragment_mode21;
313     case 22: return (void*) SynthesizeFragment_mode22;
314     case 23: return (void*) SynthesizeFragment_mode23;
315     case 24: // redundant
316     case 25: return (void*) SynthesizeFragment_mode25;
317     case 26: // redundant
318     case 27: return (void*) SynthesizeFragment_mode27;
319     case 28: return (void*) SynthesizeFragment_mode28;
320     case 29: return (void*) SynthesizeFragment_mode29;
321     case 30: return (void*) SynthesizeFragment_mode30;
322     case 31: return (void*) SynthesizeFragment_mode31;
323     case 32: // redundant
324     case 33: return (void*) SynthesizeFragment_mode33;
325     case 34: // redundant
326     case 35: return (void*) SynthesizeFragment_mode35;
327     case 36: return (void*) SynthesizeFragment_mode36;
328     case 37: return (void*) SynthesizeFragment_mode37;
329     case 38: return (void*) SynthesizeFragment_mode38;
330     case 39: return (void*) SynthesizeFragment_mode39;
331     case 40: // redundant
332     case 41: return (void*) SynthesizeFragment_mode41;
333     case 42: // redundant
334     case 43: return (void*) SynthesizeFragment_mode43;
335     case 44: return (void*) SynthesizeFragment_mode44;
336     case 45: return (void*) SynthesizeFragment_mode45;
337     case 46: return (void*) SynthesizeFragment_mode46;
338     case 47: return (void*) SynthesizeFragment_mode47;
339     case 48: // redundant
340     case 49: return (void*) SynthesizeFragment_mode49;
341     case 50: // redundant
342     case 51: return (void*) SynthesizeFragment_mode51;
343     case 52: return (void*) SynthesizeFragment_mode52;
344     case 53: return (void*) SynthesizeFragment_mode53;
345     case 54: return (void*) SynthesizeFragment_mode54;
346     case 55: return (void*) SynthesizeFragment_mode55;
347     case 56: // redundant
348     case 57: return (void*) SynthesizeFragment_mode57;
349     case 58: // redundant
350     case 59: return (void*) SynthesizeFragment_mode59;
351     case 60: return (void*) SynthesizeFragment_mode60;
352     case 61: return (void*) SynthesizeFragment_mode61;
353     case 62: return (void*) SynthesizeFragment_mode62;
354     case 63: return (void*) SynthesizeFragment_mode63;
355     #endif
356     default: {
357     printf("gig::Synthesizer: Invalid Synthesis Mode: %d\n", SynthesisMode);
358     exit(-1);
359     }
360     }
361     }
362    
363    
364     }} // namespace LinuxSampler::gig

  ViewVC Help
Powered by ViewVC