Skip to content

Extension of SimpleAudioEngine.js to use howler.js as Audio Engine.

Notifications You must be signed in to change notification settings

many20/cocos2d-html5-howler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#cocos2d-html5-howler

###not compatible with cocos2d 3.x at the moment!

##Description

Extension of SimpleAudioEngine.js to use howler.js as Audio Engine.

Howler.js

howler on github

Howler uses the Web Audio API and the HTML5 Audio API as fallback. Why ist the Web Audio API better as the Audio API?

Web Audio is much more flexible and on the iPhone/iPad the Audio API is really bad.


TODO: make it compatible with cocos2d 3.x

##Use

add the 'howler.js' and 'HowlerAudioEngine.js' to your loader config


change in SimpleAudioEngine.js:

cc.AudioEngine.getInstance = function () {
if (!this._instance) {
    this._instance = new cc.AudioEngine();
    this._instance.init();
}
return this._instance;
};

to:

cc.AudioEngine.getInstance = function () {
if (sys.platform === "browser") {
    if (!this._instance) {
        this._instance = new cc.HowlerAudioEngine();
        this._instance.init();
    }
} else {
    if (!this._instance) {
        this._instance = new cc.AudioEngine();
        this._instance.init();
    }
}
return this._instance;
};

so the preloader can use howler

##License

Released under the MIT License.

About

Extension of SimpleAudioEngine.js to use howler.js as Audio Engine.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published