[Openal-devel] Waveform and queued buffers

-Tobias- superplus at gmx.net
Thu Oct 23 23:09:36 PDT 2008


Hi,

meanwhile, I switched to the ALUT routines to generate sound which works
fine. No I still have the problem to change the queue content - I hear the
sound (2 different buffers), but when I try to remove the last played one, I
always get the information that there are no processed buffers...

mexPrintf("Initializing OpenAL...");
    if (!alutInit (NULL, NULL))
    {
        mexPrintf("Failed to initialize OpenAL\n");
        return;
    }else
        mexPrintf("done!\n");
    
    uiBuffers[0] = alutCreateBufferWaveform(ALUT_WAVEFORM_SINE, 60.0, 0.0,
0.1);
    uiBuffers[1] = alutCreateBufferWaveform(ALUT_WAVEFORM_SINE, 100.0, 0.0,
0.1);
    
    alGenSources( 1, &uiSource );
    
    alSourceQueueBuffers(uiSource,2,uiBuffers);
    alSourcei(uiSource, AL_LOOPING, AL_TRUE);
    alSourcePlay( uiSource );
    
    Sleep(1000);
    
    alGetSourcei(uiSource, AL_BUFFERS_QUEUED, &processed);
    mexPrintf("Number of loaded buffers: %i\n",processed);
    
    alGetSourcei(uiSource, AL_BUFFERS_PROCESSED, &processed);
    mexPrintf("Number of processed buffers: %i\n",processed);
    while(processed--)
    {
        ALuint buffer;
        mexPrintf("Unqueuing buffers...");
        alSourceUnqueueBuffers(uiSource, 1, &buffer);
        mexPrintf("done!\n");
        mexPrintf("Generate waveform...");
        uiBuffer = alutCreateBufferWaveform(ALUT_WAVEFORM_SINE, 1000.0, 0.0,
0.1);
        mexPrintf("done!\n");
        mexPrintf("Queuing buffers...");
        alSourceQueueBuffers(uiSource, 1, &buffer);
        mexPrintf("done!\n");
    }

Output:
Initializing OpenAL...done!
Number of loaded buffers: 2
Number of processed buffers: 0

What's the problem here?

Thanks a lot and best regards,

Tobias

-- 
View this message in context: http://www.nabble.com/Waveform-and-queued-buffers-tp20127480p20133611.html
Sent from the OpenAL - Dev mailing list archive at Nabble.com.



More information about the Openal-devel mailing list