Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: audio2



At Thu, 9 May 2019 10:28:19 -0300 (ADT),
Jared McNeill wrote:
> With order of operations here, and track->volume being in range 0...256, I 
> don't think this will work anyway. volume of 255 of less will cause the 
> sample to be 0, and 256 the original value.

(A * B >> C) is equivalent to ((A * B) >> C).
(A * B / C)  is equivalent to ((A * B) / C).
And in fact it worked.

# I'm sorry if I misread your text.

Thanks,
---
Tetsuya Isaki <isaki%pastel-flower.jp@localhost / isaki%NetBSD.org@localhost>

> > 5234:#if defined(AUDIO_USE_C_IMPLEMENTATION_DEFINED_BEHAVIOR) && defined(__GNUC__)
> > 5235-				*d++ += ((aint2_t)*s++) * track->volume >> 8;
> > 5236-#else
> > 5237-				*d++ += ((aint2_t)*s++) * track->volume / 256;
> > 5238-#endif


Home | Main Index | Thread Index | Old Index