diff options
Diffstat (limited to 'apps/plugins/midi/synth.h')
-rw-r--r-- | apps/plugins/midi/synth.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/apps/plugins/midi/synth.h b/apps/plugins/midi/synth.h new file mode 100644 index 0000000000..daaf26d5f6 --- /dev/null +++ b/apps/plugins/midi/synth.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 Stepan Moskovchenko | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig); | ||
21 | signed short int synthVoice(struct SynthObject * so); | ||
22 | |||
23 | static inline void synthSample(int * mixL, int * mixR) | ||
24 | { | ||
25 | register int dL=0; | ||
26 | register int dR=0; | ||
27 | register short sample=0; | ||
28 | register struct SynthObject *voicept=voices; | ||
29 | struct SynthObject *lastvoice=&voices[MAX_VOICES]; | ||
30 | |||
31 | while(voicept!=lastvoice) | ||
32 | { | ||
33 | if(voicept->isUsed==1) | ||
34 | { | ||
35 | sample = synthVoice(voicept); | ||
36 | dL += (sample*chPanLeft[voicept->ch])>>7; | ||
37 | dR += (sample*chPanRight[voicept->ch])>>7; | ||
38 | } | ||
39 | voicept++; | ||
40 | } | ||
41 | |||
42 | *mixL=dL; | ||
43 | *mixR=dR; | ||
44 | |||
45 | /* TODO: Automatic Gain Control, anyone? */ | ||
46 | /* Or, should this be implemented on the DSP's output volume instead? */ | ||
47 | |||
48 | return; /* No more ghetto lowpass filter.. linear intrpolation works well. */ | ||
49 | } | ||
50 | |||