Skip to content

Instantly share code, notes, and snippets.

@tonistiigi
Created April 16, 2012 09:23
Show Gist options
  • Save tonistiigi/2397232 to your computer and use it in GitHub Desktop.
Save tonistiigi/2397232 to your computer and use it in GitHub Desktop.
LimeJS Audio updates sample.
// Still support old way:
var tromboon = new lime.audio.Audio('assets/tromboon_sample.mp3');
tromboon.play();
tromboon.stop();
// Support for audio sprites:
// Actual Zynga Player is created on first touch of the director.
var audio = new lime.audio.AudioMap({
resources: [
'media/spritemap-cajon.ac3',
'media/spritemap-cajon.mp3',
'media/spritemap-cajon.m4a',
'media/spritemap-cajon.ogg'
],
autoplay: 'bg-music',
spritemap: {
'bg-music': {
'start': 0.00,
'end': 4.20,
'loop': true // Important! Background Music MUST have it
},
'cajon-2': {
'start': 5.00,
'end': 9.30
}
}
});
audio.play('cajon-2');
audio.stop();
// Global Mute switch
lime.audio.getMute();
lime.audio.setMute(bool);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment