blocking / non-blocking capturing

Kraus Philipp <[email protected]> Fri, 27 Jul 2012 16:51:40 +0200
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
Hello,

I'm new with OpenAL and I would like to record data to analyse the frequency of the data samples. I'm using also C++.
So my first question is: Exists a blocking capture function?

So at the moment I would like to read the record samples like this:
    boost::shared_ptr<ALint> l_buffer( new ALint[p_buffersize] );
    while (m_capturing) {
        
        std::size_t i=0;
        while (i < p_puffersize)
        {
                AlUInt l_samplesread = 0;
                alcGetIntegerv(mydevice, ALC_CAPTURE_SAMPLES, &l_samplesread); 
                if (l_samplesread > 0) {
                    alcCaptureSamples(mydevice, (ALCvoid*)l_buffer+i, l_samplesread);
                    i += l_samplesread;
                }
            
            // wait for other threads
            boost::this_thread::yield();
        }

        ... do something with the buffer....
     }

So can I substitute the inner while loop with an alc-call like this alcReadFull(mydevice, buffer, buffersize),
so that I can get the full-filled buffer after the call (blocked call)?

Is my example correct to read the data? This loops are within a thread, so after the data is received I normalized
the data in [-1,1], so I think audio that will get by the device are not cached.

Can anybody help me to create a correct working example

Thanks

Phil

_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal