diff --git a/NAudio.Asio/ASIODriverExt.cs b/NAudio.Asio/ASIODriverExt.cs index 85e0bccc..d1bb0cf7 100644 --- a/NAudio.Asio/ASIODriverExt.cs +++ b/NAudio.Asio/ASIODriverExt.cs @@ -31,6 +31,9 @@ public class AsioDriverExt private int bufferSize; private int outputChannelOffset; private int inputChannelOffset; + /// + /// Reset Request Callback + /// public Action ResetRequestCallback; /// diff --git a/NAudio.Extras/AudioPlaybackEngine.cs b/NAudio.Extras/AudioPlaybackEngine.cs index 8ce770e4..6964ae91 100644 --- a/NAudio.Extras/AudioPlaybackEngine.cs +++ b/NAudio.Extras/AudioPlaybackEngine.cs @@ -12,6 +12,9 @@ public class AudioPlaybackEngine : IDisposable private readonly IWavePlayer outputDevice; private readonly MixingSampleProvider mixer; + /// + /// Audio Playback Engine + /// public AudioPlaybackEngine(int sampleRate = 44100, int channelCount = 2) { outputDevice = new WaveOutEvent(); @@ -21,6 +24,9 @@ public AudioPlaybackEngine(int sampleRate = 44100, int channelCount = 2) outputDevice.Play(); } + /// + /// Fire and forget playback of sound + /// public void PlaySound(string fileName) { var input = new AudioFileReader(fileName); @@ -40,6 +46,9 @@ private ISampleProvider ConvertToRightChannelCount(ISampleProvider input) throw new NotImplementedException("Not yet implemented this channel count conversion"); } + /// + /// Fire and forget playback of a cached sound + /// public void PlaySound(CachedSound sound) { AddMixerInput(new CachedSoundSampleProvider(sound)); @@ -50,6 +59,9 @@ private void AddMixerInput(ISampleProvider input) mixer.AddMixerInput(ConvertToRightChannelCount(input)); } + /// + /// Disposes this instance + /// public void Dispose() { outputDevice.Dispose(); diff --git a/NAudio.Extras/AutoDisposeFileReader.cs b/NAudio.Extras/AutoDisposeFileReader.cs index 1b5100bf..6d43961b 100644 --- a/NAudio.Extras/AutoDisposeFileReader.cs +++ b/NAudio.Extras/AutoDisposeFileReader.cs @@ -11,12 +11,19 @@ public class AutoDisposeFileReader : ISampleProvider { private readonly ISampleProvider reader; private bool isDisposed; + + /// + /// Creates a new file reader that disposes the source reader when it finishes + /// public AutoDisposeFileReader(ISampleProvider reader) { this.reader = reader; WaveFormat = reader.WaveFormat; } + /// + /// Reads samples from this file reader + /// public int Read(float[] buffer, int offset, int count) { if (isDisposed) @@ -33,6 +40,9 @@ public int Read(float[] buffer, int offset, int count) return read; } + /// + /// The WaveFormat of this file reader + /// public WaveFormat WaveFormat { get; } } } \ No newline at end of file diff --git a/NAudio.Extras/CachedSound.cs b/NAudio.Extras/CachedSound.cs index 19beca51..f05b3c53 100644 --- a/NAudio.Extras/CachedSound.cs +++ b/NAudio.Extras/CachedSound.cs @@ -9,8 +9,19 @@ namespace NAudio.Extras /// public class CachedSound { + /// + /// Audio data + /// public float[] AudioData { get; } + + /// + /// Format of the audio + /// public WaveFormat WaveFormat { get; } + + /// + /// Creates a new CachedSound from a file + /// public CachedSound(string audioFileName) { using (var audioFileReader = new AudioFileReader(audioFileName)) diff --git a/NAudio.Extras/Equalizer.cs b/NAudio.Extras/Equalizer.cs index 0c73e81f..406080a1 100644 --- a/NAudio.Extras/Equalizer.cs +++ b/NAudio.Extras/Equalizer.cs @@ -18,6 +18,9 @@ public class Equalizer : ISampleProvider private readonly int bandCount; private bool updated; + /// + /// Creates a new Equalizer + /// public Equalizer(ISampleProvider sourceProvider, EqualizerBand[] bands) { this.sourceProvider = sourceProvider; @@ -43,14 +46,23 @@ private void CreateFilters() } } + /// + /// Update the equalizer settings + /// public void Update() { updated = true; CreateFilters(); } + /// + /// Gets the WaveFormat of this Sample Provider + /// public WaveFormat WaveFormat => sourceProvider.WaveFormat; + /// + /// Reads samples from this Sample Provider + /// public int Read(float[] buffer, int offset, int count) { int samplesRead = sourceProvider.Read(buffer, offset, count); diff --git a/NAudio.Extras/EqualizerBand.cs b/NAudio.Extras/EqualizerBand.cs index c22f5eb5..2ead2e4c 100644 --- a/NAudio.Extras/EqualizerBand.cs +++ b/NAudio.Extras/EqualizerBand.cs @@ -1,9 +1,21 @@ namespace NAudio.Extras { + /// + /// Equalizer Band + /// public class EqualizerBand { + /// + /// Frequency + /// public float Frequency { get; set; } + /// + /// Gain + /// public float Gain { get; set; } + /// + /// Bandwidth + /// public float Bandwidth { get; set; } } } \ No newline at end of file diff --git a/NAudio.Extras/SampleAggregator.cs b/NAudio.Extras/SampleAggregator.cs index 957df0f9..52de0074 100644 --- a/NAudio.Extras/SampleAggregator.cs +++ b/NAudio.Extras/SampleAggregator.cs @@ -10,16 +10,28 @@ namespace NAudio.Extras /// public class SampleAggregator : ISampleProvider { - // volume + /// + /// Raised to indicate the maximum volume level in this period + /// public event EventHandler MaximumCalculated; private float maxValue; private float minValue; + /// + /// Notification count, number of samples between MaximumCalculated events + /// public int NotificationCount { get; set; } int count; - // FFT + /// + /// Raised to indicate that a block of samples has had an FFT performed on it + /// public event EventHandler FftCalculated; + + /// + /// If true, performs an FFT on each block of samples + /// public bool PerformFFT { get; set; } + private readonly Complex[] fftBuffer; private readonly FftEventArgs fftArgs; private int fftPos; @@ -29,6 +41,11 @@ public class SampleAggregator : ISampleProvider private readonly int channels; + /// + /// Creates a new SampleAggregator + /// + /// source sample provider + /// FFT length, must be a power of 2 public SampleAggregator(ISampleProvider source, int fftLength = 1024) { channels = source.WaveFormat.Channels; @@ -48,7 +65,9 @@ static bool IsPowerOfTwo(int x) return (x & (x - 1)) == 0; } - + /// + /// Reset the volume calculation + /// public void Reset() { count = 0; @@ -81,8 +100,14 @@ private void Add(float value) } } + /// + /// Gets the WaveFormat of this Sample Provider + /// public WaveFormat WaveFormat => source.WaveFormat; + /// + /// Reads samples from this sample provider + /// public int Read(float[] buffer, int offset, int count) { var samplesRead = source.Read(buffer, offset, count); @@ -95,25 +120,46 @@ public int Read(float[] buffer, int offset, int count) } } + /// + /// Max sample event args + /// public class MaxSampleEventArgs : EventArgs { + /// + /// Creates a new MaxSampleEventArgs + /// [DebuggerStepThrough] public MaxSampleEventArgs(float minValue, float maxValue) { MaxSample = maxValue; MinSample = minValue; } + /// + /// Maximum sample value in this period + /// public float MaxSample { get; private set; } + /// + /// Minimum sample value in this period + /// public float MinSample { get; private set; } } + /// + /// FFT Event Args + /// public class FftEventArgs : EventArgs { + /// + /// Creates a new FFTEventArgs + /// [DebuggerStepThrough] public FftEventArgs(Complex[] result) { Result = result; } + /// + /// Result of FFT + /// public Complex[] Result { get; private set; } } } diff --git a/NAudio.Wasapi/CoreAudioApi/AudioClientStreamFlags.cs b/NAudio.Wasapi/CoreAudioApi/AudioClientStreamFlags.cs index 4d8fd9cf..5a7d076e 100644 --- a/NAudio.Wasapi/CoreAudioApi/AudioClientStreamFlags.cs +++ b/NAudio.Wasapi/CoreAudioApi/AudioClientStreamFlags.cs @@ -54,6 +54,8 @@ public enum AudioClientStreamFlags : uint } + /* not currently used + /// /// AUDIOCLIENT_ACTIVATION_PARAMS /// https://docs.microsoft.com/en-us/windows/win32/api/audioclientactivationparams/ns-audioclientactivationparams-audioclient_activation_params @@ -79,6 +81,8 @@ struct AudioClientProcessLoopbackParams public ProcessLoopbackMode ProcessLoopbackMode; } + */ + /// /// PROCESS_LOOPBACK_MODE /// https://docs.microsoft.com/en-us/windows/win32/api/audioclientactivationparams/ne-audioclientactivationparams-process_loopback_mode