Ninjadoodle Posted November 3, 2014 Share Posted November 3, 2014 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! Quote Link to comment Share on other sites More sharing options...
Stephan Posted November 3, 2014 Share Posted November 3, 2014 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. Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted November 3, 2014 Author Share Posted November 3, 2014 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! Quote Link to comment Share on other sites More sharing options...
enpu Posted November 4, 2014 Share Posted November 4, 2014 Might got something to do with HTML5 Audio (CocoonJS doesn't support Web Audio), i will take a look asap. Ninjadoodle 1 Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted November 4, 2014 Author Share Posted November 4, 2014 Hi @enpu Thank you for checking it out! Quote Link to comment Share on other sites More sharing options...
enpu Posted November 4, 2014 Share Posted November 4, 2014 Can you try now with latest develop branch? And can you show your code on your music/sound on/off buttons Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted November 4, 2014 Author Share Posted November 4, 2014 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(); } } Quote Link to comment Share on other sites More sharing options...
enpu Posted November 4, 2014 Share Posted November 4, 2014 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(); }} Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted November 4, 2014 Author Share Posted November 4, 2014 Hi @enpu Just tried this and it seems to work in Canvas+, I also tried the same with sound, but I don't think you have implemented that method yet as it crashes. Quote Link to comment Share on other sites More sharing options...
enpu Posted November 4, 2014 Share Posted November 4, 2014 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(); }} Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted November 4, 2014 Author Share Posted November 4, 2014 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!! Quote Link to comment Share on other sites More sharing options...
enpu Posted November 4, 2014 Share Posted November 4, 2014 Use these variables:game.audio.soundMutedgame.audio.musicMuted Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted November 4, 2014 Author Share Posted November 4, 2014 Hi @enpu Thank you heaps! You are seriously awesome ... it works perfectly now I really appreciate all your help!!! Quote Link to comment Share on other sites More sharing options...
enpu Posted November 4, 2014 Share Posted November 4, 2014 Great!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.