Skip to content

Commit

Permalink
Some sounds don't work, removing them
Browse files Browse the repository at this point in the history
  • Loading branch information
schielb committed Aug 31, 2023
1 parent 8c0cfaf commit 63b1667
Show file tree
Hide file tree
Showing 26 changed files with 25 additions and 35 deletions.
19 changes: 15 additions & 4 deletions broadcasters/pygame_mixer_bc.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,21 @@ def process():
logger.debug("pygame_mixer: {}", item)
if str(item).startswith("SOUND "):
new_sound = str(item)[6:]
if new_sound != current_sound:
current_sound = new_sound
mixer.music.load(new_sound)
mixer.music.play()

short_Sound = mixer.Sound(new_sound)
short_Sound.play()

# if new_sound != current_sound:
# current_sound = new_sound
# mixer.Sound.load(new_sound)
# mixer.Sound.play()
elif str(item).startswith("BACKGROUND SOUND "):
new_sound = str(item)[17:]
mixer.music.load(new_sound)
mixer.music.play(-1)
elif str(item).startswith("STOP SOUND"):
mixer.music.stop()
current_sound = None
except:
logger.warning("Unable to play sound file: {}".format(new_sound))

Expand Down
4 changes: 2 additions & 2 deletions demos/breakout/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def run(self):
self.output_queue.put("LIVES " + str(lives))
self.init_screen(screen)

self.output_queue.put("SOUND " + sss_sounds.PORTAL)
self.output_queue.put("SOUND " + sss_sounds.LEVEL_UP)

screen.draw_pixel(self.ball[0], self.ball[1], PIXEL_OFF)

Expand Down Expand Up @@ -201,7 +201,7 @@ def run(self):
if lives == 0:
self.gameover = True

