summaryrefslogtreecommitdiff
path: root/apps/plugins/midi/synth.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/midi/synth.c')
-rw-r--r--apps/plugins/midi/synth.c38
1 files changed, 5 insertions, 33 deletions
diff --git a/apps/plugins/midi/synth.c b/apps/plugins/midi/synth.c
index 00a01e41cb..917a8ae13d 100644
--- a/apps/plugins/midi/synth.c
+++ b/apps/plugins/midi/synth.c
@@ -5,6 +5,7 @@
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/ 7 * \/ \/ \/ \/ \/
8 * $Id$
8 * 9 *
9 * Copyright (C) 2005 Stepan Moskovchenko 10 * Copyright (C) 2005 Stepan Moskovchenko
10 * 11 *
@@ -15,6 +16,10 @@
15 * KIND, either express or implied. 16 * KIND, either express or implied.
16 * 17 *
17 ****************************************************************************/ 18 ****************************************************************************/
19#include "plugin.h"
20#include "guspat.h"
21#include "midiutil.h"
22#include "synth.h"
18 23
19extern struct plugin_api * rb; 24extern struct plugin_api * rb;
20 25
@@ -43,8 +48,6 @@ void readTextBlock(int file, char * buf)
43 rb->lseek(file, -1, SEEK_CUR); 48 rb->lseek(file, -1, SEEK_CUR);
44} 49}
45 50
46
47
48/* Filename is the name of the config file */ 51/* Filename is the name of the config file */
49/* The MIDI file should have been loaded at this point */ 52/* The MIDI file should have been loaded at this point */
50int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig) 53int initSynth(struct MIDIfile * mf, char * filename, char * drumConfig)
@@ -400,34 +403,3 @@ signed short int synthVoice(struct SynthObject * so)
400 return s*so->volscale>>14; 403 return s*so->volscale>>14;
401} 404}
402 405
403
404
405
406
407inline void synthSample(int * mixL, int * mixR)
408{
409 register int dL=0;
410 register int dR=0;
411 register short sample=0;
412 register struct SynthObject *voicept=voices;
413 struct SynthObject *lastvoice=&voices[MAX_VOICES];
414
415 while(voicept!=lastvoice)
416 {
417 if(voicept->isUsed==1)
418 {
419 sample = synthVoice(voicept);
420 dL += (sample*chPanLeft[voicept->ch])>>7;
421 dR += (sample*chPanRight[voicept->ch])>>7;
422 }
423 voicept++;
424 }
425
426 *mixL=dL;
427 *mixR=dR;
428
429 /* TODO: Automatic Gain Control, anyone? */
430 /* Or, should this be implemented on the DSP's output volume instead? */
431
432 return; /* No more ghetto lowpass filter.. linear intrpolation works well. */
433}