-
Notifications
You must be signed in to change notification settings - Fork 1
Sound added! #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
schielb
wants to merge
42
commits into
dev
Choose a base branch
from
sound
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Sound added! #51
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
160b981
init of two_circle
9de630b
Added new code for a two pixel circle display, to a new branch
11858d2
Added the run demo folder and file,
9b808ea
Decided to split movement into separate functions. made a new branch
ec9f096
made changes to left and right movement, now it will continue to go w…
31b2cc0
Adds the updated working movement, and the colision with the bullit, …
9e02ea0
Adding sound files
schielb 2b21905
Update tetris/main.py
schielb b3fe683
Trying to fit formatting requirements better
schielb 79f1b4a
Adding a ton of sound files
schielb fa40734
Adding pygame-mixer sound broadcaster
schielb 8c0cfaf
Adding parser file for sounds library
schielb 63b1667
Some sounds don't work, removing them
schielb cad62e7
Fixing my formatting you-
schielb bef197d
Fixing formatting
schielb 741126b
Fixing slight sound delay
schielb b888cad
Hangman sounds
schielb 1731ae8
Snake sounds
schielb 3409faf
Adding a ton of new sounds
schielb 2504f71
Adding welcome_y
schielb bd7a484
Merge pull request #47 from NET-BYU/dev
schielb 1fc376c
Fixing and adding some things
schielb 0ac4d90
Formatting welcome_y
schielb de9d614
Formatting welcome_y
schielb 2d8f115
Finished the first iteration of the game
aa372a4
creating a place for bryson to work his magic
Virginia2244 324bdc7
Merge pull request #48 from NET-BYU/sully_groan
schielb 074749f
Adding sully sound
schielb b2759c7
Fixed formating
2420a71
Merge pull request #49 from NET-BYU/run
emilyk19 e4cce9c
Tetris clear row sound
schielb a6f26e7
Merge branch 'sound' of github.com:NET-BYU/sss into sound
schielb 6aaba62
added sounds to movement
758a501
Merge branch 'sound' of https://github.com/NET-BYU/sss into sound
b4cd450
Adding Nyan Cat sound
schielb 4e31758
Formatting video sound
schielb f09ba44
Fixing sounds
schielb 4d87514
Quic under_construction
schielb e67c73a
Merge branch 'dev' of github.com:NET-BYU/sss into sound
byu-netlab 9428a68
Merge branch 'sound' of github.com:NET-BYU/sss into sound
byu-netlab 9fef8cc
Adding a few sounds
schielb 8430efe
Merge branch 'sound' of github.com:NET-BYU/sss into sound
schielb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| from loguru import logger | ||
| from pygame import mixer | ||
|
|
||
| from . import utils | ||
|
|
||
|
|
||
| def check_if_available(): | ||
| try: | ||
| mixer.init() | ||
| return True | ||
| except: | ||
| return False | ||
|
|
||
|
|
||
| def start_processing_output(system_queue, pygame_mixer_q): | ||
| """Called by the broadcaster module to initialize a connection to a loudspeaker local to the system.""" | ||
|
|
||
| def process(): | ||
| # Go through and see what sounds we need to add | ||
| while True: | ||
| try: | ||
| for item in utils.get_all_from_queue(pygame_mixer_q): | ||
| logger.debug("pygame_mixer: {}", item) | ||
| if str(item).startswith("SOUND "): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This sentinel value should be re-evaluated and a better protocol should be devised to ignore unwanted communication |
||
| new_sound = str(item)[6:] | ||
|
|
||
| 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() | ||
| except: | ||
| logger.warning("Unable to play sound file: {}".format(new_sound)) | ||
|
|
||
| yield | ||
|
|
||
| return process() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done in a later branch, but we need to meticulously check and make sure the exceptions to this block will prevent the sss from crashing (i.e.. include all possible exceptions)