forked from hughpyle/inguz-DSPUtil
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Reverser.cs
44 lines (40 loc) · 1.02 KB
/
Reverser.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.Text;
// Copyright (c) 2006 by Hugh Pyle, inguzaudio.com
namespace DSPUtil
{
[Serializable]
public class Reverser : SoundObj
{
private List<ISample> _data;
public Reverser()
{
_data = new List<ISample>();
}
/// <summary>
/// Get an iterator for samples
/// </summary>
public override IEnumerator<ISample> Samples
{
get
{
if (_input == null)
{
yield break;
}
// Read the whole input into our buffer
foreach (ISample sample in Input)
{
_data.Add(sample);
}
// Write them back out in reverse order
_data.Reverse();
foreach (ISample sample in _data)
{
yield return sample;
}
}
}
}
}