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

Author Topic: SoundStream for real-time audio  (Read 1928 times)

0 Members and 1 Guest are viewing this topic.

natinusala

  • Newbie
  • *
  • Posts: 25
    • View Profile
SoundStream for real-time audio
« on: May 01, 2015, 03:02:19 pm »
Hello,

In my project I need to be able to play "real time" sound (approx. 1100 samples per frame, at approx. 30fps). I tried the SoundStream class you provide ; it works, but the onGetData is not fast enough because I need to create a fifo queue and push/pop my samples while waiting for the stream to require them. The result is a late audio compared to the video (it's supposed to be syncd) ; from time to time there is a little throttle and it gets late, the more I play the more it's late.

So here is my question : how could I fix that ? I think that I need to edit SoundStream to make it a push-based system instead of a pull-based. Instead of requiring the chunks every times needed, it lets me fill the buffers on my own (at each frame). There would be no more need for a fifo queue and I think it would be fast enough and more synchronized.

Could you help me ?

Thanks !

natinusala

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: SoundStream for real-time audio
« Reply #1 on: May 01, 2015, 09:08:12 pm »
Nevermind, I did it using ALSA and a separate thread, it works well. You can delete or lock this thread if you want to :)