SFML community forums

Help => Audio => Topic started by: Sui on April 02, 2012, 12:28:35 pm

Title: Scrambled OGG
Post by: Sui on April 02, 2012, 12:28:35 pm
The license for the music I have in my game requires that I distribute the music in a scrambled form (i.e. not in standard OGG format).

Currently, in development, I am streaming OGG files for the music.

I need to use a scrambled file format to provide basic protection for the copyright of the music.

I can scramble and unscramble data no problem, as I have done this on prior (non SFML) projects. My question is, can I use the streaming functionality to play a non-standard file format, for example by unscrambling the data on the fly via a custom stream?

Alternatively, I can unscramble the OGG data into memory and play it from there. This would prevent streaming from disk - I would have to leave the Virtual Memory Manager to retrieve the data from disk pre-emptively if swapping occurs (not sure how well this would work in practice).

Hope this makes sense...

Thanks in advance.
Title: Re: Scrambled OGG
Post by: Laurent on April 02, 2012, 01:27:09 pm
Quote
My question is, can I use the streaming functionality to play a non-standard file format, for example by unscrambling the data on the fly via a custom stream?
It should work, yes. If your custom sf::InputStream provides data as an unscrambled OGG file (rather than decoded audio samples) you should even be able to use it with a sf::Music, ie. no need to write your own sf::AudioStream.
Title: Re: Scrambled OGG
Post by: Sui on April 02, 2012, 03:32:42 pm
Thanks Laurent.
I'll have a play with the streams.