Commits

illume committed 54adbc9

Allow to pass in a file name for the sound. Makes it also useful for
testing.

  • Participants
  • Parent commits 26ccf2b

Comments (0)

Files changed (1)

File examples/sound.py

 don't even bother loading all of the pygame package. Just
 pick the mixer for sound and time for the delay function."""
 
-import os.path
+import os.path, sys
 import pygame.mixer, pygame.time
 mixer = pygame.mixer
 time = pygame.time
 
 
 #load the sound    
-file = os.path.join('data', 'secosmic_lo.wav')
+
+if len(sys.argv) > 1 and "wav" in sys.argv[1]:
+    file = sys.argv[1]
+else:
+    file = os.path.join('data', 'secosmic_lo.wav')
 sound = mixer.Sound(file)