IAudioCaptureClient.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // -----------------------------------------
  2. // SoundScribe (TM) and related software.
  3. //
  4. // Copyright (C) 2007-2011 Vannatech
  5. // http://www.vannatech.com
  6. // All rights reserved.
  7. //
  8. // This source code is subject to the MIT License.
  9. // http://www.opensource.org/licenses/mit-license.php
  10. //
  11. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  17. // THE SOFTWARE.
  18. // -----------------------------------------
  19. using System;
  20. using System.Runtime.InteropServices;
  21. using Vannatech.CoreAudio.Enumerations;
  22. namespace Vannatech.CoreAudio.Interfaces
  23. {
  24. /// <summary>
  25. /// Enables a client to read input data from a capture endpoint buffer.
  26. /// </summary>
  27. /// <remarks>
  28. /// MSDN Reference: http://msdn.microsoft.com/en-us/library/dd370858.aspx
  29. /// </remarks>
  30. public partial interface IAudioCaptureClient
  31. {
  32. /// <summary>
  33. /// Retrieves a pointer to the next available packet of data in the capture endpoint buffer.
  34. /// </summary>
  35. /// <param name="dataPointer">Receives the starting address of a byte array containing the next data packet that is available for the client to read.</param>
  36. /// <param name="frameCount">Receives the number of audio frames available in the data packet</param>
  37. /// <param name="bufferStatus">Receives the buffer-status flags.</param>
  38. /// <param name="devicePosition">Receives the device position of the first audio frame in the data packet.</param>
  39. /// <param name="counterPosition">
  40. /// Receives the value of the performance counter at the time that the audio endpoint
  41. /// device recorded the device position of the first audio frame in the data packet.
  42. /// </param>
  43. /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
  44. [PreserveSig]
  45. int GetBuffer(
  46. [Out] [MarshalAs(UnmanagedType.SysInt)] out IntPtr dataPointer,
  47. [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 frameCount,
  48. [Out] [MarshalAs(UnmanagedType.U4)] out AUDCLNT_BUFFERFLAGS bufferStatus,
  49. [Out, Optional] [MarshalAs(UnmanagedType.U8)] out UInt64 devicePosition,
  50. [Out, Optional] [MarshalAs(UnmanagedType.U8)] out UInt64 counterPosition);
  51. /// <summary>
  52. /// Releases a buffer.
  53. /// </summary>
  54. /// <param name="numFramesRead">The number of audio frames that the client read from the capture buffer.</param>
  55. /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
  56. [PreserveSig]
  57. int ReleaseBuffer(
  58. [In] [MarshalAs(UnmanagedType.U4)] UInt32 numFramesRead);
  59. /// <summary>
  60. /// Retrieves the number of frames in the next data packet in the capture endpoint buffer.
  61. /// </summary>
  62. /// <param name="frameCount">Receives the number of audio frames in the next capture packet.</param>
  63. /// <returns>An HRESULT code indicating whether the operation passed of failed.</returns>
  64. [PreserveSig]
  65. int GetNextPacketSize(
  66. [Out] [MarshalAs(UnmanagedType.U4)] out UInt32 frameCount);
  67. }
  68. }