Kraus Philipp
2012-07-27 14:51:40 UTC
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
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