Hi,
my problem is that the assignment of decodedProxyExcerpt2 below overwrites decodedProxyExcerpt1 and I do not know why.
Any clues?
Thanks in advance.
DecodedProxyExcerpt decodedProxyExcerpt1 = new DecodedProxyExcerpt(stepSize);
if (audiofactory.MoveNext(stepSize))
{
decodedProxyExcerpt1 = audiofactory.Current(stepSize);
}
// At this point decodedProxyExcerpt1.data contains the correct values.
DecodedProxyExcerpt decodedProxyExcerpt2 = new DecodedProxyExcerpt(stepSize);
if (audiofactory.MoveNext(stepSize))
{
decodedProxyExcerpt2 = audiofactory.Current(stepSize);
}
// At this point decodedProxyExcerpt2.data contains the correct values.
// However, decodedProxyExcerpt1.data is overwritten and now holds the values of decodedProxyExcerpt2.data.
public class DecodedProxyExcerpt
{
public short[] data { get; set; } // PCM data
public DecodedProxyExcerpt(int size)
{
this.data = new short[size];
}
}
From AudioFactory:
public bool MoveNext(int stepSize)
{
if (index == -1)
{
index = 0;
return (true);
}
else
{
index = index + stepSize;
if (index >= buffer.Length - stepSize)
return (false);
else
return (true);
}
}
public DecodedProxyExcerpt Current(int stepSize)
{
Array.Copy(buffer, index, CurrentExcerpt.data, 0, stepSize);
return(CurrentExcerpt);
}}