Added SoundRecorder::setProcessingInterval (#333)

This commit is contained in:
Laurent Gomila 2013-08-11 19:39:52 +02:00
parent 5624948042
commit b9d0295c89
2 changed files with 42 additions and 8 deletions

View file

@ -45,9 +45,10 @@ namespace sf
{
////////////////////////////////////////////////////////////
SoundRecorder::SoundRecorder() :
m_thread (&SoundRecorder::record, this),
m_sampleRate (0),
m_isCapturing(false)
m_thread (&SoundRecorder::record, this),
m_sampleRate (0),
m_isCapturing (false),
m_processingInterval(sf::milliseconds(100))
{
priv::ensureALInit();
}
@ -128,6 +129,13 @@ bool SoundRecorder::isAvailable()
}
////////////////////////////////////////////////////////////
void SoundRecorder::setProcessingInterval(sf::Time interval)
{
m_processingInterval = interval;
}
////////////////////////////////////////////////////////////
bool SoundRecorder::onStart()
{
@ -152,7 +160,7 @@ void SoundRecorder::record()
processCapturedSamples();
// Don't bother the CPU while waiting for more captured data
sleep(milliseconds(100));
sleep(m_processingInterval);
}
// Capture is finished : clean up everything