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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Raptormeat

Pages: [1]
1
Audio / Re: AW: Music popping while playing encrypted OGG files
« on: September 20, 2016, 03:48:15 am »
At high CPU utilization it might also be that the music thread isn't getting enough CPU time.

Thanks for writing back! If this is the issue, is there anything I can do about it? Is there something like a buffer size I can increase?

I had seen elsewhere that Laurent posted that the music has a 1 second buffer. Is it possible that SFML waits long enough to replenish this buffer that a few miliseconds might make a difference?

Quote
IMO your decryption algorithm may be too slow, could you post it and some encrypted ogg file?

It's possible. Basically how it works is in my filestream's read() function, I call std::fread() to load up the desired amount of data, then I run through it and XOR it with a (looping) array of pre-computed values. Sounds pretty simple but who knows.

2
Audio / Music popping while playing encrypted OGG files
« on: September 18, 2016, 01:41:14 am »
Hey there! Thanks again for this great library! I have a game which uses SFML for audio, and I've had this odd problem for a few years now where the music makes a cracking / popping sound randomly.

The music is encoded in OGG files which are decrypted using a custom sf::InputStream as far as I can tell nothing is out of the ordinary there.

The weird thing is that this problem seems to be made worse with high CPU load. My game is eating up a lot of cycles, I guess. If I "relax" the CPU usage by calling Sleep() every once in a while, the problem is made better. Users with lower-spec machines tell me the problem is worse for them.

Can anyone help think of reasons why this could possibly be happening? I know that there is a problem with OGG files needing normalization, but I'm not sure if that's my problem as it doesn't sound random or affected by CPU load the way my issue does.

3
Update: I have found that, instead of just stopping the sf::Music object, if I delete it and recreate it, then there is no hang. Previously the music object was stack-allocated and I just reused it for every song.

Still no idea why I was getting the hang. I'm trying to figure out whether I had screwed something up, but the interface is so simple it's hard to know what that might be.

4
Audio / Hang when playing second music with an sf::InputStream with 2.4
« on: August 26, 2016, 01:01:04 am »
I have a game that has been using SFML for a few years now (thank you!). I just upgraded to 2.4 (from 2.2) and I'm experiencing a new problem.

I have a custom sf::InputStream subclass which loads up encrypted music data from a stream and decrypts it for the audio system to play. This was working before the upgrade.

I have a single sf::Music object which I use to play all of my music. When one song is complete or I want to switch, I stop the music, close the input stream, then open a new file using the same stream and play the stream using the same music object.

So, when I start the game, the first music (the title music) plays just fine. However when I start gameplay and the title music switches to another song, the game freezes. Putting some breakpoints in the InputStream, I can see that read() is called a few times to load up some data. However then seek( 0 ) is called forever. The call to openFromStream() never returns and the program hangs.

Anyway I fully understand that this is probably an obscure problem on my end, but considering it was a new problem I thought it might be worth posting in case it was a known issue.

Pages: [1]