bro
This commit is contained in:
1 parent
de41a02749
commit
9af09cebd3
764 files changed
+54218
-78859
No files matched your search
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
"""pygame.examples.sound
|
||||
""" pygame.examples.sound
|
||||
|
||||
Playing a soundfile and waiting for it to finish. You'll need the
|
||||
pygame.mixer module for this to work. Note how in this simple example
|
||||
@@ -8,11 +8,9 @@ Just pick the mixer for sound and time for the delay function.
|
||||
|
||||
Optional command line argument: audio file name
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pygame
|
||||
import pygame as pg
|
||||
|
||||
main_dir = os.path.split(os.path.abspath(__file__))[0]
|
||||
|
||||
@@ -23,10 +21,10 @@ def main(file_path=None):
|
||||
:param str file_path: audio file (default data/secosmic_low.wav)
|
||||
"""
|
||||
# choose a desired audio format
|
||||
pygame.mixer.init(11025) # raises exception on fail
|
||||
pg.mixer.init(11025) # raises exception on fail
|
||||
|
||||
# load the sound
|
||||
sound = pygame.mixer.Sound(file_path)
|
||||
sound = pg.mixer.Sound(file_path)
|
||||
|
||||
# start playing
|
||||
print("Playing Sound...")
|
||||
@@ -35,9 +33,9 @@ def main(file_path=None):
|
||||
# poll until finished
|
||||
while channel.get_busy(): # still playing
|
||||
print(" ...still going...")
|
||||
pygame.time.wait(1000)
|
||||
pg.time.wait(1000)
|
||||
print("...Finished")
|
||||
pygame.quit()
|
||||
pg.quit()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user