[Openal] openAL threading issues?

Daniel PEACOCK dpeacock at creativelabs.com
Thu Jun 7 10:06:44 PDT 2007





Hi,

I don't see any reason why this shouldn't work.    Which OpenAL device are
you opening?  You can find this out by calling alcGetString(deviceID,
ALC_DEVICE_SPECIFIER) after the call to alcOpenDevice(NULL).   Do you have
up-to-date OpenAL components and soundcard drivers?

Dan

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.




                                                                           
             uray meiviar                                                  
             <uraymeiviar at yaho                                             
             o.com>                                                     To 
             Sent by:                  openal at opensource.creative.com      
             openal-bounces at op                                          cc 
             ensource.creative                                             
             .com                                                  Subject 
                                       [Openal] openAL threading issues?   
                                                                           
             06/06/2007 07:13                                              
             PM                                                            
                                                                           
                                                                           
                                                                           




consider the following codes :

ALuint source        = 0;
ALint  sourceState   = 0;
bit isrun = false;

DWORD WINAPI althread(LPVOID params)
{
    while( isrun ) {
        alGetSourcei( source, AL_SOURCE_STATE, &sourceState);
        if(sourceState != AL_PLAYING) {
            alSourcePlay( source );
        }
    }
    return 0;
}

void main(void)
{
    // -------- as usual rituals :
    // alcOpenDevice(NULL);
    // alcCreateContext(..)
    // alcMakeContextCurrent(..)
    // alGenBuffers(..)
    // loadWAV()
    // alBufferData(..)
    // alGenSources(..)
    // alSourcei(..,AL_BUFFER,..)

    isrun = true;
    HANDLE thread = CreateThread(NULL,0,althread,NULL,0,NULL);
    _getch();
    isrun = false;
    WaitForSingleObject(thread,INFINITE);

    // alSourceStop(..)
    // alSourcei( .., AL_BUFFER, NULL )
    // alDeleteSources(..)
    // alDeleteBuffers(..)
    // alcMakeContextCurrent(NULL)
    // alcDestroyContext(..)
    // alcCloseDevice(..)
}

sometimes the sound is played and sometime not, but no errors returned from
all AL calls, i don't know if it is openAL threading issues or what,
because if don't call openAL func. in different thread the sound is always
played. what's wrong?

You snooze, you lose. Get messages ASAP with AutoCheck
in the all-new Yahoo! Mail Beta.
_______________________________________________
Openal mailing list
Openal at opensource.creative.com
http://opensource.creative.com/mailman/listinfo/openal

ForwardSourceID:NT00042276



More information about the Openal mailing list