[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Monday 17 May 2004 03:13, Chris wrote:
> The volume is precision yes. And looking at the original code again,
> what I'm seeing is that 3/8ths of the 14-bit mixing range is clipped
> from both ends:
> /* clip extremes of the sample range */
> for (i=0; i<clip_size*3/8; i++) {
> mix_clip_table[i] = 0;
> mix_clip_table[clip_size-1-i] = clip_max;
> }
> clip_size is 1<<14 in 16-bit output, and 1<<10 in 8-bit output.
Sounds familiar, yeah. (I played with the clipping table and such when I
implemented set_volume_per_voice().)
> Anything
> within the two extreme ranges are topped, or bottomed, out, so you'll
> get audio ranging from 32 to 512, then clipped to 0 and 65535 if it's
> not within that range (in 16-bit output). If my math is right.
That would be a pretty scary curve. All normal audio would be in a tight
little 'band' (to misuse a term) with an evil DC offset, until it clips and
then it would jump all the way up to the top :)
For 16-bit mixing, it'll be
0,0,0,...,0,0,0,16,32,48,...,65504,65520,65535,65535,...,65535
i.e. steps of 16, but covering the full range. The precision is quite bad
actually. (This is with the old mixer of course.) But it does cover the full
range of output volume.
> And even with set_volume_per_voice(1), which would give you the default
> volume level (half per channel if centered, or full if panned hard to
> one side),
Default? Default for what?
> it is maxed out at 14-bit before mixing into the buffer,
No, maxed at 14-bit before clipping; useful range 12-bit; but it's shifted
left by 4 bits so it's still full volume.
> whereas my mixer maxes it out at 24-bit (then later scaled down as needed).
So it goes to 24-bit and then is shifted right 8 bits (for 16-bit output), so
the output should be the same.
So I guess there are two issues at hand: whether the output is the same when
set_volume_per_voice() is called, and whether it's the same when
set_volume_per_voice() ISN'T called.
When set_volume_per_voice() is called:
It sounds to me as if what you've implemented for the new mixer should
actually give the same output, but you just thought it would be louder. If
you heard a difference, then it's cause for concern. I tested the old mixer
pretty thoroughly, and it really did give full volume when it should.
When set_volume_per_voice() isn't called:
Is the default level the same? I don't think it would be wise to up it, since
games are relying on it. Back when I implemented set_volume_per_voice(), I
almost did change the default behaviour, but people didn't like it. My
patches were accepted when I managed to do it in such a way that the default
was exactly the same as before (see set_volume_per_voice()'s docs for what
this default is).
Ben