Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:
Ambiera Forum > CopperCube > Announcements and Showcase
Music volume adjust
Author Text

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);

Registered User
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: "Int?rnational" (you are not logged in)




Forum Codes

Feature Code
Link [url] [/url]
Bold [b]bold text[/b]
Image [img][/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]