OpenAL + SDL Woes... I think

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
Aleios
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 78
Joined: Mon Feb 21, 2011 2:55 am
Current Project: Aleios Engine
Favorite Gaming Platforms: PC, Dreamcast
Programming Language of Choice: C++
Location: Melbourne, Australia

OpenAL + SDL Woes... I think

Post by Aleios »

Hey guys,

Recently i added support for streaming ogg vorbis audio into OpenAL. This seemed to all work well, but then i moved the window. The issue im having seems to be the fact that windows likes to pause the main thread whilst the window position is being altered. My basis for this theory is the fact that my rendering (via OpenGL) seems to be paused as well during the move. How i did not notice that before, i have no idea. So my question is whether or not i should be running OpenAL on a different thread (shoot me) or i should try to find some way to keep the buffers from screwing themselves over (yet again shoot me)?

In case anyone wishes to know, i am running Windows Vista x64, and i have not tested this on my Linux installation.

Also, I mainly followed this tutorial: http://www.devmaster.net/articles/opena ... esson8.php

Thanks.
Image
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: OpenAL + SDL Woes... I think

Post by Falco Girgis »

I have no experience with OpenAL, but I'm aaaaalmost positive that it is handling threading for you.

Unless you are making some update call to OpenAL once per frame in your update loop for audio processing, this has to be the case.
Aleios
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 78
Joined: Mon Feb 21, 2011 2:55 am
Current Project: Aleios Engine
Favorite Gaming Platforms: PC, Dreamcast
Programming Language of Choice: C++
Location: Melbourne, Australia

Re: OpenAL + SDL Woes... I think

Post by Aleios »

Yep, it took me about 1 hour of looking at my screen to realize that my Update() function is on the main thread, of which is being paused. So the fact that Update() could not be called also meant that my ogg streaming would stop processing making it think "oh audio has ended cool." So i realize all i have to do is either:

1) make the audio processing run on a different thread or
2) recall the Play function.

#1 would make the audio run constantly whereas #2 would make the audio (and graphics) pause for the duration of window movement. To be honest, i could care less if the audio stops for a bit since the rest of the program will anyway, unless i decide to thread the graphics and logic processing as well, of which i don't feel like doing since it seems unnecessary. So problem solved... sort of :P
Image
Post Reply