la sélection de l'instrut doit être faite plus tard.
[minwii.git] / src / app / synth.py
1 # -*- coding: utf-8 -*-
2 """
3 module de wrapping du synthétiseur
4
5 $Id$
6 $URL$
7 """
8 from os.path import realpath, sep, exists
9 from fluidsynth import Synth as FSynth
10
11 class Synth(FSynth) :
12
13 def __init__(self, gain=0.2, samplerate=44100) :
14 FSynth.__init__(self, gain=gain, samplerate=samplerate)
15
16 sfPath = realpath(__file__).split(sep)
17 sfPath = sfPath[:-1]
18 sfPath.append('soundfonts')
19
20 sfPath.append('FluidR3_GM.sf2')
21 sfPath = sep.join(sfPath)
22 assert exists(sfPath)
23
24 self.start()
25 self.fsid = self.sfload(sfPath)
26
27 def sfunload(self, update_midi_preset=0):
28 FSynth.sfunload(self, self.fsid, update_midi_preset=update_midi_preset)
29
30 def program_select(self, chan, bank, preset):
31 FSynth.program_select(self, chan, self.fsid, bank, preset)
32
33 def sfont_select(self, chan):
34 FSynth.sfont_select(self, chan, self.fsid)
35
36
37
38
39 if __name__ == '__main__' :
40 initsynth()