[Not a bug] Short pause playing an .ogg file

Things in RTC that do not work as expected (compared to Dungeon Master) or at all! Please read previous posts carefully to see if the bug has already been reported.

Moderator: George Gilbert

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
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

Post by Trantor »

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.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

Not a bug, it's the time taken to decompress the file...

What's your PC spec? I've never noticed RTC 'freeze' as such during decompression of sounds, just that they start a bit later than expected.
User avatar
Trantor
Duke of Banville
Posts: 2466
Joined: Wed Mar 09, 2005 4:16 am
Location: Berlin, Germany
Contact:

Post by Trantor »

My machine certainly isn't the newest, it's a Pentium 4 with 3 GHz and 1 GB Ram. Still, I am quite surprised that the whole game freezes for a notable amount of time on my machine. I don't have any such problems with mp3 files in my dungeon.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

Much more powerful than mine. Hmm... I'll have to check this again then, I don't recall OGGs being that problematic and my current test dungeons don't have any OGGs in them.

I'll report back if I experience the same behaviour.
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

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!
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

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.
User avatar
Sophia
Concise and Honest
Posts: 4239
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

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.
User avatar
Trantor
Duke of Banville
Posts: 2466
Joined: Wed Mar 09, 2005 4:16 am
Location: Berlin, Germany
Contact:

Post by Trantor »

Whoa, cool, Alzehimer got me. :roll:

I'm sorry for bringing up this old issue again.
User avatar
George Gilbert
Dungeon Master
Posts: 3022
Joined: Mon Sep 25, 2000 11:04 am
Location: London, England
Contact:

Post by George Gilbert »

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.
Sadly, it's not that straightforward.

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. :cry:

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!
User avatar
linflas
My other avatar is gay
Posts: 2445
Joined: Tue Nov 04, 2003 9:58 pm
Location: Lille, France
Contact:

Post by linflas »

i never realized that because there is a "fade in" effect for all musics i use :)
User avatar
Gambit37
Should eat more pies
Posts: 13714
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Post by Gambit37 »

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).
Do you mean the bug applies to all sounds files or just OGG files?
George Gilbert wrote:RTC first tries to load it from memory and then if it thinks it has failed...
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: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. :cry:
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:simply trigger the sound at zero volume
How does one do that? -- I can't see any volume selector in RTCs sound objects?
George Gilbert wrote:loaded and ready to go immediately when you really need it!
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?
User avatar
George Gilbert
Dungeon Master
Posts: 3022
Joined: Mon Sep 25, 2000 11:04 am
Location: London, England
Contact:

Post by George Gilbert »

Gambit37 wrote:
George Gilbert wrote:loaded and ready to go immediately when you really need it!
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?
- 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.

- 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...
User avatar
George Gilbert
Dungeon Master
Posts: 3022
Joined: Mon Sep 25, 2000 11:04 am
Location: London, England
Contact:

Post by George Gilbert »

George 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...
Done for V0.50
Post Reply