MOAR sounds
authorStefano Rivera <stefano@rivera.za.net>
Sat, 17 May 2014 14:21:35 +0000 (16:21 +0200)
committerStefano Rivera <stefano@rivera.za.net>
Sat, 17 May 2014 14:21:35 +0000 (16:21 +0200)
data/sounds/__init__.py
data/sounds/aha.ogg [new file with mode: 0644]
data/sounds/awwww.ogg [new file with mode: 0644]
data/sounds/yipee.ogg [new file with mode: 0644]
naja/actions.py

index 77940938d9ea7d762948d07a7ed85031fe572284..48f3e203dfafdf8af65ce077e16dd2df89dd128c 100644 (file)
@@ -1,3 +1,4 @@
+import itertools
 import random
 
 from naja.gen_sound import Chunk, scale
@@ -22,4 +23,16 @@ SOUNDS = {
     'startup': scale(200, 801, 200),
     'zoop': scale(500, 800, 20, length=0.01, volume=50),
     'zzzzz': Chunk('sine', freq=100, length=0.5, volume=50),
+    'yipee': itertools.chain(
+        scale(800, 1001, 50, length=0.1, volume=50),
+        scale(900, 1001, 50, length=0.1, volume=50),
+    ),
+    'awwww': (
+        Chunk('sine', freq=400, volume=50),
+        Chunk('sine', freq=250, length=0.5, volume=50),
+    ),
+    'aha': (
+        Chunk('sine', freq=1100, length=0.2, volume=50),
+        Chunk('sine', freq=1200, length=0.1, volume=50),
+    ),
 }
diff --git a/data/sounds/aha.ogg b/data/sounds/aha.ogg
new file mode 100644 (file)
index 0000000..84b3d0b
Binary files /dev/null and b/data/sounds/aha.ogg differ
diff --git a/data/sounds/awwww.ogg b/data/sounds/awwww.ogg
new file mode 100644 (file)
index 0000000..7e91d97
Binary files /dev/null and b/data/sounds/awwww.ogg differ
diff --git a/data/sounds/yipee.ogg b/data/sounds/yipee.ogg
new file mode 100644 (file)
index 0000000..4e2c4f2
Binary files /dev/null and b/data/sounds/yipee.ogg differ
index d73a66aae4ba0dfede3cbd60e1961531f9299146..9f3b221b3af18cf033093465d0306a9ec1ddab93 100644 (file)
@@ -82,6 +82,7 @@ class LoseHealthOrMSB(LocationAction):
 
     def perform_action(self, board, location):
         if not self.check_and_clear_MSB(board.player):
+            sound.play_sound('awwww.ogg')
             board.lose_health()
 
 
@@ -120,6 +121,7 @@ class LoseHealthOrMSBAndSetBits(LocationAction):
 
     def perform_action(self, board, location):
         if not self.check_and_clear_MSB(board.player):
+            sound.play_sound('awwww.ogg')
             board.lose_health()
         board.player.bits.set_bits(location.bitwise_operand)
 
@@ -129,6 +131,7 @@ class AcquireWinToken(LocationAction):
     GLYPHS = (ACTION_GLYPHS.WINTOKEN,)
 
     def perform_action(self, board, location):
+        sound.play_sound('yipee.ogg')
         board.acquire_win_token()
         board.player.bits.clear_bits(set([
             BITS.RED, BITS.GREEN, BITS.BLUE,
@@ -140,6 +143,7 @@ class GainHealth(LocationAction):
     GLYPHS = (ACTION_GLYPHS.HEAL,)
 
     def perform_action(self, board, location):
+        sound.play_sound('aha.ogg')
         board.gain_health()
 
 
@@ -149,6 +153,7 @@ class GainHealthAndClearBitsOrMSB(LocationAction):
     MSB_GLYPH = ACTION_GLYPHS.CLEAR_BITS
 
     def perform_action(self, board, location):
+        sound.play_sound('aha.ogg')
         board.gain_health()
         if not self.check_and_clear_MSB(board.player):
             board.player.bits.clear_bits(location.bitwise_operand)