]>
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
)
30 #### Normal workflow ####
32 event
= pygame
.event
.wait()
34 if event
.type == pygame
.QUIT
or (
35 event
.type == pygame
.KEYDOWN
and
37 event
.key
== pygame
.K_c
):
38 for thread
in threading
.enumerate():
39 if thread
.getName()[0:2] != "MS":
46 if context
== 'normal':
47 if event
.type == pygame
.KEYDOWN
:
48 key
= mapping
.find_by_key_num(event
.key
)
50 threading
.Thread(name
= "MSKeyAction", target
=key
.do_actions
).start()
51 elif event
.type == pygame
.MOUSEBUTTONUP
:
52 key
= mapping
.find_by_collidepoint(pygame
.mouse
.get_pos())
54 threading
.Thread(name
= "MSClic", target
=key
.list_actions
, args
= [screen
]).start()
61 # for thread in threading.enumerate():
62 # if thread.getName()[0:2] != "MS":