[Not a bug] Short pause playing an .ogg file
Moderator: George Gilbert
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- Trantor
- Duke of Banville
- Posts: 2466
- Joined: Wed Mar 09, 2005 4:16 am
- Location: Berlin, Germany
- Contact:
[Not a bug] Short pause playing an .ogg file
In order to try to reduce the size of my dungeon, I tried to convert my music files from .mp3 to .ogg files (which interestingly made some files bigger, but that's not the point).
When I step onto a tile that starts an .ogg music file, the game freezes shortly (about half a second maybe). If you step on the same tile later again, it works fine, the freezing only occurs when the music is played for the first time.
When I step onto a tile that starts an .ogg music file, the game freezes shortly (about half a second maybe). If you step on the same tile later again, it works fine, the freezing only occurs when the music is played for the first time.
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
OK, I had a look at this and it seems you're correct -- OGGs take a significant amount of noticeable time to decompress and RTC does indeed freeze during that time. I tried OGGs some time ago and don't recall this behaviour so I don't know what's changed.
MP3s on the other hand seem to load immediately (but remember they are no good for continuous looping sounds due to extra silence at the beginning and end of the file.)
Uncompressed WAVS should be the fastest, but they are actually really slow to load (slower than the OGG) as RTC loads the entire file before playing it and they are usually ten times the size of an MP3.
Verdict: stick to MP3!
MP3s on the other hand seem to load immediately (but remember they are no good for continuous looping sounds due to extra silence at the beginning and end of the file.)
Uncompressed WAVS should be the fastest, but they are actually really slow to load (slower than the OGG) as RTC loads the entire file before playing it and they are usually ten times the size of an MP3.
Verdict: stick to MP3!
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Actually Trantor, you reported this over a year ago and GG gave you a possible solution back then!
http://www.dungeon-master.com/forum/vie ... hp?t=26335
In addition, I think these days 15MB is not a big deal to download. Correct me if I'm wrong, but anyone serious about getting the best out of the 'net has moved to broadband. Even on a 1MB bb connection, 15Mb is not a pain to download, at least in my experience.
My custom scenarios will probably be hundreds of megabytes. I'm not worried about people not being able to get them.
http://www.dungeon-master.com/forum/vie ... hp?t=26335
In addition, I think these days 15MB is not a big deal to download. Correct me if I'm wrong, but anyone serious about getting the best out of the 'net has moved to broadband. Even on a 1MB bb connection, 15Mb is not a pain to download, at least in my experience.
My custom scenarios will probably be hundreds of megabytes. I'm not worried about people not being able to get them.
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
George's answer was that the problem probably wasn't RTC, but instead the Windows sound drivers or FMOD. However, DSB uses both FMOD and the Windows sound drivers and has no delays in playing ogg files. In addition, I've written other ogg-using programs and had no such delays.
So, I think there is something wrong with RTC, though I couldn't possibly hazard a guess what.
So, I think there is something wrong with RTC, though I couldn't possibly hazard a guess what.
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
Sadly, it's not that straightforward.Sophia wrote:George's answer was that the problem probably wasn't RTC, but instead the Windows sound drivers or FMOD. However, DSB uses both FMOD and the Windows sound drivers and has no delays in playing ogg files. In addition, I've written other ogg-using programs and had no such delays.
So, I think there is something wrong with RTC, though I couldn't possibly hazard a guess what.
There's a known bug in FMOD (reproducible with their own example code, not RTC) which means that some files don't load properly when loaded from memory (the sound is corrupted with clicks in it). To work around this bug, RTC first tries to load it from memory and then if it thinks it has failed, saves the memory stream to a temporary file and then loads the sound from file (which works).
The pause is simply the file access - so yes, it does come from RTC and it is possible to write a program without any pause, but it won't always work for every file you give it.
Hopefully the bug will soon be fixed (it's been with them for a year or so now), but there isn't anything I can do about it...once it is then the pause will go. In the meantime (as suggested in the other thread), simply trigger the sound at zero volume on entering the dungeon so that it's loaded and ready to go immediately when you really need it!
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Do you mean the bug applies to all sounds files or just OGG files?George Gilbert wrote:There's a known bug in FMOD (reproducible with their own example code, not RTC) which means that some files don't load properly when loaded from memory (the sound is corrupted with clicks in it). To work around this bug, RTC first tries to load it from memory and then if it thinks it has failed, saves the memory stream to a temporary file and then loads the sound from file (which works).
All the OGG files I recently tested exhibit this problem, as do Trantor's, so it seems that RTC thinks all our OGGs are corrupted when loaded in memory. Are they, or is RTC being a little unforgiving here?George Gilbert wrote:RTC first tries to load it from memory and then if it thinks it has failed...
Anyone got any experience of using lots of OGGS in DSB? Are they played back with clicks at any time? A comparison would be good.George Gilbert wrote:The pause is simply the file access - so yes, it does come from RTC and it is possible to write a program without any pause, but it won't always work for every file you give it.
How does one do that? -- I can't see any volume selector in RTCs sound objects?George Gilbert wrote:simply trigger the sound at zero volume
Based on what you wrote above, this won't guarantee that the file didn't get corrupted in memory, so you're back to square one, surely?George Gilbert wrote:loaded and ready to go immediately when you really need it!
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
- The corruption occurs when you have the sound file in memory (e.g. after extracting it from an RTC file) and then pass that memory to FMOD.Gambit37 wrote:Based on what you wrote above, this won't guarantee that the file didn't get corrupted in memory, so you're back to square one, surely?George Gilbert wrote:loaded and ready to go immediately when you really need it!
- The corruption does not occur if you have the sound file in memory, save that memory to a temporary file and then pass the name of the temporary file to FMOD (so it can load it into memory itself).
RTC always does the latter to always avoid the bug in FMOD (but this means there's a slight pause).
All that said, I've only ever seen the bug occur with some types of files (not including OGGs), so what I can do is to pass the memory straight to FMOD if it's an OGG and go via a temporary file if it's not. Not ideal, but it will get rid of an unnecessary pause for some files...
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
Done for V0.50George Gilbert wrote:All that said, I've only ever seen the bug occur with some types of files (not including OGGs), so what I can do is to pass the memory straight to FMOD if it's an OGG and go via a temporary file if it's not. Not ideal, but it will get rid of an unnecessary pause for some files...