Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
how work with sound in js

random_guy
Guest
Quote
2022-08-24 10:23:04

how load and play sound with js?


coa
Registered User
Quote
2022-08-24 10:47:30

there is a ccbPlaySound and ccbStopSound command

you can read more about it in CC docs


random_guy
Guest
Quote
2022-08-24 16:00:59

wrote:
there is a ccbPlaySound and ccbStopSound command

you can read more about it in CC docs


man, i'm dumb but not stupid...there nothing more in documentation, i cant play sound ccbPlaySound(filename) i use name file like "data/sound/somesound.wav" and nothing is happen no sound, no debug console message, nothing. what i do wrong??


coa
Registered User
Quote
2022-08-24 16:17:07

just trying to help ..

i dont know why it does not play maybe the path is wrong


Guest
Guest
Quote
2022-08-24 21:40:59

uhh...

Try using backslashes?

"data\sound\somesound.wav"

But that might be stupid, not dumb.


Guest
Guest
Quote
2022-08-24 22:33:22

This works: ccbPlaySound("Content\\ding.wav");

This works: ccbPlaySound("Content/ding.wav");

This works:

var path = "Content\\ding.wav";

ccbPlaySound(path);

This works:

var path = "Content/ding.wav";

ccbPlaySound(path);

All depends on how you want to do it.

Backslashes are more readable.


samgrady
Registered User
Quote
2022-08-26 03:13:24

you not dumb you really stupid, don't use ccbPlaySound function just create sound in cc and change property like "Volume" to 0 if you need stop sound or 100 if sound be played


random_guy
Guest
Quote
2022-09-11 20:34:20

samgrady it was helpful, so i use two function now:
function playSound(name){
ccbSetSceneNodeProperty(ccbGetSceneNodeFromName(name),"PlayMode","nothing");
ccbSetSceneNodeProperty(ccbGetSceneNodeFromName(name),"PlayMode","play_once");
}
function stopSound(name){
ccbSetSceneNodeProperty(ccbGetSceneNodeFromName(name),"PlayMode","nothing");
}


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (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