diff --git a/src/audio/_build.py b/src/audio/_build.py index f5a7051b..85659ef5 100755 --- a/src/audio/_build.py +++ b/src/audio/_build.py @@ -22,10 +22,10 @@ def main(folder="./files"): # Open output file output = wave.open(outfile, 'wb') - + # Loop through files in folder and append to outfile for i, infile in enumerate(sorted(glob.glob(os.path.join(folder, '*.wav')))): - + # Open file and get info w = wave.open(infile, 'rb') soundDuration = w.getnframes() / float(w.getframerate()) @@ -57,7 +57,9 @@ def main(folder="./files"): output.close() # Output howler sprite data - print json.dumps(sprite, sort_keys=True, indent=4, separators=(',', ': ')) - + sprites = json.dumps(sprite, sort_keys=True, indent=4, separators=(',', ': ')) + sprites = '\n'.join([x.rstrip() for x in sprites.split('\n')]) + '\n' + file('sprite1.json', 'wb').write(sprites) + if __name__ == "__main__": main() diff --git a/src/audio/_encode.sh b/src/audio/_encode.sh index 5075146a..04b864bc 100755 --- a/src/audio/_encode.sh +++ b/src/audio/_encode.sh @@ -7,4 +7,4 @@ avconv -y -i .tmp-sprite1.wav -aq 2 -acodec libvorbis sprite1.ogg rm -f .tmp-sprite1.wav -cp -fv sprite1.{mp3,ogg} ../../static/sounds +cp -fv sprite1.{json,mp3,ogg} ../../static/sounds diff --git a/src/audio/sprite1.json b/src/audio/sprite1.json new file mode 100644 index 00000000..58cd9116 --- /dev/null +++ b/src/audio/sprite1.json @@ -0,0 +1,34 @@ +{ + "connect1": [ + 0, + 5179 + ], + "end1": [ + 5228, + 6199 + ], + "entry1": [ + 11476, + 3000 + ], + "leaving1": [ + 14526, + 2126 + ], + "message1": [ + 16701, + 816 + ], + "question1": [ + 17567, + 3313 + ], + "ringtone1": [ + 20929, + 935 + ], + "whistle1": [ + 21913, + 1405 + ] +} diff --git a/static/js/controllers/uicontroller.js b/static/js/controllers/uicontroller.js index 36a9db8e..5a255c43 100644 --- a/static/js/controllers/uicontroller.js +++ b/static/js/controllers/uicontroller.js @@ -20,7 +20,7 @@ */ "use strict"; -define(['jquery', 'underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'webrtc.adapter'], function($, _, BigScreen, moment, sjcl, Modernizr) { +define(['jquery', 'underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'text!sounds/sprite1.json', 'webrtc.adapter'], function($, _, BigScreen, moment, sjcl, Modernizr, sprite1Definition) { return ["$scope", "$rootScope", "$element", "$window", "$timeout", "safeDisplayName", "safeApply", "mediaStream", "appData", "playSound", "desktopNotify", "alertify", "toastr", "translation", "fileDownload", "localStorage", "screensharing", "localStatus", "dialogs", "rooms", "constraints", "turnData", function($scope, $rootScope, $element, $window, $timeout, safeDisplayName, safeApply, mediaStream, appData, playSound, desktopNotify, alertify, toastr, translation, fileDownload, localStorage, screensharing, localStatus, dialogs, rooms, constraints, turnData) { @@ -98,43 +98,14 @@ define(['jquery', 'underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'web }; + if (typeof(sprite1Definition) === "string") { + sprite1Definition = JSON.parse(sprite1Definition); + } + // Load default sounds. playSound.initialize({ urls: ['sounds/sprite1.ogg', 'sounds/sprite1.mp3'], - sprite: { - "connect1": [ - 0, - 5179 - ], - "end1": [ - 5228, - 6199 - ], - "entry1": [ - 11476, - 3000 - ], - "leaving1": [ - 14526, - 2126 - ], - "message1": [ - 16701, - 816 - ], - "question1": [ - 17567, - 3313 - ], - "ringtone1": [ - 20929, - 935 - ], - "whistle1": [ - 21913, - 1405 - ] - } + sprite: sprite1Definition }, null, { "ring": "whistle1", "joined": "entry1", diff --git a/static/sounds/sprite1.json b/static/sounds/sprite1.json new file mode 100644 index 00000000..58cd9116 --- /dev/null +++ b/static/sounds/sprite1.json @@ -0,0 +1,34 @@ +{ + "connect1": [ + 0, + 5179 + ], + "end1": [ + 5228, + 6199 + ], + "entry1": [ + 11476, + 3000 + ], + "leaving1": [ + 14526, + 2126 + ], + "message1": [ + 16701, + 816 + ], + "question1": [ + 17567, + 3313 + ], + "ringtone1": [ + 20929, + 935 + ], + "whistle1": [ + 21913, + 1405 + ] +}