self.output_queue.put("SOUND " + sss_sounds.END_FAIL_3)
self.output_queue.put("SOUND " + sss_sounds.END_FAIL_7)
break
self.ball = [screen.x_width // 2, screen.y_height // 2]

Expand Down
13 changes: 7 additions & 6 deletions demos/tetris/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import random
from enum import Enum
from os.path import exists
from sss_sounds import sss_sounds

from demos.utils import get_all_from_queue
from pygame import mixer


class Tetris:
Expand Down Expand Up @@ -48,8 +48,6 @@ def __init__(self, input_queue, output_queue, screen):
file.write("AA 0\n")
file.close()

mixer.init()

def run(self):
# Create generator here

Expand All @@ -64,6 +62,8 @@ def run(self):

next_shape = random.choice(list(self.Shape))

self.output_queue.put("BACKGROUND SOUND " + sss_sounds.TETRIS)

while not self.is_game_over():
if self.level == 2:
self.drop_rate = 10
Expand Down Expand Up @@ -167,8 +167,8 @@ def run(self):
self.draw_shape(prev_shape_location, erase=True)
self.draw_shape(shape_location)
prev_shape_location = shape_location.copy()
mixer.music.load("./sss_sounds/beep-17.mp3")
mixer.music.play()

self.output_queue.put("SOUND " + sss_sounds.BEEP_15)

is_falling = self.is_falling(shape_location)

Expand Down Expand Up @@ -206,6 +206,8 @@ def run(self):
self.screen.push()
yield

self.output_queue.put("STOP SOUND")

self.draw_game_over_screen()
self.screen.push()

Expand Down Expand Up @@ -751,5 +753,4 @@ def get_letter(self, x, y):

def stop(self):
# Reset the state of the demo if needed, else leave blank
mixer.quit()
pass
Binary file added sss_sounds/Tetris.mp3
Binary file not shown.
Binary file removed sss_sounds/beep-17.mp3
Binary file not shown.
Binary file removed sss_sounds/beep-2.mp3
Binary file not shown.
Binary file removed sss_sounds/beep-3.mp3
Binary file not shown.
Binary file removed sss_sounds/beep-5.mp3
Binary file not shown.
Binary file removed sss_sounds/blaster-1.mp3
Binary file not shown.
Binary file removed sss_sounds/blaster-2.mp3
Binary file not shown.
Binary file removed sss_sounds/cartoon-jump-6462.mp3
Binary file not shown.
Binary file removed sss_sounds/congrats.mp3
Binary file not shown.
Binary file removed sss_sounds/end-fail-1.mp3
Binary file not shown.
Binary file removed sss_sounds/end-fail-2.mp3
Binary file not shown.
Binary file removed sss_sounds/end-fail-3.mp3
Binary file not shown.
Binary file removed sss_sounds/end-fail-4.mp3
Binary file not shown.
Binary file removed sss_sounds/end-fail-9.mp3
Binary file not shown.
Binary file removed sss_sounds/end-win-2.mp3
Binary file not shown.
Binary file removed sss_sounds/end-win-3.mp3
Binary file not shown.
Binary file removed sss_sounds/end-win-4.mp3
Binary file not shown.
Binary file removed sss_sounds/end-win-6.mp3
Binary file not shown.
Binary file removed sss_sounds/failure-drum.mp3
Binary file not shown.
Binary file removed sss_sounds/ping.mp3
Binary file not shown.
Binary file removed sss_sounds/portal.mp3
Binary file not shown.
24 changes: 1 addition & 23 deletions sss_sounds/sss_sounds.py
Original file line number Diff line number Diff line change
@@ -1,44 +1,22 @@
BEEP_01 = "sss_sounds/beep-1.mp3"
BEEP_02 = "sss_sounds/beep-2.mp3"
BEEP_03 = "sss_sounds/beep-3.mp3"
BEEP_04 = "sss_sounds/beep-4.mp3"
BEEP_05 = "sss_sounds/beep-5.mp3"
BEEP_06_GOOD = "sss_sounds/beep-6-good.mp3"
BEEP_07_GOOD = "sss_sounds/beep-7-good.mp3"
BEEP_08 = "sss_sounds/beep-8.mp3"
BEEP_09 = "sss_sounds/beep-9.mp3"
BEEP_10 = "sss_sounds/beep-10.mp3"
BEEP_11 = "sss_sounds/beep-11.mp3"
BEEP_12 = "sss_sounds/beep-12.mp3"
BEEP_13 = "sss_sounds/beep-13.mp3"
BEEP_14 = "sss_sounds/beep-14.mp3"
BEEP_15 = "sss_sounds/beep-15.mp3"
BEEP_16 = "sss_sounds/beep-16.mp3"
BEEP_17 = "sss_sounds/beep-17.mp3"
BLASTER_1 = "sss_sounds/blaster-1.mp3"
BLASTER_2 = "sss_sounds/blaster-2.mp3"
CARTOON_JUMP_6462 = "sss_sounds/cartoon-jump-6462.mp3"
CONGRATS = "sss_sounds/congrats.mp3"
END_FAIL_1 = "sss_sounds/end-fail-1.mp3"
END_FAIL_10_GOODBYE = "sss_sounds/end-fail-10-goodbye.mp3"
END_FAIL_2 = "sss_sounds/end-fail-2.mp3"
END_FAIL_3 = "sss_sounds/end-fail-3.mp3"
END_FAIL_4 = "sss_sounds/end-fail-4.mp3"
END_FAIL_5 = "sss_sounds/end-fail-5.mp3"
END_FAIL_6 = "sss_sounds/end-fail-6.mp3"
END_FAIL_7 = "sss_sounds/end-fail-7.mp3"
END_FAIL_8 = "sss_sounds/end-fail-8.mp3"
END_FAIL_9 = "sss_sounds/end-fail-9.mp3"
END_WIN_2 = "sss_sounds/end-win-2.mp3"
END_WIN_3 = "sss_sounds/end-win-3.mp3"
END_WIN_4 = "sss_sounds/end-win-4.mp3"
END_WIN_5 = "sss_sounds/end-win-5.mp3"
END_WIN_6 = "sss_sounds/end-win-6.mp3"
FAILURE_DRUM = "sss_sounds/failure-drum.mp3"
LEVEL_UP = "sss_sounds/level-up.mp3"
PING = "sss_sounds/ping.mp3"
PORTAL = "sss_sounds/portal.mp3"
SINISTER_LAUGH = "sss_sounds/sinister-laugh.mp3"
SWOOSH = "sss_sounds/swoosh.mp3"
TETRIS = "sss_sounds/Tetris.mp3"
TICK = "sss_sounds/tick.mp3"
UH_OH = "sss_sounds/uh-oh.mp3"
Binary file removed sss_sounds/swoosh.mp3
Binary file not shown.

0 comments on commit 63b1667

Please sign in to comment.