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

Author Topic: Soundstream onGetData() is called only once  (Read 3867 times)

0 Members and 1 Guest are viewing this topic.

51423benam

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Soundstream onGetData() is called only once
« on: June 18, 2018, 03:50:36 pm »
Hey guys,

I wrote a custom Soundstream-derived class which is steered from outside. The problem is, I am cout-ing "ONGETDATA HAS BEEN CALLED" every time it is called, but in the main program is only outputs it once. Do you know a reason for that? My onGetData function gets it data from another class called AudioManager. And now, you might ask, if it has data and so on, but I am already checking that. In ongetData(), I am also cout-ing the sum of every buffer (which ligns up with the expected) and of course, returning true to continue playing. I connected it to a class which reads a file and pushes the buffers through a connection to the AudioManager.
I made sure it works, also, the sum of the buffers in the in- and output is the same, so the connection is not a problem either. The program just exits after about 2.5 seconds (although the file lasts 5 seconds) and onGetData() is called only once. Do you know a possible reason for the whole thing?

Btw: I know you want to have code  ;), but it is split across several files which is likely meaningless for you.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10800
    • View Profile
    • development blog
    • Email
Re: Soundstream onGetData() is called only once
« Reply #1 on: June 18, 2018, 04:03:47 pm »
Btw: I know you want to have code  ;), but it is split across several files which is likely meaningless for you.
Then create a minimal example that reproduces the issue. You just might find the issue on your own while doing so.

Otherwise we can just ask random questions and make guesses...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

51423benam

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: Soundstream onGetData() is called only once
« Reply #2 on: June 19, 2018, 10:41:47 pm »
Ok, maybe I know why. I get an exception in a funtion onGetData calls (a segfault). I try to reproduce it simple, but that's not easy... what would be the expected behaviour of a soundstream when there is a exception? Does is just cancel playback?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10800
    • View Profile
    • development blog
    • Email
Re: Soundstream onGetData() is called only once
« Reply #3 on: June 19, 2018, 10:50:44 pm »
If you have an exception then you have a coding error, the expected behavior is for you to fix it. :D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

51423benam

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: Soundstream onGetData() is called only once
« Reply #4 on: August 09, 2018, 04:34:58 pm »
The problem still exists, but this time I don't get any message of the debugger of an error / segfault. Everything seems to work, but onGetData is only called like 3 or 4 times.

 

anything