Reimar Döffinger a écrit :
On Sat, Jul 10, 2010 at 07:24:56PM +0200, Vitor Sessak wrote:
On 07/10/2010 07:00 PM, Justin Ruggles wrote:
Sebastian Vater wrote:
+ /** Default volume boost level. 65536 equals to 100% which + means no boost. */ + uint32_t volume_boost; [...] + /** The current volume boost level. 65536 equals to 100% which + means no boost. */ + uint32_t volume_boost; + + /** Left channel volume level. 256 is full volume. */ + uint16_t volume_left; + + /** Right channel volume level. 256 is full volume. */ + uint16_t volume_right; [...] + /** Current volume for this channel which ranges from 0 (muted) + to 255 (full volume). */ + uint8_t volume; + + /** Current stereo panning level for this channel (where 0-127 + indicate left stereo channel panning, -128 is central stereo + panning and -127 to -1 indicate right stereo panning). */ + int8_t panning;
Why all these arbitrary integer scales? Why not floating point or AVRational instead?
I don't think floating point is a good idea, let's try to keep everything bit-identical across archs if possible.
Especially not in data structures which are accessed number of active channels * mixing rate each second...
You could still go with something more consistent, like 16.16 fixed-point or AVRational.
volume_boost is 16.16, I looked at lavu/rational.c it has way to much multiplications making mixing much slower. I don't want to use multiply/divide instructions in the main mixing loop routines.
Particularly uint16_t volume_left; uint8_t volume;
Changing volume_left & volume_right to 16.16 fixed point would be a good idea, though. Normal single channel volume is from 0-255 since that is the volume range in the trackers. -- Best regards, :-) Basty/CDGS (-: