sound question

hi there.

is it possible to load a sound and then play multiple instances of it simultaneously?

i heard this is possible, but i cant seem to get it to work. the sound simply starts over when i try to play it a second time before it finishes.

any advice would be appreciated.

The way to do this is to call loader.loadSfx() multiple times with the same filename. After the first time, it should return the same sound image from the internal cache, without actually reading the file again from the disk.

Each time you call loadSfx() on a given filename, you get a separate handle to the sound image that you can play independently of all the rest of the handles to the same sound image.

David

Is there a way to give a sign back to the main routine if a sound is played?

I am reading through the API reference manual but I am getting a bit lost there because you have no detailed search there… I have some of the methods, yes (like setVolume) but where do I get the WHOLE thing? I tried to search for “base” but there are a million things with that name in the ARM - and I looked for “loadMusic” to find a hint where to search in detail, but it doesn’t show the real needed name :cry:

Can you please tell me how I can get ALL “supported” commands of a module (in other words here: where to search for “base” to find all information about it?)?

Help really wanted :slight_smile:

Thx in advance…

Regards, Bigfoot29

The problem I have had is the fact that the .play()-command does not give a sign when it finishes playing… the easiest way to get a signal is using:

import time

self.musicFileTime = self.musicBoxSound.length() # for example - however you called 
                                               #it. I use the example from the docs
time.sleep (self.musicFileTime)

That stops the thread for exact that ammount of time and continues then with whatever code you give 'em :wink:

May be that you guru’s don’t need that help, but it was a hour’s work to get enough informations that led me to help (time.sleep) :wink: - and I guess there are more than one programmer that does his own first steps in the programming thing as a whole new universe :slight_smile:

Regards, Bigfoot29

Bigfoot29, Ive not tried this myself but would it not be better to setup a “do later task” ? This way your not pausing anything from working.


taskMgr.doMethodLater(delayTime, myFunction, 'Task Name')

Just an idea.

Rrrriiiiight… but I guess its nothing else at the end… plus: I wasn’t at “tasks” in the manual (nor am I now due to slow translation) - I took a look at it and yes, of course, it would work also. :slight_smile:

Thx Sandman

PS: Uh, and you need to import and run the taskMgr, I guess? :slight_smile:

In Audio Soiund APi i found this ;

setFinishedEvent(self, event)

virtual void AudioSound::set_finished_event(basic_string< char > const &event) = 0;
// Set (or clear) the event that will be thrown when the sound
// finishes playing. To clear the event, pass an empty string.

looks like it would do what you need, send an event when sound is finished…

Warning: not tested by myself…