Skip to content

Commit a106da4

Browse files
committed
add missing XML docs for NAudio.Extras
1 parent fb1c044 commit a106da4

File tree

8 files changed

+113
-3
lines changed

8 files changed

+113
-3
lines changed

NAudio.Asio/ASIODriverExt.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public class AsioDriverExt
3131
private int bufferSize;
3232
private int outputChannelOffset;
3333
private int inputChannelOffset;
34+
/// <summary>
35+
/// Reset Request Callback
36+
/// </summary>
3437
public Action ResetRequestCallback;
3538

3639
/// <summary>

NAudio.Extras/AudioPlaybackEngine.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ public class AudioPlaybackEngine : IDisposable
1212
private readonly IWavePlayer outputDevice;
1313
private readonly MixingSampleProvider mixer;
1414

15+
/// <summary>
16+
/// Audio Playback Engine
17+
/// </summary>
1518
public AudioPlaybackEngine(int sampleRate = 44100, int channelCount = 2)
1619
{
1720
outputDevice = new WaveOutEvent();
@@ -21,6 +24,9 @@ public AudioPlaybackEngine(int sampleRate = 44100, int channelCount = 2)
2124
outputDevice.Play();
2225
}
2326

27+
/// <summary>
28+
/// Fire and forget playback of sound
29+
/// </summary>
2430
public void PlaySound(string fileName)
2531
{
2632
var input = new AudioFileReader(fileName);
@@ -40,6 +46,9 @@ private ISampleProvider ConvertToRightChannelCount(ISampleProvider input)
4046
throw new NotImplementedException("Not yet implemented this channel count conversion");
4147
}
4248

49+
/// <summary>
50+
/// Fire and forget playback of a cached sound
51+
/// </summary>
4352
public void PlaySound(CachedSound sound)
4453
{
4554
AddMixerInput(new CachedSoundSampleProvider(sound));
@@ -50,6 +59,9 @@ private void AddMixerInput(ISampleProvider input)
5059
mixer.AddMixerInput(ConvertToRightChannelCount(input));
5160
}
5261

62+
/// <summary>
63+
/// Disposes this instance
64+
/// </summary>
5365
public void Dispose()
5466
{
5567
outputDevice.Dispose();

NAudio.Extras/AutoDisposeFileReader.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ public class AutoDisposeFileReader : ISampleProvider
1111
{
1212
private readonly ISampleProvider reader;
1313
private bool isDisposed;
14+
15+
/// <summary>
16+
/// Creates a new file reader that disposes the source reader when it finishes
17+
/// </summary>
1418
public AutoDisposeFileReader(ISampleProvider reader)
1519
{
1620
this.reader = reader;
1721
WaveFormat = reader.WaveFormat;
1822
}
1923

24+
/// <summary>
25+
/// Reads samples from this file reader
26+
/// </summary>
2027
public int Read(float[] buffer, int offset, int count)
2128
{
2229
if (isDisposed)
@@ -33,6 +40,9 @@ public int Read(float[] buffer, int offset, int count)
3340
return read;
3441
}
3542

43+
/// <summary>
44+
/// The WaveFormat of this file reader
45+
/// </summary>
3646
public WaveFormat WaveFormat { get; }
3747
}
3848
}

