|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Problem playing different sound using same source idHi,
I've just hit weird problem with OpenAL when trying to play sound using source which was previously used for playing different sound. I have installed latest OpenAL and got latest OpenAL SDK (1.1). The exact repro scenario is as follows: (1) initialize openal, allocate as many as possible source ids (2) grab first source id and play the sound A, wait till it finishes (3) use the same source id and play sound B <<== the sound doesn't play even though openal sais it being plays I can repeat (3) as many times as I want and the sound will never actually be heard. If I use another source id from allocated pool, then it plays. Sound A can be played again as many times as I want using first source id though. However if I play any sound while sound B is still supposed to play (and so, I need to use another source id), the sound B gets _unlocked_ and it can suddenly be heard from where it was supposed to be at that time. From now on I can play B as many times as I want. I have double checked I don't change _any_ source attributes like pitch / gain or other. This is the complete OpenAL calls that lead to problem: source0 is my source id bufferA and bufferB are two OpenAL sound buffers // Play sound A alSourcei(source0, AL_BUFFER, bufferA); alSourcePlay(source0); while (true) { ALint state; alGetSourcei(source0, AL_SOURCE_STATE, &state); if (state == AL_STOPPED) break; } alSourceStop(source0); alSourcei(source0, AL_BUFFER, 0); // Play sound B - won't play !!!! alSourcei(source0, AL_BUFFER, bufferB); alSourcePlay(source0); while (true) { ALint state; alGetSourcei(source0, AL_SOURCE_STATE, &state); if (state == AL_STOPPED) break; } alSourceStop(source0); alSourcei(source0, AL_BUFFER, 0); Thanks anyone for any help with that! |
|
|
Re: Problem playing different sound using same source idHi, Which OpenAL device are you opening? Which OS are you using, and which soundcard? I would recommend changing the way you are checking to see if a Source has finished playing from ... if (state == AL_STOPPED) ... to if (state != AL_PLAYING) ... (and if you support Pause / Resume) then it should be if ((state != AL_PLAYING) && (state != AL_PAUSED)) ... This is because some implementations set the state to AL_INITIAL when it is not playing anymore. I would also make sure that there were no errors set during any of these calls, and critically when creating and attaching audio data to bufferB. Dan Creative Labs (UK) Ltd. Notice The information in this message is confidential and may be legally privileged. It is intended solely for the addressee. Access to this message by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying or distribution of the message, or any action taken by you in reliance on it, is prohibited and may be unlawful. If you have received this message in error, please delete it and contact the sender immediately. Thank you. Creative Labs UK Ltd company number 2658256 registered in England and Wales at Belmont Road, Belmont Place, Maidenhead, Berkshire, SL6 6TB MaciejS <msawitus@... om> To Sent by: openal-devel@... openal-devel-boun m ces@... cc eative.com Subject [Openal-devel] Problem playing 02/02/2009 11:38 different sound using same source PM id Hi, I've just hit weird problem with OpenAL when trying to play sound using source which was previously used for playing different sound. I have installed latest OpenAL and got latest OpenAL SDK (1.1). The exact repro scenario is as follows: (1) initialize openal, allocate as many as possible source ids (2) grab first source id and play the sound A, wait till it finishes (3) use the same source id and play sound B <<== the sound doesn't play even though openal sais it being plays I can repeat (3) as many times as I want and the sound will never actually be heard. If I use another source id from allocated pool, then it plays. Sound A can be played again as many times as I want using first source id though. However if I play any sound while sound B is still supposed to play (and so, I need to use another source id), the sound B gets _unlocked_ and it can suddenly be heard from where it was supposed to be at that time. From now on I can play B as many times as I want. I have double checked I don't change _any_ source attributes like pitch / gain or other. This is the complete OpenAL calls that lead to problem: source0 is my source id bufferA and bufferB are two OpenAL sound buffers // Play sound A alSourcei(source0, AL_BUFFER, bufferA); alSourcePlay(source0); while (true) { ALint state; alGetSourcei(source0, AL_SOURCE_STATE, &state); if (state == AL_STOPPED) break; } alSourceStop(source0); alSourcei(source0, AL_BUFFER, 0); // Play sound B - won't play !!!! alSourcei(source0, AL_BUFFER, bufferB); alSourcePlay(source0); while (true) { ALint state; alGetSourcei(source0, AL_SOURCE_STATE, &state); if (state == AL_STOPPED) break; } alSourceStop(source0); alSourcei(source0, AL_BUFFER, 0); Thanks anyone for any help with that! -- View this message in context: http://www.nabble.com/Problem-playing-different-sound-using-same-source-id-tp21617947p21617947.html Sent from the OpenAL - Dev mailing list archive at Nabble.com. _______________________________________________ Openal-devel mailing list Openal-devel@... http://opensource.creative.com/mailman/listinfo/openal-devel ForwardSourceID:NT00068F9E _______________________________________________ Openal-devel mailing list Openal-devel@... http://opensource.creative.com/mailman/listinfo/openal-devel |
|
|
Re: Problem playing different sound using same source idHi Daniel,
Thanks for your suggestions. I'm sorry for delayed reply. (Un)fortunately described problem has suddenly disappeared after restarting PC and I couldn't reproduce it since then with exactly same code. Before restarting I spent few hours trying to create that simple case. And I did check all openal errors, there was none. So, now it's probably not worth investigating anymore. But anyway my details were: OS: Windows XP sound card: Realtek High Definition Audio (as part of Asus notebook) driver: OpenAL ver. 1.1 Renderer: Software Vendor: Creative Labs Inc. Thanks, Maciej
|
| Free embeddable forum powered by Nabble | Forum Help |