IMF header version 2

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

Moderator: GZDoom Developers

Post Reply
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

IMF header version 2

Post by Gez »

Okay, here's a proposal. As you know, the [wiki]IMF[/wiki] 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 all

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 all

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?
HavoX
Posts: 272
Joined: Wed Apr 11, 2012 10:31 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10 Pro 21H1
Graphics Processor: nVidia with Vulkan support
Location: St. Louis, MO

Re: IMF header version 2

Post by HavoX »

I'm sold on this idea, just as long as it maintains backwards compatibility, as you said.
User avatar
Yholl
Posts: 1953
Joined: Mon Dec 17, 2012 11:08 am
Location: Here, stupid.

Re: IMF header version 2

Post by Yholl »

All my yes.

TAKE ALL OF MY YES
Blzut3
 
 
Posts: 3144
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

Re: IMF header version 2

Post by Blzut3 »

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.
User avatar
edward850
Posts: 5886
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: IMF header version 2

Post by edward850 »

Alt idea the third: A $imfrate <lump> <rate> parameter introduced in [wiki]SNDINFO[/wiki]? From what I can tell, most IMFs need volume balancing anyway, so you already need an SNDINFO entry for them.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: IMF header version 2

Post by Graf Zahl »

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.
Post Reply

Return to “On Hold Suggestions”