예제 #1
0
 /// <summary>
 /// A calculation that returnes the number of bytes to read from
 /// a wave-sample in memory.
 /// </summary>
 /// <param name="channel">NAudio IWaveChannel.</param>
 /// <param name="offset">The position or requested index in our NAudio channel.</param>
 /// <param name="sampleCount">the number of samples requested for our buffer.</param>
 /// <returns>Total number of bytes to read.</returns>
 public static int BytesToRead(IWaveChannel channel, int offset, int sampleCount)
 {
     channel.Status = BufferStatus.Running;
     if (offset > channel.SampleData_ChunkLength)
     {
         channel.Status = BufferStatus.Finished;
         return 0;
     }
     else if ((offset + sampleCount) > channel.SampleData_ChunkLength)
     {
         channel.Status = BufferStatus.LastPage;
         return channel.SampleData_ChunkLength - offset;
     }
     return sampleCount;
 }
예제 #2
0
 /// <summary>
 /// A calculation that returnes the number of bytes to read from
 /// a wave-sample in memory.
 /// </summary>
 /// <param name="channel">NAudio IWaveChannel.</param>
 /// <param name="offset">The position or requested index in our NAudio channel.</param>
 /// <param name="sampleCount">the number of samples requested for our buffer.</param>
 /// <returns>Total number of bytes to read.</returns>
 static public int BytesToRead(IWaveChannel channel, int offset, int sampleCount)
 {
     channel.Status = BufferStatus.Running;
     if (offset > channel.SampleData_ChunkLength)
     {
         channel.Status = BufferStatus.Finished;
         return(0);
     }
     else if ((offset + sampleCount) > channel.SampleData_ChunkLength)
     {
         channel.Status = BufferStatus.LastPage;
         return(channel.SampleData_ChunkLength - offset);
     }
     return(sampleCount);
 }