changeset 141:4f18e68fd0dc

Add a few sounds to the cryo room
author Neil Muller <neil@dip.sun.ac.za>
date Tue, 24 Aug 2010 22:29:23 +0200
parents 95d882eeba12
children da8bf3531199
files Resources/sounds/clang.ogg Resources/sounds/creaking.ogg Resources/sounds/drip1.ogg Resources/sounds/drip2.ogg Resources/sounds/silent.ogg Resources/sounds/sources.txt gamelib/scenes/cryo.py
diffstat 7 files changed, 52 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
Binary file Resources/sounds/clang.ogg has changed
Binary file Resources/sounds/creaking.ogg has changed
Binary file Resources/sounds/drip1.ogg has changed
Binary file Resources/sounds/drip2.ogg has changed
Binary file Resources/sounds/silent.ogg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/sounds/sources.txt	Tue Aug 24 22:29:23 2010 +0200
@@ -0,0 +1,32 @@
+[clang.ogg]
+URL: http://www.archive.org/download/tamtam44old/tamtam44old.zip
+Source: http://www.archive.org/details/tamtam44old
+License: http://creativecommons.org/licenses/by/3.0/
+Credit: Sound samples for tamtam recorded by Richard Boulanger for use in the One Laptop per Child music library.  See http://wiki.laptop.org/go/Sound_samples for details
+Wavfile: clang.wav
+
+[drip2.ogg]
+URL: http://www.archive.org/download/tamtam44old/tamtam44old.zip
+Source: http://www.archive.org/details/tamtam44old
+License: http://creativecommons.org/licenses/by/3.0/
+Credit: Sound samples for tamtam recorded by Richard Boulanger for use in the One Laptop per Child music library.  See http://wiki.laptop.org/go/Sound_samples for details
+Wavfile: drum3cup.wav
+
+[drip1.ogg]
+URL: http://www.archive.org/download/LouCohen/LouCohen44.zip
+Source: http://www.archive.org/details/LouCohen
+License: http://creativecommons.org/licenses/by/3.0/
+Credit: Sound samples by Lou Cohen recorded for Richard Boulanger for use in the One Laptop per Child music library. See http://wiki.laptop.org/go/Sound_samples for details.
+Wavfile: miscClunk1.wav
+
+[creaking.ogg]
+URL: http://www.archive.org/download/Berklee44Barkovich/Berklee44Barkovich.zip
+Source: http://www.archive.org/details/Berklee44Barkovich
+License: http://creativecommons.org/licenses/by/3.0/
+Credit: Sound samples from Berklee recorded for Richard Boulanger for use in the One Laptop per Child music library. See http://wiki.laptop.org/go/Sound_samples for details.
+Wavfile: creaking.wav
+
+[silent.ogg]
+generated 2 secs of silence - dd if=/dev/zero of=silence.pcm bs=176400 count=2
+Not copyrightable.
+
--- a/gamelib/scenes/cryo.py	Tue Aug 24 22:11:59 2010 +0200
+++ b/gamelib/scenes/cryo.py	Tue Aug 24 22:29:23 2010 +0200
@@ -1,8 +1,10 @@
 """Cryo room where the prisoner starts out."""
 
 import random
+from albow.music import change_playlist, get_music, PlayList
 
 from gamelib import speech
+from gamelib.sound import get_sound
 from gamelib.cursor import CursorSprite
 from gamelib.state import Scene, Item, Thing, Result, \
                           InteractImage, InteractNoImage, InteractRectUnion, \
@@ -19,6 +21,15 @@
         'greet' : True
         }
 
+    # sounds that will be played randomly as background noise
+    MUSIC = [
+            'drip1.ogg',
+            'drip2.ogg',
+            'creaking.ogg',
+            'silent.ogg',
+            'silent.ogg',
+            ]
+
     def __init__(self, state):
         super(Cryo, self).__init__(state)
         self.add_item(TitaniumLeg("titanium_leg"))
@@ -27,6 +38,10 @@
         self.add_thing(CryoComputer())
 
     def enter(self):
+        # Setup music
+        pieces = [get_music(x, prefix='sounds') for x in self.MUSIC]
+        background_playlist = PlayList(pieces, random=True, repeat=True)
+        change_playlist(background_playlist)
         if self.get_data('greet'):
             self.set_data('greet', False)
             return Result("Greetings Prisoner id. You have woken early under"
@@ -36,6 +51,10 @@
                     " prison officials when we reach the destination."
                     " Please report to the bridge.")
 
+    def leave(self):
+        # Stop music
+        change_playlist(None)
+
 
 class TitaniumLeg(Item):
     "Titanium leg, found on a piratical corpse."
@@ -103,7 +122,7 @@
         elif self.get_data('door') == "shut":
             text = "You bang on the door with the titanium femur. It makes a clanging sound."
             speech.say(self.name, text)
-            return Result(text)
+            return Result(text, soundfile='clang.ogg')
         else:
             return Result("You wave the femur in the doorway. Nothing happens.")