mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
2.0.7
This commit is contained in:
60
CUETools.Codecs.CoreAudio/CoreAudioApi/AudioRenderClient.cs
Normal file
60
CUETools.Codecs.CoreAudio/CoreAudioApi/AudioRenderClient.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using NAudio.CoreAudioApi.Interfaces;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace NAudio.CoreAudioApi
|
||||
{
|
||||
/// <summary>
|
||||
/// Audio Render Client
|
||||
/// </summary>
|
||||
public class AudioRenderClient : IDisposable
|
||||
{
|
||||
IAudioRenderClient audioRenderClientInterface;
|
||||
|
||||
internal AudioRenderClient(IAudioRenderClient audioRenderClientInterface)
|
||||
{
|
||||
this.audioRenderClientInterface = audioRenderClientInterface;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a pointer to the buffer
|
||||
/// </summary>
|
||||
/// <param name="numFramesRequested">Number of frames requested</param>
|
||||
/// <returns>Pointer to the buffer</returns>
|
||||
public IntPtr GetBuffer(int numFramesRequested)
|
||||
{
|
||||
return audioRenderClientInterface.GetBuffer(numFramesRequested);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Release buffer
|
||||
/// </summary>
|
||||
/// <param name="numFramesWritten">Number of frames written</param>
|
||||
/// <param name="bufferFlags">Buffer flags</param>
|
||||
public void ReleaseBuffer(int numFramesWritten,AudioClientBufferFlags bufferFlags)
|
||||
{
|
||||
audioRenderClientInterface.ReleaseBuffer(numFramesWritten, bufferFlags);
|
||||
}
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
/// <summary>
|
||||
/// Release the COM object
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
if (audioRenderClientInterface != null)
|
||||
{
|
||||
// althugh GC would do this for us, we want it done now
|
||||
// to let us reopen WASAPI
|
||||
Marshal.ReleaseComObject(audioRenderClientInterface);
|
||||
audioRenderClientInterface = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user