using System; using Chernobyl.Creation; namespace Chernobyl.Generation { /// /// Represents a type is capable of playing sounds. /// public interface IPlayer : IDisposable { /// /// Start playing the audio. /// void Play(); /// /// Stop playing the audio. /// void Stop(); /// /// The current state of the sound being played. /// PlayerState State { get; } /// /// The current time in the stream from the start. /// TimeSpan Position { get; } /// /// The current location in the stream from the start in bytes. /// long BytePosition { get; } } /// /// The state of a sound player. /// public enum PlayerState { /// /// The sound was playing but is now paused. /// Paused, /// /// The sound is playing. /// Playing, /// /// The sound is not playing. /// Stopped } /// /// Initialization properties for the creation of an wave through an /// . /// public class WavePlayerConfig { /// /// Constructor. /// /// The method that produces the wave. /// The rate in milliseconds at which a wave is sampled. /// The number of channels (speakers for example) to player the music /// from. For example, 1 is mono. public WavePlayerConfig(Func waveFunc, int sampleRate = 16000, int channels = 1) { WaveFunc = waveFunc; SampleRate = sampleRate; Channels = channels; } /// /// The method that produces the wave. /// public Func WaveFunc { get; } /// /// The rate in milliseconds at which a wave is sampled. /// public int SampleRate { get; } /// /// The number of channels (speakers for example) to player the music from. For example, 1 /// is mono. /// public int Channels { get; } } /// /// Creates an capable of playing a wave. /// public interface IWavePlayerFactory : IFactory {} }