[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
After migrating from Windows to Linux, and thus away from Allegro's DX
mixer, I was horrified to learn that the volume problems are still
there. This is amplified by the fact that the DIGMID driver chews up so
many voices, everything becomes quite inaudible, even when playing
note-heavy MIDIs. So, what I did was play around with Allegro's software
mixer, and ended up accomplishing these things (these only apply to the
high quality mixers; the low quality one "quality = 0" remains mostly
unchanged):
* The volume no longer decreases as more voices are allocated
* Samples now clamp to 0 and 65535 without using branching or assuming
signed right-shifts; as a result, the output no longer wraps and causes
distortion
* The internal volume range now uses full 16 bit precision, instead of 14
* The maximum output volume is now full 16 bit as well, instead of 13(!)
* The clipping table used by the mixer was removed (unneeded due to
clamping)
* High quality mixers can be selected even if 8 bit audio output is used
(the 16->8 conversion is done after mixing, so I don't see why the mixer
selection should be affected by this)
I realize that removing the set_volume_per_voice functionality for the
non-low quality mixers was probably a bad idea. It should be simple
enough to add that back in, letting set_volume_per_voice(0) play
everything at full volume, but this way it gives full volume control via
set_volume. I would also recommend that if set_volume_per_voice should
be restored (which I can do simply enough), that set_volume_per_voice(0)
be the default for the high quality mixers.
I know that the preferred method of sending patches is .diff, but since
I haven't gotten the hang of that program yet, and I would have to
reextract the original source file to try and make the diff, I decided
to just simply upload it to my site:
http://kcat.strangesoft.net/mixer.c
It's based off the 4.1.13 code tree, although the file doesn't look like
it's been modified since before 4.0. If there's anything more I can do,
or if you have questions, just ask. Comments also welcome. :)
- Kitty Cat
PS. According to the GCC manual, the compiler won't inline with -O2. You
need to either specifiy -finline-functions or -O3. So those inline
functions in the source aren't being inlined, nor locked. Isn't this a
timer hazard?