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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2376 - (show annotations) (download)
Thu Oct 4 18:09:26 2012 UTC (7 years, 11 months ago) by schoenebeck
File size: 8597 byte(s)
- don't use printf() for error messages

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * Copyright (C) 2005 - 2012 Christian Schoenebeck *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21 * MA 02111-1307 USA *
22 ***************************************************************************/
23
24 #include <unistd.h>
25 #include <stdlib.h>
26 #include <stdio.h>
27
28 #include "Synthesizer.h"
29
30 #define SYNTHESIZE(CHAN,LOOP,FILTER,INTERPOLATE,BITDEPTH24) \
31 Synthesizer<CHAN,LOOP,FILTER,INTERPOLATE,BITDEPTH24>::SynthesizeSubFragment( \
32 pFinalParam, pLoop)
33
34 namespace LinuxSampler { namespace gig {
35
36 void SynthesizeFragment_mode00(SynthesisParam* pFinalParam, Loop* pLoop) {
37 SYNTHESIZE(MONO,0,0,0,0);
38 }
39
40 void SynthesizeFragment_mode01(SynthesisParam* pFinalParam, Loop* pLoop) {
41 SYNTHESIZE(MONO,0,0,1,0);
42 }
43
44 void SynthesizeFragment_mode02(SynthesisParam* pFinalParam, Loop* pLoop) {
45 SYNTHESIZE(MONO,0,1,0,0);
46 }
47
48 void SynthesizeFragment_mode03(SynthesisParam* pFinalParam, Loop* pLoop) {
49 SYNTHESIZE(MONO,0,1,1,0);
50 }
51
52 void SynthesizeFragment_mode04(SynthesisParam* pFinalParam, Loop* pLoop) {
53 SYNTHESIZE(MONO,1,0,0,0);
54 }
55
56 void SynthesizeFragment_mode05(SynthesisParam* pFinalParam, Loop* pLoop) {
57 SYNTHESIZE(MONO,1,0,1,0);
58 }
59
60 void SynthesizeFragment_mode06(SynthesisParam* pFinalParam, Loop* pLoop) {
61 SYNTHESIZE(MONO,1,1,0,0);
62 }
63
64 void SynthesizeFragment_mode07(SynthesisParam* pFinalParam, Loop* pLoop) {
65 SYNTHESIZE(MONO,1,1,1,0);
66 }
67
68 void SynthesizeFragment_mode08(SynthesisParam* pFinalParam, Loop* pLoop) {
69 SYNTHESIZE(STEREO,0,0,0,0);
70 }
71
72 void SynthesizeFragment_mode09(SynthesisParam* pFinalParam, Loop* pLoop) {
73 SYNTHESIZE(STEREO,0,0,1,0);
74 }
75
76 void SynthesizeFragment_mode0a(SynthesisParam* pFinalParam, Loop* pLoop) {
77 SYNTHESIZE(STEREO,0,1,0,0);
78 }
79
80 void SynthesizeFragment_mode0b(SynthesisParam* pFinalParam, Loop* pLoop) {
81 SYNTHESIZE(STEREO,0,1,1,0);
82 }
83
84 void SynthesizeFragment_mode0c(SynthesisParam* pFinalParam, Loop* pLoop) {
85 SYNTHESIZE(STEREO,1,0,0,0);
86 }
87
88 void SynthesizeFragment_mode0d(SynthesisParam* pFinalParam, Loop* pLoop) {
89 SYNTHESIZE(STEREO,1,0,1,0);
90 }
91
92 void SynthesizeFragment_mode0e(SynthesisParam* pFinalParam, Loop* pLoop) {
93 SYNTHESIZE(STEREO,1,1,0,0);
94 }
95
96 void SynthesizeFragment_mode0f(SynthesisParam* pFinalParam, Loop* pLoop) {
97 SYNTHESIZE(STEREO,1,1,1,0);
98 }
99
100 void SynthesizeFragment_mode10(SynthesisParam* pFinalParam, Loop* pLoop) {
101 SYNTHESIZE(MONO,0,0,0,1);
102 }
103
104 void SynthesizeFragment_mode11(SynthesisParam* pFinalParam, Loop* pLoop) {
105 SYNTHESIZE(MONO,0,0,1,1);
106 }
107
108 void SynthesizeFragment_mode12(SynthesisParam* pFinalParam, Loop* pLoop) {
109 SYNTHESIZE(MONO,0,1,0,1);
110 }
111
112 void SynthesizeFragment_mode13(SynthesisParam* pFinalParam, Loop* pLoop) {
113 SYNTHESIZE(MONO,0,1,1,1);
114 }
115
116 void SynthesizeFragment_mode14(SynthesisParam* pFinalParam, Loop* pLoop) {
117 SYNTHESIZE(MONO,1,0,0,1);
118 }
119
120 void SynthesizeFragment_mode15(SynthesisParam* pFinalParam, Loop* pLoop) {
121 SYNTHESIZE(MONO,1,0,1,1);
122 }
123
124 void SynthesizeFragment_mode16(SynthesisParam* pFinalParam, Loop* pLoop) {
125 SYNTHESIZE(MONO,1,1,0,1);
126 }
127
128 void SynthesizeFragment_mode17(SynthesisParam* pFinalParam, Loop* pLoop) {
129 SYNTHESIZE(MONO,1,1,1,1);
130 }
131
132 void SynthesizeFragment_mode18(SynthesisParam* pFinalParam, Loop* pLoop) {
133 SYNTHESIZE(STEREO,0,0,0,1);
134 }
135
136 void SynthesizeFragment_mode19(SynthesisParam* pFinalParam, Loop* pLoop) {
137 SYNTHESIZE(STEREO,0,0,1,1);
138 }
139
140 void SynthesizeFragment_mode1a(SynthesisParam* pFinalParam, Loop* pLoop) {
141 SYNTHESIZE(STEREO,0,1,0,1);
142 }
143
144 void SynthesizeFragment_mode1b(SynthesisParam* pFinalParam, Loop* pLoop) {
145 SYNTHESIZE(STEREO,0,1,1,1);
146 }
147
148 void SynthesizeFragment_mode1c(SynthesisParam* pFinalParam, Loop* pLoop) {
149 SYNTHESIZE(STEREO,1,0,0,1);
150 }
151
152 void SynthesizeFragment_mode1d(SynthesisParam* pFinalParam, Loop* pLoop) {
153 SYNTHESIZE(STEREO,1,0,1,1);
154 }
155
156 void SynthesizeFragment_mode1e(SynthesisParam* pFinalParam, Loop* pLoop) {
157 SYNTHESIZE(STEREO,1,1,0,1);
158 }
159
160 void SynthesizeFragment_mode1f(SynthesisParam* pFinalParam, Loop* pLoop) {
161 SYNTHESIZE(STEREO,1,1,1,1);
162 }
163
164 void* GetSynthesisFunction(int SynthesisMode) {
165 // Mode Bits: (PROF),(IMPL),24BIT,CHAN,LOOP,FILT,INTERP
166 switch (SynthesisMode) {
167 case 0x00: return (void*) SynthesizeFragment_mode00;
168 case 0x01: return (void*) SynthesizeFragment_mode01;
169 case 0x02: return (void*) SynthesizeFragment_mode02;
170 case 0x03: return (void*) SynthesizeFragment_mode03;
171 case 0x04: return (void*) SynthesizeFragment_mode04;
172 case 0x05: return (void*) SynthesizeFragment_mode05;
173 case 0x06: return (void*) SynthesizeFragment_mode06;
174 case 0x07: return (void*) SynthesizeFragment_mode07;
175 case 0x08: return (void*) SynthesizeFragment_mode08;
176 case 0x09: return (void*) SynthesizeFragment_mode09;
177 case 0x0a: return (void*) SynthesizeFragment_mode0a;
178 case 0x0b: return (void*) SynthesizeFragment_mode0b;
179 case 0x0c: return (void*) SynthesizeFragment_mode0c;
180 case 0x0d: return (void*) SynthesizeFragment_mode0d;
181 case 0x0e: return (void*) SynthesizeFragment_mode0e;
182 case 0x0f: return (void*) SynthesizeFragment_mode0f;
183 case 0x10: return (void*) SynthesizeFragment_mode10;
184 case 0x11: return (void*) SynthesizeFragment_mode11;
185 case 0x12: return (void*) SynthesizeFragment_mode12;
186 case 0x13: return (void*) SynthesizeFragment_mode13;
187 case 0x14: return (void*) SynthesizeFragment_mode14;
188 case 0x15: return (void*) SynthesizeFragment_mode15;
189 case 0x16: return (void*) SynthesizeFragment_mode16;
190 case 0x17: return (void*) SynthesizeFragment_mode17;
191 case 0x18: return (void*) SynthesizeFragment_mode18;
192 case 0x19: return (void*) SynthesizeFragment_mode19;
193 case 0x1a: return (void*) SynthesizeFragment_mode1a;
194 case 0x1b: return (void*) SynthesizeFragment_mode1b;
195 case 0x1c: return (void*) SynthesizeFragment_mode1c;
196 case 0x1d: return (void*) SynthesizeFragment_mode1d;
197 case 0x1e: return (void*) SynthesizeFragment_mode1e;
198 case 0x1f: return (void*) SynthesizeFragment_mode1f;
199 default: {
200 std::cerr << "gig::Synthesizer: Invalid Synthesis Mode: " << SynthesisMode << std::endl << std::flush;
201 exit(-1);
202 }
203 }
204 }
205
206 void RunSynthesisFunction(const int SynthesisMode, SynthesisParam* pFinalParam, Loop* pLoop) {
207 SynthesizeFragment_Fn* f = (SynthesizeFragment_Fn*) GetSynthesisFunction(SynthesisMode);
208 f(pFinalParam, pLoop);
209 }
210
211 }} // namespace LinuxSampler::gig

  ViewVC Help
Powered by ViewVC