Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
Is ISoundEngine threadsafe?

oogst
Registered User
Quote
2013-10-15 13:21:23

To what extend is ISoundEngine threadsafe? I would like to call addSoundSourceFromMemory and removeSoundSource from a separate thread, while the main thread in the meanwhile is still doing all kinds of things, like calling functions like play2D and ISound::drop / getSoundEffectControl / setPlaybackSpeed / setIsPaused / etc. Is Irrklang threadsafe for this, or will I need to use mutexes to keep my main thread from calling these functions during addSoundSourceFromMemory and removeSoundSource?

(Background: I have a lot of short voice samples that I want to be able to play a lot without accessing the harddisk all the time, but which set of voices is needed depends on who is in the match. Since I have several hundreds of megabytes of short voice samples, I don't want them all in memory at once. So when one class leaves and another class joins, I want to unload the old class' voice samples and load the new class' voice samples. Sound files are packed into big custom files that I load and then pass on to Irrklang using addSoundSourceFromMemory .)


niko
Moderator
Quote
2013-10-16 07:54:24

In what you describe, it is not threadsafe, you would have to ensure that it is always called from the same thread where it was created from. irrKlang was designed to be used from a single threaded app, and uses up to 5 own threads internally, but you could try out, maybe it also works if you access it from multiple threads while ensuring that no calls are overlapping.


oogst
Registered User
Quote
2013-10-16 11:15:15

Okay, thanks, that's clear! I'll make sure to only call it from my main thread then. :)


Create reply:


Posted by: (you are not logged in)


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