Menu

#1 Bug in creating a stereo sample with CreateSample

open
nobody
None
5
2003-03-29
2003-03-29
Anonymous
No

Creating a stereo sample doesn't work properly because
the definition of CreateSample() (in in BASSInternals.cs)
has the line;

IntPtr memloc = _CreateSample(data.Length, freq,...)

Which doesn't take account of the fact that a stereo
sound needs twice as many samples.

A Mono sound of 100 samples is 100 samples long
(data.Length).
A Stereo sound of 100 samples is _50_ samples long,
because 2 are used at a time, one per channel.

For a stereo sample, "Length In Samples" has to be
data.Length/2

Otherwise the sample is plagued with a bunch of hiss at
the end.

At slight code change to

int samlength=data.Length;
if (0==((int)SampleInfoFlags.Mono & (int)flags))
samlength/=2;
IntPtr memloc = _CreateSample(samlength, freq, max,
(int) flags);

Seems to fix the problem.

sfb@leastaction.org

Discussion


Log in to post a comment.

MongoDB Logo MongoDB