]> CRI, Mines Paris - PSL - minwii.git/blobdiff - src/app/synth.py
bugfix sous windows.
[minwii.git] / src / app / synth.py
index 9fb4a3eb1a1cffa6427ae8d1f05c32d4ab72d812..f94358dce1531955935f2c77f3c7a21262d60383 100755 (executable)
@@ -8,6 +8,8 @@ $URL$
 from os.path import realpath, sep, exists
 from  fluidsynth import Synth as FSynth
 from log import console
 from os.path import realpath, sep, exists
 from  fluidsynth import Synth as FSynth
 from log import console
+import pygame
+import events
 
 class Synth(FSynth) :
     """
 
 class Synth(FSynth) :
     """
@@ -33,7 +35,8 @@ class Synth(FSynth) :
         self.start()
         self.fsid = self.sfload(sfPath)
         self._octaveAjusts = {}
         self.start()
         self.fsid = self.sfload(sfPath)
         self._octaveAjusts = {}
-        console.info('démarrage du synthétiseur\nsoundfont : %s', sfPath)
+        console.info('démarrage du synthétiseur')
+        console.info('soundfont : %s', sfPath)
     
     def __del__(self) :
         console.info('arrêt du synthétiseur.')
     
     def __del__(self) :
         console.info('arrêt du synthétiseur.')
@@ -57,7 +60,11 @@ class Synth(FSynth) :
     def noteon(self, chan, key, vel):
         key = key + self._octaveAjusts.get(chan, 0) * 12
         FSynth.noteon(self, chan, key, vel)
     def noteon(self, chan, key, vel):
         key = key + self._octaveAjusts.get(chan, 0) * 12
         FSynth.noteon(self, chan, key, vel)
+        evt = pygame.event.Event(events.NOTEON, chan=chan, key=key, vel=vel)
+        pygame.event.post(evt)
     
     def noteoff(self, chan, key) :
         key = key + self._octaveAjusts.get(chan, 0) * 12
         FSynth.noteoff(self, chan, key)
     
     def noteoff(self, chan, key) :
         key = key + self._octaveAjusts.get(chan, 0) * 12
         FSynth.noteoff(self, chan, key)
+        evt = pygame.event.Event(events.NOTEOFF, chan=chan, key=key)
+        pygame.event.post(evt)