@ -14,7 +14,7 @@ namespace NAudio.Wave
/// </summary>
public class BufferedWaveProvider : IWaveProvider
{
private CircularBuffer b uffer;
private CircularBuffer circularB uffer;
private WaveFormat waveFormat ;
/// <summary>
@ -58,7 +58,7 @@ namespace NAudio.Wave
/// </summary>
public int BufferedBytes
{
get { if ( b uffer = = null ) return 0 ; return b uffer. Count ; }
get { if ( circularB uffer = = null ) return 0 ; return circularB uffer. Count ; }
}
/// <summary>
@ -83,12 +83,12 @@ namespace NAudio.Wave
public void AddSamples ( byte [ ] buffer , int offset , int count )
{
// create buffer here to allow user to customise buffer length
if ( this . b uffer = = null )
if ( this . circularB uffer = = null )
{
this . b uffer = new CircularBuffer ( this . BufferLength ) ;
this . circularB uffer = new CircularBuffer ( this . BufferLength ) ;
}
int written = this . b uffer. Write ( buffer , offset , count ) ;
int written = this . circularB uffer. Write ( buffer , offset , count ) ;
if ( written < count )
{
throw new InvalidOperationException ( "Buffer full" ) ;
@ -101,7 +101,11 @@ namespace NAudio.Wave
/// </summary>
public int Read ( byte [ ] buffer , int offset , int count )
{
int read = this . buffer . Read ( buffer , offset , count ) ;
int read = 0 ;
if ( this . circularBuffer ! = null ) // not yet created
{
read = this . circularBuffer . Read ( buffer , offset , count ) ;
}
if ( read < count )
{
// zero the end of the buffer