aboutsummaryrefslogtreecommitdiff
path: root/music_sampler.py
diff options
context:
space:
mode:
Diffstat (limited to 'music_sampler.py')
-rw-r--r--music_sampler.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/music_sampler.py b/music_sampler.py
index fd03009..d4fc2a7 100644
--- a/music_sampler.py
+++ b/music_sampler.py
@@ -27,6 +27,7 @@ contexts = [
27 27
28context = 'normal' 28context = 'normal'
29 29
30#### Normal workflow ####
30while 1: 31while 1:
31 event = pygame.event.wait() 32 event = pygame.event.wait()
32 33
@@ -35,7 +36,7 @@ while 1:
35 event.mod == 4160 and 36 event.mod == 4160 and
36 event.key == pygame.K_c): 37 event.key == pygame.K_c):
37 for thread in threading.enumerate(): 38 for thread in threading.enumerate():
38 if thread is threading.current_thread(): 39 if thread.getName()[0:2] != "MS":
39 continue 40 continue
40 thread.join() 41 thread.join()
41 42
@@ -46,13 +47,18 @@ while 1:
46 if event.type == pygame.KEYDOWN: 47 if event.type == pygame.KEYDOWN:
47 key = mapping.find_by_key_num(event.key) 48 key = mapping.find_by_key_num(event.key)
48 if key is not None: 49 if key is not None:
49 threading.Thread(target=key.do_actions).start() 50 threading.Thread(name = "MSKeyAction", target=key.do_actions).start()
50 elif event.type == pygame.MOUSEBUTTONUP: 51 elif event.type == pygame.MOUSEBUTTONUP:
51 key = mapping.find_by_collidepoint(pygame.mouse.get_pos()) 52 key = mapping.find_by_collidepoint(pygame.mouse.get_pos())
52 if key is not None: 53 if key is not None:
53 threading.Thread(target=key.list_actions, args = [screen]).start() 54 threading.Thread(name = "MSClic", target=key.list_actions, args = [screen]).start()
54 55
55 draw_lock.acquire() 56 draw_lock.acquire()
56 pygame.display.flip() 57 pygame.display.flip()
57 draw_lock.release() 58 draw_lock.release()
58 59
60#### In Ipython ####
61# for thread in threading.enumerate():
62# if thread.getName()[0:2] != "MS":
63# continue
64# thread.join()