Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
app-pyaudioplayer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
santiago duque
app-pyaudioplayer
Commits
55c33113
Commit
55c33113
authored
Jan 14, 2025
by
santiago duque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added second button and logic to stop events as a test
parent
939bcd89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
main.py
main.py
+15
-7
No files found.
main.py
View file @
55c33113
...
...
@@ -47,13 +47,16 @@ def setup_sounds():
print
(
"sound array"
)
print
(
sound_array
)
sound_playing
=
False
def
play_sound
(
index
):
global
sound_playing
global
cut_current_sound
global
current_sound_index
global
channel
global
sound_array
sound_playing
=
True
print
(
'play func called'
)
if
not
cut_current_sound
:
...
...
@@ -63,7 +66,8 @@ def play_sound(index):
pygame
.
time
.
wait
(
100
)
# ms
print
(
"Playing..."
)
pygame
.
event
.
clear
()
print
(
"Finished."
)
sound_playing
=
False
print
(
"Finished. "
+
sound_playing
)
""" todo
make sounds stop when new key pressed
...
...
@@ -118,18 +122,22 @@ setup_paths(False)
def
btn_pressed
(
index
):
global
btn_array
global
sound_playing
btn_array
[
index
]
.
when_pressed
=
None
btn_array
[
index
]
.
when_released
=
lambda
:
resetBtn
(
index
)
print
(
'btn pressed'
)
play_sound
(
index
)
if
(
not
sound_playing
):
print
(
'btn pressed'
)
play_sound
(
index
)
def
resetBtn
(
index
):
global
btn_array
print
(
'btn released'
)
btn_array
[
index
]
.
when_released
=
None
btn_array
[
index
]
.
when_pressed
=
lambda
:
btn_pressed
(
index
)
if
(
sound_playing
):
print
(
'btn released'
)
btn_array
[
index
]
.
when_released
=
None
btn_array
[
index
]
.
when_pressed
=
lambda
:
btn_pressed
(
index
)
btn1
=
Button
(
21
)
btn1
.
when_pressed
=
lambda
:
btn_pressed
(
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment