Sounds.js
function Sounds(folder,loadCallback) {
	if(!folder)
		throw new Error('No folder given for sounds !')
	// sound is on by default
	this.muted=false;
	// contains sounds elements
	this.sounds={};
	// contains sounds to load
	this.soundsToLoad=new Array();
	// callback executed when each sounds are loaded
	this.loadedSounds=loadCallback;
	// detecting supported extensions
	var sound=document.createElement('audio');
	this.exts=[];
	if(sound.canPlayType('audio/ogg'))
		this.exts.push('ogg');
	if(sound.canPlayType('audio/mp3'))
		this.exts.push('mp3');
	if(sound.canPlayType('audio/x-midi'))
		this.exts.push('mid');
	// folder containing sounds
	this.folder=folder;
}
function Sounds(folder,loadCallback) {
	if(!folder)
		throw new Error('No folder given for sounds !')
	// sound is on by default
	this.muted=false;
	// contains sounds elements
	this.sounds={};
	// contains sounds to load
	this.soundsToLoad=new Array();
	// callback executed when each sounds are loaded
	this.loadedSounds=loadCallback;
	// detecting supported extensions
	var sound=document.createElement('audio');
	this.exts=[];
	if(sound.canPlayType('audio/ogg'))
		this.exts.push('ogg');
	if(sound.canPlayType('audio/mp3'))
		this.exts.push('mp3');
	if(sound.canPlayType('audio/x-midi'))
		this.exts.push('mid');
	// folder containing sounds
	this.folder=folder;
}
function Sounds ( folder , loadCallback ) { if ( ! folder ) throw new Error ( 'No folder given for sounds !' ) // sound is on by default this . muted = false ; // contains sounds elements this . sounds = { } ; // contains sounds to load this . soundsToLoad = new Array ( ) ; // callback executed when each sounds are loaded this . loadedSounds = loadCallback ; // detecting supported extensions var sound = document . createElement ( 'audio' ) ; this . exts = [ ] ; if ( sound . canPlayType ( 'audio/ogg' ) ) this . exts . push ( 'ogg' ) ; if ( sound . canPlayType ( 'audio/mp3' ) ) this . exts . push ( 'mp3' ) ; if ( sound . canPlayType ( 'audio/x-midi' ) ) this . exts . push ( 'mid' ) ; // folder containing sounds this . folder = folder ; }
HTML5 Sounds manager
HTML5 Sounds manager