Skip to content

Instantly share code, notes, and snippets.

@bartread
Created February 11, 2017 15:02
Show Gist options
  • Save bartread/3af2b4aa5250149561c41f3a5fb51681 to your computer and use it in GitHub Desktop.
Save bartread/3af2b4aa5250149561c41f3a5fb51681 to your computer and use it in GitHub Desktop.
Example sound and music configuration for games on arcade.ly
(function () {
'use strict';
pinjector
.module('starCastle')
.factory(
'soundConfiguration',
[
'baseAsteroidsStarcastleSoundConfiguration',
soundConfiguration
]);
function soundConfiguration(baseAsteroidsStarcastleSoundConfiguration) {
var config = {
sounds: [{
id: 'cannonThrust',
src: '/sounds/starcastle/CannonThrust.mp3',
volume: 0.1
}, {
id: 'cannonFire',
src: '/sounds/starcastle/CannonFire.mp3',
volume: 1.0
}, {
id: 'cannonLock',
src: '/sounds/starcastle/CannonLock.mp3',
volume: 0.4
}, {
id: 'mineRelease',
src: '/sounds/starcastle/MineRelease.mp3',
volume: 1.0,
rapidRepeat: true
}, {
id: 'mineCapture',
src: '/sounds/starcastle/MineCapture.mp3',
volume: 1.0,
rapidRepeat: true
}, {
id: 'alienScream',
src: '/sounds/starcastle/AlienScream.mp3',
volume: 1.0,
rapidRepeat: true
}],
music: [{
id: 'titleMusic',
src: '/music/starcastle/179_full_arrested-for-driving-while-mad_0159.mp3',
srcLowQuality: '/music/starcastle/179_full_arrested-for-driving-while-mad_0159_lowquality.mp3',
volume: 1.0,
autoplay: true
}, {
id: 'levelMusic',
src: '/music/starcastle/179_full_a-naked-gun-bank-assault_0100.mp3',
srcLowQuality: '/music/starcastle/179_full_a-naked-gun-bank-assault_0100_lowquality.mp3',
volume: 1.0
}, {
id: 'gameOverMusic',
src: '/music/starcastle/156_full_good-ol-western_0123.mp3',
srcLowQuality: '/music/starcastle/156_full_good-ol-western_0123_lowquality.mp3',
volume: 1.0
}]
};
baseAsteroidsStarcastleSoundConfiguration.mergeIntoMaster(config);
return baseAsteroidsStarcastleSoundConfiguration;
}
}());
/*
This code is licensed under the terms of the MIT License as described
in LICENSE.txt.
Copyright (c) 2015 - 2017 Bart Read, arcade.ly (https://arcade.ly),
and bartread.com Ltd (http://www.bartread.com/)
The soundConfiguration service is a per-game service, implemented by
games at https://arcade.ly, that provides configuration for sound
effects and music to the sfx service, thus allowing them to be played.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment