2025-07-29 18:00:09 -05:00
|
|
|
namespace StreamShorts.Library.Media;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents a service for processing audio files.
|
|
|
|
|
/// </summary>
|
|
|
|
|
internal interface IAudioService
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Converts an MP3 stream to a WAV stream with a 16 kHz sample rate.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="mp3">The input MP3 stream.</param>
|
|
|
|
|
/// <returns>The output WAV stream.</returns>
|
2025-07-29 18:21:17 -05:00
|
|
|
/// <exception cref="ArgumentNullException">Thrown when the MP3 stream is null.</exception>
|
|
|
|
|
/// <exception cref="ArgumentException">Thrown when the MP3 stream is not readable or seekable.</exception>
|
|
|
|
|
/// <remarks>The method will preserve the passed MP3 stream's data and position.</remarks
|
2025-07-29 18:00:09 -05:00
|
|
|
Stream ConvertMp3ToWav16(Stream mp3);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the number of segments in a WAV stream based on the specified segment duration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// param name="wavStream">The input WAV stream.</param>
|
|
|
|
|
/// <param name="segmentDuration">The duration of each segment.</param>
|
|
|
|
|
/// <returns>The number of segments.</returns>
|
2025-07-29 18:21:17 -05:00
|
|
|
/// <exception cref="ArgumentNullException">Thrown when the WAV stream is null.</exception>
|
|
|
|
|
/// <exception cref="ArgumentException">Thrown when the WAV stream is not readable or seekable.</exception>
|
|
|
|
|
/// <remarks>The method will preserve the passed WAV stream's data and position.</remarks>
|
2025-07-29 18:00:09 -05:00
|
|
|
int GetNumberOfWavSegments(Stream wavStream, TimeSpan segmentDuration);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a segment of a WAV stream based on the specified segment number and duration.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// param name="wavStream">The input WAV stream.</param>
|
|
|
|
|
/// <param name="segmentNumber">The segment number to retrieve.</param>
|
|
|
|
|
/// <param name="segmentDuration">The duration of each segment.</param>
|
|
|
|
|
/// <returns>The segment stream.</returns>
|
2025-07-29 18:21:17 -05:00
|
|
|
/// <exception cref="ArgumentNullException">Thrown when the WAV stream is null.</exception>
|
|
|
|
|
/// <exception cref="ArgumentException">Thrown when the WAV stream is not readable or seekable.</exception>
|
|
|
|
|
/// <remarks>The method will preserve the passed WAV stream's data and position.</remarks>
|
2025-07-29 18:00:09 -05:00
|
|
|
Stream GetWavSegment(Stream wavStream, int segmentNumber, TimeSpan segmentDuration);
|
|
|
|
|
}
|