29 lines
642 B
C#
29 lines
642 B
C#
|
using System;
|
|||
|
namespace AudioStreamer
|
|||
|
{
|
|||
|
public abstract class BaseAudioOutput : AudioOutput
|
|||
|
{
|
|||
|
public BaseAudioOutput()
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
public event NewAudioAvailable NewAudioAvailable;
|
|||
|
|
|||
|
protected void pumpAudio(Int16[] samples)
|
|||
|
{
|
|||
|
if (NewAudioAvailable != null)
|
|||
|
{
|
|||
|
if (NewAudioAvailable.GetInvocationList().Length == 1){
|
|||
|
NewAudioAvailable.Invoke(this, samples);
|
|||
|
} else {
|
|||
|
foreach (Delegate d in NewAudioAvailable.GetInvocationList()){
|
|||
|
Int16[] copy = new Int16[samples.Length];
|
|||
|
Array.Copy(samples,copy,samples.Length);
|
|||
|
d.Method.Invoke(d.Target, new object[] { copy });
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|