ISampleSource.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. namespace Bmp.Core.FFMpeg.CsCorePorts;
  2. /// <summary>
  3. /// Defines the base for all audio streams which provide samples instead of raw byte data.
  4. /// </summary>
  5. /// <remarks>
  6. /// Compared to the <see cref="IWaveSource" />, the <see cref="ISampleSource" /> provides samples instead of raw bytes.
  7. /// That means that the <see cref="IAudioSource.Length" /> and the <see cref="IAudioSource.Position" /> properties
  8. /// are expressed in samples.
  9. /// Also the <see cref="IReadableAudioSource{T}.Read" /> method provides samples instead of raw bytes.
  10. /// </remarks>
  11. public interface ISampleSource : IReadableAudioSource<float>
  12. {
  13. /*/// <summary>
  14. /// Reads a sequence of samples from the <see cref="ISampleSource" /> and advances the position within the stream by the
  15. /// number of samples read.
  16. /// </summary>
  17. /// <param name="buffer">
  18. /// An array of floats. When this method returns, the <paramref name="buffer" /> contains the specified
  19. /// float array with the values between <paramref name="offset" /> and (<paramref name="offset" /> +
  20. /// <paramref name="count" /> - 1) replaced by the floats read from the current source.
  21. /// </param>
  22. /// <param name="offset">
  23. /// The zero-based offset in the <paramref name="buffer" /> at which to begin storing the data
  24. /// read from the current stream.
  25. /// </param>
  26. /// <param name="count">The maximum number of samples to read from the current source.</param>
  27. /// <returns>The total number of samples read into the buffer.</returns>
  28. int Read(float[] buffer, int offset, int count);
  29. */
  30. }
  31. /// <summary>
  32. /// Defines the base for all <see cref="ISampleSource" /> aggregators.
  33. /// </summary>
  34. public interface ISampleAggregator : ISampleSource, IAggregator<float, ISampleSource>
  35. {
  36. }
  37. /// <summary>
  38. /// Defines the base for all <see cref="IWaveSource" /> aggregators.
  39. /// </summary>
  40. public interface IWaveAggregator : IWaveSource, IAggregator<byte, IWaveSource>
  41. {
  42. }
  43. /// <summary>
  44. /// Defines the base for all aggregators.
  45. /// </summary>
  46. /// <typeparam name="T">The type of data, the aggregator provides.</typeparam>
  47. /// <typeparam name="TAggregator">The type of the aggreator type.</typeparam>
  48. public interface IAggregator<in T, out TAggregator>
  49. : IReadableAudioSource<T> where TAggregator : IReadableAudioSource<T>
  50. {
  51. /// <summary>
  52. /// Gets the underlying <see cref="IReadableAudioSource{T}" />.
  53. /// </summary>
  54. /// <value>
  55. /// The underlying <see cref="IReadableAudioSource{T}" />.
  56. /// </value>
  57. TAggregator BaseSource { get; }
  58. }