Ajout des images d'illustration des chansons.
[minwii.git] / src / minwii / event_pprinters.py
1 # -*- coding: utf-8 -*-
2 """
3 formatage des événements
4
5 $Id$
6 $URL$
7 """
8
9 from events import eventNames
10 import sys
11 self = sys.modules[__name__]
12
13 def log_NOTEON(e):
14 return '%3d %3d %3d' % (e.chan, e.key, e.vel)
15
16 def log_NOTEOFF(e):
17 return '%3d %3d' % (e.chan, e.key)
18
19 def log_NOTEEND(e):
20 return ''
21
22 def log_SONGEND(e) :
23 return ''
24
25 def log_COLSTATECHANGE(e):
26 col = e.column
27 tone = col.tone
28 return u'%2d %5s %3s %3s %s' % \
29 (col.index, e.state, tone.midi, tone.name, e.syllabus)
30
31 def _log_col(e) :
32 """ formate les événements de colonne COLDOWN, COLUP, COLOVER
33 - etat
34 - index de colonne
35 - hauteur midi
36 - nom de la note /A-G[#b]?/
37 """
38 col = e.column
39 tone = col.tone
40 pos = e.pos
41 return u'%2d %5s %3s %3s %r' % \
42 (col.index, col.state, tone.midi, tone.name, pos)
43
44 log_COLDOWN = log_COLUP = log_COLOVER = _log_col
45
46 def log_default(e) :
47 return str(e)
48
49 pprinters = {}
50 for type, name in eventNames.items() :
51 f = getattr(self, 'log_%s' % name, log_default)
52 pprinters[type] = f
53
54 __all__ = ('pprinters')