ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Programming and Scripting
forum topic indicator Is it possible to loop the ccbPlaySound?
person icon
dekon_17
Registered User
Quote
2023-01-12 17:47:51

Probably hardest part of making my game is creating music (because I just can't do it right). So, I thought about using "ccbPlaySound" comand to implement the usage of custom music. Here's the problem though: it cannot be looped normally. I suppose that it would be fine if there would be a way to get the music length, so that, after a specified (by the length of track) period of time it would play it again. So, is there a way to get the length of, for example, MP3 file with available API of Coppercube or a "system" comand?

person icon
sven
Registered User
Quote
2023-01-12 19:15:15

MP3 files dont work for me.. but with WAV you can do ..

Add 3dSound Node to the scene first then name it snd..
In options set it playmode "nothing"
set PlayAs2D = true

EDITED:

ccbSetSceneNodeProperty(ccbGetSceneNodeFromName("snd"), "PlayMode","looping");
ccbSetSceneNodeProperty(ccbGetSceneNodeFromName("snd"), "SoundFileName","IonBronze.wav");
ccbPlaySound(ccbGetSceneNodeFromName("snd"));


It was a fast test because i was interested in this question also- may not work as expected and may not be the answer what you were looking for.

person icon
Guest
Guest
Quote
2023-01-12 19:57:52

I don't know why but I got some weird sound glitches doing it the way Sven did. Might be on my end though. I used an ogg file for this and it works. I just didn't set the name of the sound file in the editor and did it through code instead.

https://files.catbox.moe/6mxaoj....

person icon
dekon_17
Registered User
Quote
2023-01-13 11:38:00

Okay, I tried to use "3D sound" object, and it actually works. I thought it needs full path name at first, but now... Well, now, I suppose, not only I can implement usage of custom music, I can also separate sound options into general sound volume (system.soundvolume) and a music volume, which is also cool!

Thanks, sven.

By the way, cool music in your example, Guest.


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 |