Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: onProcessSamples every 10ms  (Read 2345 times)

0 Members and 1 Guest are viewing this topic.

sparkzi

  • Newbie
  • *
  • Posts: 9
    • View Profile
onProcessSamples every 10ms
« on: November 16, 2012, 10:23:14 am »
Hello,
in sfml documentation i found that:
" .. You only have a single virtual function to override in your derived class: onProcessSamples. It is called everytime a new chunk of audio samples is captured, so this is where you implement your specific stuff.
Audio samples are provided to the onProcessSamples function every 100 ms. This is currently hard-coded into SFML and you can't change that (unless you modify SFML itself). This may change in the future. .."


this means that only line i have to change for custom time of calling onProcessSamples is in this function:
void SoundRecorder::record()
{
    while (m_isCapturing)
    {
        // Process available samples
        processCapturedSamples();

        // Don't bother the CPU while waiting for more captured data
        sleep(milliseconds(100));
    }

    // Capture is finished : clean up everything
    cleanup();

    // Notify derived class
    onStop();
}
 
?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: onProcessSamples every 10ms
« Reply #1 on: November 16, 2012, 10:35:11 am »
Yes. Don't be afraid to try directly ;)
Laurent Gomila - SFML developer