Résolution du path absolu.
[minwii.git] / src / minwii / config.py
1 # -*- coding: utf-8 -*-
2 """
3 constantes de configuration
4
5 $Id$
6 $URL$
7 """
8
9 import pygame
10 import os.path
11
12 _here = os.path.abspath(__file__).split(os.path.sep)[:-1]
13 if _here[-2].endswith('.exe') or _here[-2].endswith('*.zip') :
14 _here.pop(-2)
15
16 def _computePath(path) :
17 path = path.split('/')
18 path = _here + path
19 path = os.path.abspath(os.path.sep.join(path))
20 return path
21
22
23 pygame.font.init()
24 pygamedir = os.path.split(pygame.base.__file__)[0]
25 default_font_file = os.path.join(pygamedir, pygame.font.get_default_font())
26
27
28 # playingscreen
29 FRAMERATE = 100
30 FIRST_HUE = 0.6
31 OFF_LUMINANCE = 0.2
32 OFF_SATURATION = 1
33 ON_TOP_LUMINANCE = 0.6
34 ON_BOTTOM_LUMINANCE = 0.9
35 ON_SATURATION = 1
36 ON_COLUMN_OVERSIZING = 2
37 ON_COLUMN_ALPHA = 1
38 font_file = _computePath('fonts/Arial Unicode.ttf')
39 NOTES_FONT = pygame.font.Font(font_file, 50)
40 LYRICS_FONT = pygame.font.Font(default_font_file, 80)
41 FONT_COLOR = (0,0,0)
42 MIDI_VELOCITY_RANGE = (64, 127)
43 MIDI_PAN_RANGE = (32, 96)
44 MIDI_VELOCITY_WRONG_NOTE_ATTN = 0.5
45
46 SONG_FILE_PATH = _computePath('../../chansons')
47
48 INSTRUMENTS = (
49 {'name' : 'accordeon',
50 'bank' : 0,
51 'preset' : 23
52 },
53 {'name' : 'celesta',
54 'bank' : 0,
55 'preset' : 8,
56 'octave' : 1
57 },
58 {'name' : 'flute',
59 'bank' : 0,
60 'preset' : 73
61 },
62 {'name' : 'guitare',
63 'bank' : 0,
64 'preset' : 24,
65 'octave' : -1
66 },
67 {'name' : 'orgue',
68 'bank' : 0,
69 'preset' : 19
70 },
71 {'name' : 'piano',
72 'bank' : 0,
73 'preset' : 0
74 },
75 {'name' : 'tuba',
76 'bank' : 0,
77 'preset' : 58,
78 'octave' : -2
79 },
80 {'name' : 'violon',
81 'bank' : 0,
82 'preset' : 40
83 },
84 {'name' : 'violoncelle',
85 'bank' : 0,
86 'preset' : 42,
87 'octave' : -2
88 },
89 )
90
91 for i in INSTRUMENTS :
92 i['octave'] = i.get('octave', 0)