ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator Is there a way to loop sound when using an external sound file?
person icon
guest_edkeyte
Guest
Quote
2026-01-11 01:11:19

Is there a way to loop sound when using an external sound file?

Eg like this but with a way to loop the sound:


// Play sound when entering the zone

if (typeof this._played === "undefined") {
this._played = true;
ccbPlaySound("sound/test.wav");
}


person icon
dekon_17
Registered User
Quote
2026-01-11 14:35:12

Don't think it's possible with this command. However, you can do something else, although it will be a bit more complex.

Instead of using ccbPlaySound, add a sound node, and, when you need to play that external sound, do something like this:
...
if (!this._played){
this._played = true;
ccbSetSceneNodeProperty (ccbGetSceneNodeFromName ([sound node name]), 'SoundFileName', "sound/test.wav");
}
...

Had to use something like that myself, due to the fact that you can't control sound volume and play mode of a ccbPlaySound.

person icon
guest_edkeyte
Guest
Quote
2026-01-12 23:13:50

That's excellent. Thank you so much. Really, really helpful.

person icon
guest_Robbo
Guest
Quote
2026-01-17 09:57:35

You can use this type of code:

get fixed 3D sound node - "SndVoiceN"
var vol = 80; // change volume as you like when playing also
var snd = "data/music.ogg";

ccbSetSceneNodeProperty(SndVoiceN, "PlayMode", "nothing");
ccbSetSceneNodeProperty(SndVoiceN, "SoundFileName", snd);
ccbSetSceneNodeProperty(SndVoiceN, "Volume", vol);
ccbSetSceneNodeProperty(SndVoiceN,"PlayMode","play_once");

can change from "play_once" to "looping" to keep playing.


Create reply:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






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