NAudio.Extras/CachedSound.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,19 @@ namespace NAudio.Extras
99
/// </summary>
1010
public class CachedSound
1111
{
12+
/// <summary>
13+
/// Audio data
14+
/// </summary>
1215
public float[] AudioData { get; }
16+
17+
/// <summary>
18+
/// Format of the audio
19+
/// </summary>
1320
public WaveFormat WaveFormat { get; }
21+
22+
/// <summary>
23+
/// Creates a new CachedSound from a file
24+
/// </summary>
1425
public CachedSound(string audioFileName)
1526
{
1627
using (var audioFileReader = new AudioFileReader(audioFileName))

NAudio.Extras/Equalizer.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public class Equalizer : ISampleProvider
1818
private readonly int bandCount;
1919
private bool updated;
2020

21+
/// <summary>
22+
/// Creates a new Equalizer
23+
/// </summary>
2124
public Equalizer(ISampleProvider sourceProvider, EqualizerBand[] bands)
2225
{
2326
this.sourceProvider = sourceProvider;
@@ -43,14 +46,23 @@ private void CreateFilters()
4346
}
4447
}
4548

49+
/// <summary>
50+
/// Update the equalizer settings
51+
/// </summary>
4652
public void Update()
4753
{
4854
updated = true;
4955
CreateFilters();
5056
}
5157

58+
/// <summary>
59+
/// Gets the WaveFormat of this Sample Provider
60+
/// </summary>
5261
public WaveFormat WaveFormat => sourceProvider.WaveFormat;
5362

63+
/// <summary>
64+
/// Reads samples from this Sample Provider
65+
/// </summary>
5466
public int Read(float[] buffer, int offset, int count)
5567
{
5668
int samplesRead = sourceProvider.Read(buffer, offset, count);

NAudio.Extras/EqualizerBand.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
namespace NAudio.Extras
22
{
3+
/// <summary>
4+
/// Equalizer Band
5+
/// </summary>
36
public class EqualizerBand
47
{
8+
/// <summary>
9+
/// Frequency
10+
/// </summary>
511
public float Frequency { get; set; }
12+
/// <summary>
13+
/// Gain
14+
/// </summary>
615
public float Gain { get; set; }
16+
/// <summary>
17+
/// Bandwidth
18+
/// </summary>
719
public float Bandwidth { get; set; }
820
}
921
}

NAudio.Extras/SampleAggregator.cs

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,28 @@ namespace NAudio.Extras
1010
/// </summary>
1111
public class SampleAggregator : ISampleProvider
1212
{
13-
// volume
13+
/// <summary>
14+
/// Raised to indicate the maximum volume level in this period
15+
/// </summary>
1416
public event EventHandler<MaxSampleEventArgs> MaximumCalculated;
1517
private float maxValue;
1618
private float minValue;
19+
/// <summary>
20+
/// Notification count, number of samples between MaximumCalculated events
21+
/// </summary>
1722
public int NotificationCount { get; set; }
1823
int count;
1924

20-
// FFT
25+
/// <summary>
26+
/// Raised to indicate that a block of samples has had an FFT performed on it
27+
/// </summary>
2128
public event EventHandler<FftEventArgs> FftCalculated;
29+
30+
/// <summary>
31+
/// If true, performs an FFT on each block of samples
32+
/// </summary>
2233
public bool PerformFFT { get; set; }
34+
2335
private readonly Complex[] fftBuffer;
2436
private readonly FftEventArgs fftArgs;
2537
private int fftPos;
@@ -29,6 +41,11 @@ public class SampleAggregator : ISampleProvider
2941

3042
private readonly int channels;
3143

44+
/// <summary>
45+
/// Creates a new SampleAggregator
46+
/// </summary>
47+
/// <param name="source">source sample provider</param>
48+
/// <param name="fftLength">FFT length, must be a power of 2</param>
3249
public SampleAggregator(ISampleProvider source, int fftLength = 1024)
3350
{
3451
channels = source.WaveFormat.Channels;
@@ -48,7 +65,9 @@ static bool IsPowerOfTwo(int x)
4865
return (x & (x - 1)) == 0;
4966
}
5067

51-
68+
/// <summary>
69+
/// Reset the volume calculation
70+
/// </summary>
5271
public void Reset()
5372
{
5473
count = 0;
@@ -81,8 +100,14 @@ private void Add(float value)
81100
}
82101
}
83102

103+
/// <summary>
104+
/// Gets the WaveFormat of this Sample Provider
105+
/// </summary>
84106
public WaveFormat WaveFormat => source.WaveFormat;
85107

108+
/// <summary>
109+
/// Reads samples from this sample provider
110+
/// </summary>
86111
public int Read(float[] buffer, int offset, int count)
87112
{
88113
var samplesRead = source.Read(buffer, offset, count);
@@ -95,25 +120,46 @@ public int Read(float[] buffer, int offset, int count)
95120
}
96121
}
97122

123+
/// <summary>
124+
/// Max sample event args
125+
/// </summary>
98126
public class MaxSampleEventArgs : EventArgs
99127
{
128+
/// <summary>
129+
/// Creates a new MaxSampleEventArgs
130+
/// </summary>
100131
[DebuggerStepThrough]
101132
public MaxSampleEventArgs(float minValue, float maxValue)
102133
{
103134
MaxSample = maxValue;
104135
MinSample = minValue;
105136
}
137+
/// <summary>
138+
/// Maximum sample value in this period
139+
/// </summary>
106140
public float MaxSample { get; private set; }
141+
/// <summary>
142+
/// Minimum sample value in this period
143+
/// </summary>
107144
public float MinSample { get; private set; }
108145
}
109146

147+
/// <summary>
148+
/// FFT Event Args
149+
/// </summary>
110150
public class FftEventArgs : EventArgs
111151
{
152+
/// <summary>
153+
/// Creates a new FFTEventArgs
154+
/// </summary>
112155
[DebuggerStepThrough]
113156
public FftEventArgs(Complex[] result)
114157
{
115158
Result = result;
116159
}
160+
/// <summary>
161+
/// Result of FFT
162+
/// </summary>
117163
public Complex[] Result { get; private set; }
118164
}
119165
}

NAudio.Wasapi/CoreAudioApi/AudioClientStreamFlags.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public enum AudioClientStreamFlags : uint
5454

5555
}
5656

57+
/* not currently used
58+
5759
/// <summary>
5860
/// AUDIOCLIENT_ACTIVATION_PARAMS
5961
/// https://docs.microsoft.com/en-us/windows/win32/api/audioclientactivationparams/ns-audioclientactivationparams-audioclient_activation_params
@@ -79,6 +81,8 @@ struct AudioClientProcessLoopbackParams
7981
public ProcessLoopbackMode ProcessLoopbackMode;
8082
}
8183
84+
*/
85+
8286
/// <summary>
8387
/// PROCESS_LOOPBACK_MODE
8488
/// https://docs.microsoft.com/en-us/windows/win32/api/audioclientactivationparams/ne-audioclientactivationparams-process_loopback_mode

0 commit comments

Comments
 (0)