]>
git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blob - music_sampler.py
6 pygame
.mixer
.pre_init(frequency
= 44100)
9 size
= width
, height
= 1024, 600
10 screen
= pygame
.display
.set_mode(size
)
11 screen
.fill((250, 250, 250))
13 draw_lock
= helpers
.Lock("draw")
15 mapping
= helpers
.Mapping(screen
, draw_lock
)
16 helpers
.parse_config(mapping
)
31 event
= pygame
.event
.wait()
33 if event
.type == pygame
.QUIT
or (
34 event
.type == pygame
.KEYDOWN
and
36 event
.key
== pygame
.K_c
):
37 for thread
in threading
.enumerate():
38 if thread
is threading
.current_thread():
45 if context
== 'normal':
46 if event
.type == pygame
.KEYDOWN
:
47 key
= mapping
.find_by_key_num(event
.key
)
49 threading
.Thread(target
=key
.do_actions
).start()
50 elif event
.type == pygame
.MOUSEBUTTONUP
:
51 key
= mapping
.find_by_collidepoint(pygame
.mouse
.get_pos())
53 threading
.Thread(target
=key
.list_actions
, args
= [screen
]).start()