IMF header version 2

These are not rejected - but are not considered highly important right now.

Moderator: GZDoom Developers

IMF header version 2

Postby Gez » Sat Sep 12, 2015 9:29 am

Okay, here's a proposal. As you know, the IMF format does not allow to define the sample rate. ZDoom uses 700 hz for everything, but there are files that have a rate of 560 hz or 280 hz instead. This is occasionally a problem.

I suggest a way to solve this by tweaking a bit Martin Fernandez' header format. The header currently is as such:

Code: Select allExpand view
char[5]    Signature (must be ADLIB)
uint8    Version (must be 1 — this format has no other version)
char*    Track name as a null-terminated string
char*    Game name as a null-terminated string
byte    Ignored unknown value, generally 1
uint32    Track length (if 0: until end of file or null instruction)

It could be modified as such while keeping backward compatibility:

Code: Select allExpand view
char[5]    Signature, unchanged
uint8    Version — 2
char*    Track name, unchanged
char*    Game name, unchanged
byte       sample rate / 7 (so 40 for 280 hz, 80 for 560 hz, or 100 for 700 hz)
uint32    Track length, unchanged

If version is 1, keep using a fixed rate of 700. Code impact on ZDoom would be minimal. Editing tool support would happen pretty soon in SLADE 3. What do you think?
Joined: 06 Jul 2007

Re: IMF header version 2

Postby HavoX » Sat Sep 12, 2015 11:25 am

I'm sold on this idea, just as long as it maintains backwards compatibility, as you said.
I don't post as often as I used to...
Joined: 11 Apr 2012
Location: St. Louis, MO
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: IMF header version 2

Postby Yholl » Sun Sep 13, 2015 8:54 pm

All my yes.

User avatar
I will hit you with my Decorate.
Joined: 17 Dec 2012
Location: Here, stupid.

Re: IMF header version 2

Postby Blzut3 » Sun Sep 13, 2015 10:36 pm

Editing someone else's header seems a little risky to me. I wonder if a safer solution would be to detect based on the game name? Possibly also support some string there like "Generic: 700Hz"? The plus side is that existing playback utilities would continue to play the files.
Pronounced: B-l-zut
Joined: 24 Nov 2004
Github ID: Blzut3
Operating System: Debian-like Linux (Debian, Ubuntu, Mint, etc) 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: IMF header version 2

Postby edward850 » Mon Sep 14, 2015 12:05 am

Alt idea the third: A $imfrate <lump> <rate> parameter introduced in SNDINFO? From what I can tell, most IMFs need volume balancing anyway, so you already need an SNDINFO entry for them.
User avatar
[netcode intensifies]
Joined: 19 Jul 2005
Location: New Zealand

Re: IMF header version 2

Postby Graf Zahl » Sun Feb 26, 2017 12:52 pm

Do people actually use these formats? I don't, I do not even have any of them lying around so someone else will have to do this.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Joined: 19 Jul 2003
Location: Germany

Return to On Hold Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests