[Bug 42546] DSOUND_PrimaryOpen() incorrect set buf size

wine-bugs at winehq.org wine-bugs at winehq.org
Tue Feb 28 07:19:10 CST 2017


https://bugs.winehq.org/show_bug.cgi?id=42546

--- Comment #9 from Huw Davies <huw at codeweavers.com> ---
(In reply to Ivan_83 from comment #8)
> Stop playing around new_buflen in DSOUND_PrimaryOpen() and do it right once
> for long time.

Where it's set is essentially irrelevant, what matters is the correct value.
While I agree the code is a mess as it stands, it doesn't seem too unreasonable
to me to have the buffer allocation in a separate helper function.

Now, back to the actual discussion in hand.
https://msdn.microsoft.com/en-us/library/windows/desktop/dd370866(v=vs.85).aspx
states that:

   The size in bytes of an audio frame is calculated as
   the number of channels in the stream multiplied by the
   sample size per channel. For example, the frame size is
   four bytes for a stereo (2-channel) stream with 16-bit samples.

i.e. a frame contains nChannels samples.  So if we're allocating memory for n
frames stored as floats, we need n * nChannels * sizeof(float) bytes.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list