Sign in to follow this  
Yartch

Multiple Threads per Audio Voice

Recommended Posts

I'm just doing the audio part of my game engine, using XAudio2, which I have successfully implemented into other programs before. The previous times I've used it, every sound that was playing had it's own Source Voice, that ran on it's own thread to determine when it ended. I only tested up to 8 multiple voices, with no unsolved problems, and figured all was good.

Now that I'm thinking about doing this in a game engine, with a possible like 50 sounds playing at once, I'm getting worried that there will be too many threads running at once. These threads pretty much just start the sound, wait until it's done, then either loops it or flushes the voice. I'm not sure how much of a noob I'm sounding to people that know about multi-threading, but I hope I'm not breaking a few dozen laws.

So to sum it up nicely,

1. Is there a limit to how many threads can be running at once?
2. Does just having a lot of threads running slow things down, even if they're doing nothing but waiting?
3. Can someone point me to a good read on multi-threading in game engines? I haven't found anything that's worked for me.

Thanks!

Share this post


Link to post
Share on other sites
XAudio2 runs on its own internal thread so you dont need to create new threads to watch it. You start the sound and if you want to stop it later you can. Why would you need to create a thread per sound effect?

If you want the sound to run for a specific amount of time, then you start it, and each game loop, check if the sound should still be playing.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this