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

Author Topic: SoundStream custom buffersize  (Read 2716 times)

0 Members and 1 Guest are viewing this topic.

gRuFtY

  • Newbie
  • *
  • Posts: 4
    • View Profile
SoundStream custom buffersize
« on: February 29, 2016, 12:43:55 am »
So in this thread it is discussed, that SoundStreams always buffer 2 sec of the audio stream. For my use case this is way to much.
As the linked thread is a few months old, I'd like to ask if things have changed; is there an easy way of customizing the buffersize, maybe via the initialization? I'd love to stick to sfml-audio but I start believing I might have to switch to something lower level...

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: SoundStream custom buffersize
« Reply #1 on: February 29, 2016, 12:45:09 am »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

gRuFtY

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: SoundStream custom buffersize
« Reply #2 on: February 29, 2016, 01:09:55 am »
I know that tutorial, but it doesn't seem to helpful with my problem.

To give some more details which might help understand my problem: I'm developing a software for capturing 3DS equipped with capture boards. I already have the code working to read frames from the board and print them on screen. Now I've got the code running which gets the audio from the board - I get a few hundred samples per video-frame, raw 16bit stereo samples. I wrote a StreamSource which gets these samples and plays them just fine - but with a delay of about two seconds which I assume are the 2 seconds Laurent mentioned in the other thread - buffers. For this use case that delay is a no-go.

The tutorial doesn't seem to help me adjust the size of that buffers for my needs. Is there any way it can be done?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SoundStream custom buffersize
« Reply #3 on: February 29, 2016, 07:42:51 am »
In fact it's sf::Music that uses 2 seconds of buffer. sf::SoundStream doesn't impose such a limit: it's the derived class that chooses, implicitly with the amount of data given in the onGetData function. So it's really you who decides of the buffer size. Just keep in mind that there are 3 internal buffers: so while you fill one, there is one pending and one playing. So the latency is the size of two buffers, not one.
« Last Edit: February 29, 2016, 07:45:01 am by Laurent »
Laurent Gomila - SFML developer

 

anything