/[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 770 - (show annotations) (download)
Sun Sep 11 15:56:29 2005 UTC (18 years, 6 months ago) by schoenebeck
File size: 5490 byte(s)
* synthesis core optimizations

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * Copyright (C) 2005 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) \
31 Synthesizer<CHAN,LOOP,FILTER,INTERPOLATE>::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);
38 }
39
40 void SynthesizeFragment_mode01(SynthesisParam* pFinalParam, Loop* pLoop) {
41 SYNTHESIZE(MONO,0,0,1);
42 }
43
44 void SynthesizeFragment_mode02(SynthesisParam* pFinalParam, Loop* pLoop) {
45 SYNTHESIZE(MONO,0,1,0);
46 }
47
48 void SynthesizeFragment_mode03(SynthesisParam* pFinalParam, Loop* pLoop) {
49 SYNTHESIZE(MONO,0,1,1);
50 }
51
52 void SynthesizeFragment_mode04(SynthesisParam* pFinalParam, Loop* pLoop) {
53 SYNTHESIZE(MONO,1,0,0);
54 }
55
56 void SynthesizeFragment_mode05(SynthesisParam* pFinalParam, Loop* pLoop) {
57 SYNTHESIZE(MONO,1,0,1);
58 }
59
60 void SynthesizeFragment_mode06(SynthesisParam* pFinalParam, Loop* pLoop) {
61 SYNTHESIZE(MONO,1,1,0);
62 }
63
64 void SynthesizeFragment_mode07(SynthesisParam* pFinalParam, Loop* pLoop) {
65 SYNTHESIZE(MONO,1,1,1);
66 }
67
68 void SynthesizeFragment_mode08(SynthesisParam* pFinalParam, Loop* pLoop) {
69 SYNTHESIZE(STEREO,0,0,0);
70 }
71
72 void SynthesizeFragment_mode09(SynthesisParam* pFinalParam, Loop* pLoop) {
73 SYNTHESIZE(STEREO,0,0,1);
74 }
75
76 void SynthesizeFragment_mode0a(SynthesisParam* pFinalParam, Loop* pLoop) {
77 SYNTHESIZE(STEREO,0,1,0);
78 }
79
80 void SynthesizeFragment_mode0b(SynthesisParam* pFinalParam, Loop* pLoop) {
81 SYNTHESIZE(STEREO,0,1,1);
82 }
83
84 void SynthesizeFragment_mode0c(SynthesisParam* pFinalParam, Loop* pLoop) {
85 SYNTHESIZE(STEREO,1,0,0);
86 }
87
88 void SynthesizeFragment_mode0d(SynthesisParam* pFinalParam, Loop* pLoop) {
89 SYNTHESIZE(STEREO,1,0,1);
90 }
91
92 void SynthesizeFragment_mode0e(SynthesisParam* pFinalParam, Loop* pLoop) {
93 SYNTHESIZE(STEREO,1,1,0);
94 }
95
96 void SynthesizeFragment_mode0f(SynthesisParam* pFinalParam, Loop* pLoop) {
97 SYNTHESIZE(STEREO,1,1,1);
98 }
99
100 void* GetSynthesisFunction(int SynthesisMode) {
101 // Mode Bits: CHAN,LOOP,FILT,INTERP
102 switch (SynthesisMode) {
103 case 0x00: return (void*) SynthesizeFragment_mode00;
104 case 0x01: return (void*) SynthesizeFragment_mode01;
105 case 0x02: return (void*) SynthesizeFragment_mode02;
106 case 0x03: return (void*) SynthesizeFragment_mode03;
107 case 0x04: return (void*) SynthesizeFragment_mode04;
108 case 0x05: return (void*) SynthesizeFragment_mode05;
109 case 0x06: return (void*) SynthesizeFragment_mode06;
110 case 0x07: return (void*) SynthesizeFragment_mode07;
111 case 0x08: return (void*) SynthesizeFragment_mode08;
112 case 0x09: return (void*) SynthesizeFragment_mode09;
113 case 0x0a: return (void*) SynthesizeFragment_mode0a;
114 case 0x0b: return (void*) SynthesizeFragment_mode0b;
115 case 0x0c: return (void*) SynthesizeFragment_mode0c;
116 case 0x0d: return (void*) SynthesizeFragment_mode0d;
117 case 0x0e: return (void*) SynthesizeFragment_mode0e;
118 case 0x0f: return (void*) SynthesizeFragment_mode0f;
119 default: {
120 printf("gig::Synthesizer: Invalid Synthesis Mode: %d\n", SynthesisMode);
121 exit(-1);
122 }
123 }
124 }
125
126 void RunSynthesisFunction(const int SynthesisMode, SynthesisParam* pFinalParam, Loop* pLoop) {
127 SynthesizeFragment_Fn* f = (SynthesizeFragment_Fn*) GetSynthesisFunction(SynthesisMode);
128 f(pFinalParam, pLoop);
129 }
130
131 }} // namespace LinuxSampler::gig

  ViewVC Help
Powered by ViewVC