Jump to content

Cocoon JS Sound Issues


Ninjadoodle
 Share

Recommended Posts

Hi guys

 

I've been playing with Cocoon Js trying to get my game ready for devices, but I'm having troubles with the sound.

 

- Music/Sound On/Off buttons don't work (i'm assuming this is a Cocoon issue as they work perfectly well on the web).

 

- Cocoon Js only seems to play one Sound Effect at a time, if you try to play a second one, it just doesn't play.

 

I'm wondering if anyone has had any experience with this and whether there might be any solutions?

 

Thank you heaps in advance!

Link to comment
Share on other sites

I have ported several apps with cocoonjs to ipad and android. (Unfortunately they were not programmed in panda but

CocoonJS had support for multichannel sound and i have had it working in my apps just fine without any extra ajustments.

If you want to I can run a quick test for you with panda in my environment.

Link to comment
Share on other sites

Hi @Stephan

 

Thank you for your offer. I'll try and play around some more, so not to waste your time :)

If I still can't get it working, I will put a little test together.

 

Did you by any chance manage to make On/Off sound/music buttons that work?

 

Right now, if I click mine (which work on the web), the code obviously crashes somewhere, as their tweens don't complete and they just remain de-pressed without the sound changing.

 

Thank you again!

Link to comment
Share on other sites

Hi @enpu

 

I've tried with the latest develop version and still the same issue.

 

I've had a look into Cocoon JS some more and it seems that this problem only occurs with Canvas+ (it works with Webview+)

 

The message from Ludei says - "Canvas+ can only render HTML5 canvas elements" not sure whether this is relevant?

 

Sorry, I'm new to this whole wrapper thing :(

 

Here is the on/off code I use (works on web and in webview+)

buttonMusic.click = buttonMusic.tap = function() {            buttonMusic.scale.set(0.75, 0.75);            game.tweenEngine.stopTweensForObject(buttonMusic.scale);            if (game.audio.musicVolume > 0) {                game.audio.setMusicVolume(0);                buttonMusic.alpha = 0.5;                game.scene.addTween(buttonMusic.scale, {x:1, y:1, alpha:0.5}, 250, {delay:0, easing:'Back.Out'}).start();            } else {                game.audio.setMusicVolume(1);                buttonMusic.alpha = 1;                game.scene.addTween(buttonMusic.scale, {x:1, y:1, alpha:1.0}, 250, {delay:0, easing:'Back.Out'}).start();            }        }        buttonSound.click = buttonSound.tap = function() {            buttonSound.scale.set(0.75, 0.75);            game.tweenEngine.stopTweensForObject(buttonSound.scale);            if (game.audio.soundVolume > 0) {                game.audio.setSoundVolume(0);                buttonSound.alpha = 0.5;                game.scene.addTween(buttonSound.scale, {x:1, y:1, alpha:0.5}, 250, {delay:0, easing:'Back.Out'}).start();            } else {                game.audio.setSoundVolume(1);                buttonSound.alpha = 1;                game.scene.addTween(buttonSound.scale, {x:1, y:1, alpha:1.0}, 250, {delay:0, easing:'Back.Out'}).start();            }        }
Link to comment
Share on other sites

Can you try this with latest develop branch:

buttonMusic.click = buttonMusic.tap = function() {    buttonMusic.scale.set(0.75, 0.75);    game.tweenEngine.stopTweensForObject(buttonMusic.scale);    if (game.audio.toggleMusic()) {        buttonMusic.alpha = 0.5;        game.scene.addTween(buttonMusic.scale, { x: 1, y: 1 }, 250, { easing:'Back.Out' }).start();    } else {        buttonMusic.alpha = 1;        game.scene.addTween(buttonMusic.scale, { x: 1, y: 1 }, 250, { easing:'Back.Out' }).start();    }}
Link to comment
Share on other sites

Hmm should not crash, you tried like this?

buttonMusic.click = buttonMusic.tap = function() {    buttonMusic.scale.set(0.75, 0.75);    game.tweenEngine.stopTweensForObject(buttonMusic.scale);    if (game.audio.toggleMusic()) {        buttonMusic.alpha = 0.5;        game.scene.addTween(buttonMusic.scale, { x: 1, y: 1 }, 250, { easing:'Back.Out' }).start();    } else {        buttonMusic.alpha = 1;        game.scene.addTween(buttonMusic.scale, { x: 1, y: 1 }, 250, { easing:'Back.Out' }).start();    }}buttonSound.click = buttonSound.tap = function() {    buttonSound.scale.set(0.75, 0.75);    game.tweenEngine.stopTweensForObject(buttonSound.scale);    if (game.audio.toggleSound()) {        buttonSound.alpha = 0.5;        game.scene.addTween(buttonSound.scale, { x: 1, y: 1 }, 250, { easing:'Back.Out' }).start();    } else {        buttonSound.alpha = 1;        game.scene.addTween(buttonSound.scale, { x: 1, y: 1 }, 250, { easing:'Back.Out' }).start();    }}
Link to comment
Share on other sites

Hi @enpu

 

Sorry, I missed a variable name change, that was causing the crash. It works now :)

 

Is there a way to check whether the music / sound is off / on?

 

I need to set the sound button graphics to off or on when changing scenes and I used to check whether the sound volume was 0, but that doesn't seem to work anymore.

 

Thank you very much for adding these methods!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...