Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  

Mocha Doom v1.5 - sound 'n stuff

Recommended Posts

After an admittedly long period of development, setbacks, and way, WAY too many new features I'd have liked to implement, I decided to call it a day and finally release Mocha Doom v1.5 with perhaps the most immediately obvious new feature: sound, thanks to the earliest code contributions by _D_ and now by finnw.

Get it from the usual place.

Other than sound, Mocha Doom v1.5 has a quite long list of fixes:

Changes since 1.4a:

* Change in distribution: mochadoom.jar is now an executable .jar file.
F Fixed an issue with TEXTURE2 lump loading which skipped the last entry.
F Definitively fixed the retail/registered distinction
F Fixed Ultimate Doom par times crash (finnw)
F Fixed status bar "dirtying" by help screen
F Fixed savegame name nulling
F Fixed Quicksave string issue.
F Fixed negative index objects crash
F Fixed finale text centering error
+ Added MIDI/MUS compatible sound system ( by _D_, finnw).
+ Added PC speaker sound emulation (-speakersound)
+ Added Classic sound mixer (default)
+ Added Audioline-based sound mixer (-audiolines) (by _D_, Velktron)
+ Added Clip-based sound mixer (-clipsound) (By Velktron)
+ Added missing reject table safeguard
+ Added anti tutti-frutti safeguard
+ Added safeguards against certain mapping errors
+ Added an efficient object pooling system.
+ Added Gamma level settings.
+ Added patch_t load-time safeguard vs. broken columns.
+ Added Game Sound interface for channel/position/volume management.
+ Added graceful closing of open file handles.
+ Added always run option
+ Added pop-up message box on modified games
Now, from my experience and testing opportunities, sound is probably gonna work smoothly on Windows and OSX, but Linux distros may vary wildly. OFC these are just estimates, I can't test with everyone's rig by myself. There are actually 3 different sound "drivers", so if the default one doesn't do the trick try -audiolines or -clipsound, which may work better on some occasions.

There's even a PC speaker emulation mode (-speakersound) thrown in just for kicks ;-)

I've started work for some future additions like a cvar-based configuration system (there are enough options around to justify that) and DEH support (theoretically possible thanks to a major rewrite of the Actions subsystem, which allows function rewiring), plus built-in blockmap rebuilding and other goodies). But if I waited to implement those, I would delay a release for maybe 2 more months.

So v1.5 is really a much needed update to the v1.4 line, which actually fixes a lot of crippling errors and makes it more tolerant even of many shitty 1994, malformed maps.

A major usability enhancement is that the mochadoom.jar file is now self-executing (assuming you have an OS with executable jar support) and should -in theory- work more easily with launchers or by simple clicking. The usual convenience .bat/.sh files are always there, should they be needed.

OK enough talk. Enjoy, and play the hell out of it ;-) I need playtesting, error reports, suggestions.

Share this post

Link to post

Keep up the good work.

Factoid: I used the same method as VolumeScalingReceiver.java to kludge working midi volume in prboom-plus.

Share this post

Link to post

Yay sound!
So I loaded it up and it sounds like sound works fairly good. I wasn't expecting to hear the classic sound code so all the pitch-shifting made me giggle at first. Though it still sounds a bit buggy and stuff but that's not too surprising.
For example, when loading -clipsound some sounds won't play at times, and for some reason I don't think -audiolines and -speakersound are working for me, and I'm sure I put them in right.
Anyways, it's still nice to actually hear something instead of playing in silence, so good job and keep doing your thing! :)

Share this post

Link to post


Heh a missing "else" caused it not to work. I fixed it and updated the v1.5 distro file. Now you can have PC speaker sound with stereo, volume changes and pitch variations ;-) I may build in a "wav to speaker" converter so that it works for user-defined sounds, too, in the future. For anyone curious, I did use fraggle's frequency table and PC speaker research as a reference (credited in the source) but did some extensions to it (e.g. found a logaritmic formula that gives more frequencies than those in the table), and the synthesizing method used is actually original (I didn't simply copy chocolate doom's in this case).

The -clipsound and -audiolines "drivers" are intended to be more like fallback modes. David Martel's original method was similar to the current -audiolines driver, in that it uses as many threads as channels and tried to secure an independent audioline for each channel and manipulate volume, panning and pitch directly with audioline controls.

The problem with that approach is that Java doesn't guarantee that you will get any of those controls even if you ask for it -e.g. you may get no panning at all, plus on Linux in particular asking multiple audiolines is very bad practice, and soon overloads the audio system. Linux seems to be worst offender in this case, where not even getting a panning/balance control for STEREO audiolines was guaranteed.

The -clipsound driver was actually a failed attempt to work around that, but it's not that great because each Java sound Clip is actually an AudioLine in disguise, and so it's subject to the same limitations -minus the multithreading- plus a lot of limitations that affect Java Clips in general. It's in there more like a fallback to the fallback.

The default sound driver actually implements the unused soundcode found in linuxdoom (!) in Java, which also enables full control over pitch and volume, since its does its own mixing and so doesn't depend
as much on the whims of the OS. It does work, although buffering and queing may sometimes be less than perfect, but hey, I had to develop that one almost from scratch. OTOH, it could double as a MOD player...

@natt: thank finnw for that ;-)

It turned out that there's no OS-wide "MIDI device volume" control on any OS, generally speaking. The one present in the Windows mixer is more like a user-friendly courtesy which must do a similar per-note hack. E.g. starting chocolate or prboom+ and changing volume from within the game has no effect on the mixer's slider (you can get full MIDI volume in-game even if you set the external slider to almost zero). I think only if you use an older soundcard with a recordable, distinct MIDI line (e.g. like the AWE32 card) you get a genuine global synth control, otherwise what you get is a note hack. Oh well. Since there's an OPL3 emulator written in pure Java laying around, you can guess which is the next step ;-)

Edit: I forgot to document that now you can take screenshots, but it's oldschool all the way: you must use -devparm and F1, and they are in PCX format. Next time I will add PNG ;-)

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this