SFML community forums
Help => Audio => Topic started by: 51423benam 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.
-
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...
-
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?
-
If you have an exception then you have a coding error, the expected behavior is for you to fix it. :D
-
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.