Doom monster
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Source Ports > How to add improved midi support to chocolate-doom and eternity (and other ports)!
 
Author
All times are GMT. The time now is 19:26. Post New Thread    Post A Reply
Holering
Member


Posts: 275
Registered: 01-03


code:
// Load the MIDI Mix_SetMusicCMD(getenv("MIDI")); music = Mix_LoadMUS(filename); if (music == NULL) { // Failed to load fprintf(stderr, "Error loading midi: %s\n", Mix_GetError()); } // remove file now // remove(filename); // Z_Free(filename); return music; }

Thanks Fraggle! Now Eternity needs something like this...

EDIT:
Thanks to Quasar I figured out how to get Eternity to do the same. Here's eternity/source/sdl/i_sdlmusic.cpp where it should like this this:
code:
// Try SDL_mixer locally // rw = SDL_RWFromMem(data, size); M_WriteFile("/tmp/doom.mid", data, size); char *filename = NULL; Mix_SetMusicCMD(getenv("MIDI")); filename = "/tmp/doom.mid"; music = Mix_LoadMUS(filename); // music = Mix_LoadMUS_RW(rw);


MP2E submitted a great patch that should make it easier to do the abov e (haven't tried it and don't know if it'll work building for Windows). http://www.mediafire.com/download/k...ty_sound.tar.xz

Basically what this does, is allow users to forward the midi tracks to an external command line midi player. This does wonders for Linux users because sdl_mixer always defaults to it's built-in version of timidity which is really dated and broken (doesn't render pat sets properly or midi for that matter, and users can't choose anything else to render the midi which totally isn't right; especially when you can't use hardware midi which you can using this code); there's also the newer version of sdl_mixer, 1.2.12, which can have the fluidsynth soundfont backend built-in but for some reason that also doesn't work right (panning, envelopes, reverb, chorus, mapping, and other stuff is borked!). For Windows, users should be able to call an external program such as timidity.exe so users get the full benefit of timidity++ or any other command line midi synthesizer. Sdl_mixer on Windows defaults to Windows General Midi so using timidity++ via midi yoke doesn't work; that's where this code can avoid those problems. A Windows front-end for Chocolate-doom, Eternity, or any source port with sdl_mixer that can use this code, can make the command line easier to handle for users; Linux and Mac OS users too. Haven't tried building Windows executable's with this code however, and the filename should be adjusted for Windows; built Linux binaries fine however.


Here's what sdl_mixer sounds like when using it's built-in method of handling midi (it uses an ancient and broken version of timidity):
http://speedy.sh/gYrVd/e1m1-portmidi.ogg
http://speedy.sh/ja3dE/e1m1-sdlmixer.ogg
http://speedy.sh/bTDEM/map02-portmidi.ogg
http://speedy.sh/GsvMH/map02-sdlmixer.ogg

Here's some ogg samples I recorded using eternity revision 2570 using the above code with MIDI="timidity -A20,100"; I'm also using the exact same pat set here but forgot to record the same tracks (you can still probably tell how much better and FIXED it sounds):
e5m1 http://speedy.sh/euJca/e5m1-external-timidity.ogg
e5m2 http://speedy.sh/XQ28T/e5m2-external-timidity.ogg
e5m3 http://speedy.sh/cyeqs/e5m3-external-timidity.ogg
e5m8 http://speedy.sh/8BXFJ/e5m8-external-timidity.ogg

Only downside is there's a temporary file left over after closing chocolate-doom and/or eternity. And there's a small pause when a song changes. These issues can probably get fixed but they're not a big deal anyway.

I can swap around pat sets and use a Sega Genesis/32x or Super Nintendo pat set now, to make Doom music sound more interesting :P

Last edited by Holering on 08-20-13 at 06:25

Old Post 06-28-13 05:53 #
Holering is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
Holering
Member


Posts: 275
Registered: 01-03


Was able to get help from Fraggle and Quasar to do what's mentioned in my first post. Want to share this so people can use whatever the heck they want for midi when playing their Doom games; and to avoid sdl_mixer's broken and awful midi backends and default choices. This code should work on every source port that uses sdl_mixer which is practically all of them.

Old Post 07-11-13 20:56 #
Holering is offline Profile || Blog || PM || Search || Add Buddy IP || Edit/Delete || Quote
All times are GMT. The time now is 19:26. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Source Ports > How to add improved midi support to chocolate-doom and eternity (and other ports)!

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Message Board Statistics