From 1b0d46151bb6e0d98787fa1cdcc3b5b80b7d2478 Mon Sep 17 00:00:00 2001 From: Aaron Perley Date: Mon, 17 Oct 2016 14:54:06 -0400 Subject: Add sound effects --- webapp/app/static/boat.mp3 | Bin 0 -> 28170 bytes webapp/app/static/dolphin.mp3 | Bin 0 -> 25274 bytes webapp/app/static/dory.mp3 | Bin 0 -> 38786 bytes webapp/app/static/eel.mp3 | Bin 0 -> 38786 bytes webapp/app/static/jellyfish.mp3 | Bin 0 -> 23484 bytes webapp/app/static/music.html | 106 ++++++++++++++++++++++++++++++++++++++ webapp/app/static/nemo.mp3 | Bin 0 -> 38786 bytes webapp/app/static/ocean_waves.mp3 | Bin 0 -> 772254 bytes webapp/app/static/seashore.mp3 | Bin 0 -> 78219 bytes webapp/app/static/shark.mp3 | Bin 0 -> 38786 bytes webapp/app/static/stingray.mp3 | Bin 0 -> 38786 bytes webapp/app/static/underwater.mp3 | Bin 0 -> 178536 bytes webapp/app/static/whale.mp3 | Bin 0 -> 37902 bytes webapp/app/views.py | 23 ++++++++- 14 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 webapp/app/static/boat.mp3 create mode 100644 webapp/app/static/dolphin.mp3 create mode 100644 webapp/app/static/dory.mp3 create mode 100644 webapp/app/static/eel.mp3 create mode 100644 webapp/app/static/jellyfish.mp3 create mode 100644 webapp/app/static/music.html create mode 100644 webapp/app/static/nemo.mp3 create mode 100644 webapp/app/static/ocean_waves.mp3 create mode 100644 webapp/app/static/seashore.mp3 create mode 100644 webapp/app/static/shark.mp3 create mode 100644 webapp/app/static/stingray.mp3 create mode 100644 webapp/app/static/underwater.mp3 create mode 100644 webapp/app/static/whale.mp3 (limited to 'webapp') diff --git a/webapp/app/static/boat.mp3 b/webapp/app/static/boat.mp3 new file mode 100644 index 0000000..eddcd2c Binary files /dev/null and b/webapp/app/static/boat.mp3 differ diff --git a/webapp/app/static/dolphin.mp3 b/webapp/app/static/dolphin.mp3 new file mode 100644 index 0000000..41fb75d Binary files /dev/null and b/webapp/app/static/dolphin.mp3 differ diff --git a/webapp/app/static/dory.mp3 b/webapp/app/static/dory.mp3 new file mode 100644 index 0000000..cbce21d Binary files /dev/null and b/webapp/app/static/dory.mp3 differ diff --git a/webapp/app/static/eel.mp3 b/webapp/app/static/eel.mp3 new file mode 100644 index 0000000..cbce21d Binary files /dev/null and b/webapp/app/static/eel.mp3 differ diff --git a/webapp/app/static/jellyfish.mp3 b/webapp/app/static/jellyfish.mp3 new file mode 100644 index 0000000..21ff687 Binary files /dev/null and b/webapp/app/static/jellyfish.mp3 differ diff --git a/webapp/app/static/music.html b/webapp/app/static/music.html new file mode 100644 index 0000000..154e519 --- /dev/null +++ b/webapp/app/static/music.html @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webapp/app/static/nemo.mp3 b/webapp/app/static/nemo.mp3 new file mode 100644 index 0000000..cbce21d Binary files /dev/null and b/webapp/app/static/nemo.mp3 differ diff --git a/webapp/app/static/ocean_waves.mp3 b/webapp/app/static/ocean_waves.mp3 new file mode 100644 index 0000000..5bd95c4 Binary files /dev/null and b/webapp/app/static/ocean_waves.mp3 differ diff --git a/webapp/app/static/seashore.mp3 b/webapp/app/static/seashore.mp3 new file mode 100644 index 0000000..8c86694 Binary files /dev/null and b/webapp/app/static/seashore.mp3 differ diff --git a/webapp/app/static/shark.mp3 b/webapp/app/static/shark.mp3 new file mode 100644 index 0000000..cbce21d Binary files /dev/null and b/webapp/app/static/shark.mp3 differ diff --git a/webapp/app/static/stingray.mp3 b/webapp/app/static/stingray.mp3 new file mode 100644 index 0000000..cbce21d Binary files /dev/null and b/webapp/app/static/stingray.mp3 differ diff --git a/webapp/app/static/underwater.mp3 b/webapp/app/static/underwater.mp3 new file mode 100644 index 0000000..e387380 Binary files /dev/null and b/webapp/app/static/underwater.mp3 differ diff --git a/webapp/app/static/whale.mp3 b/webapp/app/static/whale.mp3 new file mode 100644 index 0000000..9c03e75 Binary files /dev/null and b/webapp/app/static/whale.mp3 differ diff --git a/webapp/app/views.py b/webapp/app/views.py index a13bf12..99c57c3 100644 --- a/webapp/app/views.py +++ b/webapp/app/views.py @@ -16,6 +16,19 @@ def send_static(path): connections = set() +@sio.on('connect', namespace='/music') +def connect_music(sid, environ): + print("connect_music", sid) + +@sio.on('disconnect', namespace='/music') +def disconnect_music(sid): + print("disconnect_music", sid) + +current_background_music = None +@sio.on('ready', namespace='/music') +def ready_music(sid): + sio.emit('background', {'id': current_background_music}, room=sid, namespace='/music') + @sio.on('connect', namespace='/spawn') def connect(sid, environ): print("connect ", sid) @@ -25,6 +38,7 @@ def connect(sid, environ): def message(sid, data): print("message ", data) send_queue.put(('spawn', data)) + sio.emit('effect', {'id': data['type']}, namespace='/music'); @sio.on('ready', namespace='/spawn') def ready(sid): @@ -52,10 +66,17 @@ def recv_events(): event = recv_queue.get() if event[0] == 'enable image': fish_state[event[1]['name']] = 1 + sio.emit('fish state', fish_state, namespace='/spawn') elif event[0] == 'disable image': fish_state[event[1]['name']] = 0 + sio.emit('fish state', fish_state, namespace='/spawn') + elif event[0] == 'background music': + print "****** background music ", event[1] + sio.emit('background', {'id': event[1]}, namespace='/music'); + current_background_music = event[1]; + elif event[0] == 'effect music': + sio.emit('effect', {'id': event[1]}, namespace='/music'); - sio.emit('fish state', fish_state, namespace='/spawn') thread = sio.start_background_task(recv_events) -- cgit v1.3.1