Philipp Kraus
2012-08-09 14:14:09 UTC
Hello,
I have got this code for capturing mono 8 bit data, the code works
without any error:
m_device = alcCaptureOpenDevice( p_device.c_str(),
static_cast<ALCuint>(p_sampingfrequency), AL_FORMAT_MONO8,
static_cast<ALCsizei>(p_buffersize));
ublas::vector<ALubyte> l_buffer(m_buffersize);
alcCaptureStart(m_device);
while(m_capturing)
{
alcGetIntegerv(...)
l_samplesread = std::min(
static_cast<std::size_t>(l_samplesread), l_buffer.size()-i);
alcCaptureSamples(m_device, (ALCvoid*)(&l_buffer[i]), l_samplesread);
}
If I switch the the AL_FORMAT_MONO8 to AL_FORMAT_STEREO8 and change the
p_buffersize to 2*p_buffersize & m_buffersize to 2*m_buffersize the
code crashes
on the alcCaptureSamples line and the buffer is not filled. IMHO the
left channel should be the even elements in the l_buffer and the right
the odd ones, so if I create
a double size buffer each l_buffer block should be started with the
left channel data. If I disable the alcCaptureSample call, the correct
number of samples are received.
Can anybody help me please to create the correct stereo working option?
Thx
Phil
I have got this code for capturing mono 8 bit data, the code works
without any error:
m_device = alcCaptureOpenDevice( p_device.c_str(),
static_cast<ALCuint>(p_sampingfrequency), AL_FORMAT_MONO8,
static_cast<ALCsizei>(p_buffersize));
ublas::vector<ALubyte> l_buffer(m_buffersize);
alcCaptureStart(m_device);
while(m_capturing)
{
alcGetIntegerv(...)
l_samplesread = std::min(
static_cast<std::size_t>(l_samplesread), l_buffer.size()-i);
alcCaptureSamples(m_device, (ALCvoid*)(&l_buffer[i]), l_samplesread);
}
If I switch the the AL_FORMAT_MONO8 to AL_FORMAT_STEREO8 and change the
p_buffersize to 2*p_buffersize & m_buffersize to 2*m_buffersize the
code crashes
on the alcCaptureSamples line and the buffer is not filled. IMHO the
left channel should be the even elements in the l_buffer and the right
the odd ones, so if I create
a double size buffer each l_buffer block should be started with the
left channel data. If I disable the alcCaptureSample call, the correct
number of samples are received.
Can anybody help me please to create the correct stereo working option?
Thx
Phil