Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Announcements and Showcase
Music volume adjust

Robo
Guest
Quote
2019-10-25 02:49:46

If your are like me and didn't find a way to adjust music volume versus sound effects then here is you answer:

Attach two 3D sound nodes to your player - name one 'music' and the other 'soundFx'

You can now dynamically change the volume of either the music or sound effects in game using javascript:

This is not even mentioned in the CopperCube list of available selections in game - yet still works:

var s = ccbGetSceneNodeFromName("music"); // a 3D sound node attached to Player as a 2D sound
var snd = "attack1"; // whatever the sound file name is you want to change to at any time
var sound = "sounds/"+snd+".ogg" // fixed location of sounds in game directly under CopperCube directory
ccbSetSceneNodeProperty(s, "SoundFileName", sound);
ccbSetSceneNodeProperty(s, "Volume",vol);


karmacomposer
Registered User
Quote
2019-10-26 12:10:53

Very nice. Good code fragment to keep for CC.

Thank you.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Intern?tional" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact