示例#1
0
 /// <summary>
 /// Retrieves a pointer to the next available packet of data in the capture endpoint buffer.
 /// http: //msdn.microsoft.com/en-us/library/dd370859(v=vs.85).aspx
 /// </summary>
 /// <remarks>
 /// Use Marshal.Copy to convert the pointer to the buffer into an array.
 /// </remarks>
 public IntPtr GetBuffer(out UInt32 framesRead, out AudioClientBufferFlags flags, out UInt64 devicePosition, out UInt64 qpcPosition)
 {
     IntPtr data;
     int result = GetBufferNative(out data, out framesRead, out flags, out devicePosition, out qpcPosition);
     CoreAudioAPIException.Try(result, c, "GetBuffer");
     return data;
 }
        /// <summary>
        /// バッファの中の現在の1パケットを取得する
        /// <remarks>バッファ内の全データを取得するには、NextPacketSizeが0になるまでGetBuffer()を繰り返す必要がある</remarks>
        /// </summary>
        /// <param name="data">取得したデータのバイト列</param>
        /// <param name="numFramesToRead">取得したデータのフレーム数(ブロック単位)</param>
        /// <param name="flags"></param>
        /// <param name="devicePosition"></param>
        /// <param name="qpcPosition"></param>
        public void GetBuffer(
            out byte[] data,
            out uint numFramesToRead,
            out AudioClientBufferFlags flags,
            out ulong devicePosition,
            out ulong qpcPosition)
        {
            lock (_lockObj)
            {
                IntPtr p;
                int hr = _RealClient.GetBuffer(
                    out p, out numFramesToRead,
                    out flags, out devicePosition,
                    out qpcPosition);
                Marshal.ThrowExceptionForHR(hr);
                if (numFramesToRead == 0)
                {
                    data = new byte[0];
                }
                else
                {
                    int byteSize = (int)numFramesToRead * _Parent.MixFormat.nBlockAlign;
                    data = new byte[byteSize];
                    Marshal.Copy(p, data, 0, byteSize);
                }

                hr = _RealClient.ReleaseBuffer(numFramesToRead);
                Marshal.ThrowExceptionForHR(hr);
            }
        }
示例#3
0
 /// <summary>
 /// Gets a pointer to the buffer
 /// </summary>
 /// <param name="numFramesToRead">Number of frames to read</param>
 /// <param name="bufferFlags">Buffer flags</param>
 /// <returns>Pointer to the buffer</returns>
 public IntPtr GetBuffer(
     out int numFramesToRead,
     out AudioClientBufferFlags bufferFlags)
 {
     IntPtr bufferPointer;
     long devicePosition;
     long qpcPosition;
     Marshal.ThrowExceptionForHR(audioCaptureClientInterface.GetBuffer(out bufferPointer, out numFramesToRead, out bufferFlags, out devicePosition, out qpcPosition));
     return bufferPointer;
 }
示例#4
0
 /// <summary>
 ///     Retrieves a pointer to the next available packet of data in the capture endpoint buffer.
 ///     For more information see
 ///     <see href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd370859%28v=vs.85%29.aspx" />.
 /// </summary>
 /// <param name="data">
 ///     A pointer variable into which the method writes the starting address of the next data
 ///     packet that is available for the client to read.
 /// </param>
 /// <param name="numFramesRead">
 ///     Variable into which the method writes the frame count (the number of audio frames
 ///     available in the data packet). The client should either read the entire data packet or none of it.
 /// </param>
 /// <param name="flags">Variable into which the method writes the buffer-status flags.</param>
 /// <param name="devicePosition">
 ///     Variable into which the method writes the device position of the first audio frame in the
 ///     data packet. The device position is expressed as the number of audio frames from the start of the stream.
 /// </param>
 /// <param name="qpcPosition">
 ///     Variable into which the method writes the value of the performance counter at the time that
 ///     the audio endpoint device recorded the device position of the first audio frame in the data packet.
 /// </param>
 /// <returns>HRESULT</returns>
 public unsafe int GetBufferNative(out IntPtr data, out Int32 numFramesRead, out AudioClientBufferFlags flags,
     out Int64 devicePosition, out Int64 qpcPosition)
 {
     fixed (void* d = &data, p0 = &numFramesRead, p1 = &flags)
     {
         fixed (void* p2 = &devicePosition, p3 = &qpcPosition)
         {
             return InteropCalls.CallI(UnsafeBasePtr, d, p0, p1, p2, p3, ((void**) (*(void**) UnsafeBasePtr))[3]);
         }
     }
 }
示例#5
0
 /// <summary>
 ///     Retrieves a pointer to the next available packet of data in the capture endpoint buffer.
 ///     For more information see
 ///     <see href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd370859%28v=vs.85%29.aspx" />.
 /// </summary>
 /// <param name="framesRead">
 ///     Variable into which the method writes the frame count (the number of audio frames available in
 ///     the data packet). The client should either read the entire data packet or none of it.
 /// </param>
 /// <param name="flags">Variable into which the method writes the buffer-status flags.</param>
 /// <returns>
 ///     Pointer to a variable which stores the starting address of the next data packet that is available for the
 ///     client to read.
 /// </returns>
 /// <remarks>
 ///     Use Marshal.Copy to convert the pointer to the buffer into an array.
 /// </remarks>
 public IntPtr GetBuffer(out int framesRead, out AudioClientBufferFlags flags)
 {
     Int64 p0, p1;
     return GetBuffer(out framesRead, out flags, out p0, out p1);
 }
示例#6
0
 /// <summary>
 /// The ReleaseBuffer method releases the buffer space acquired in the previous call to the
 /// IAudioRenderClient::GetBuffer method.
 /// </summary>
 public void ReleaseBuffer(int numFramesWritter, AudioClientBufferFlags flags)
 {
     CoreAudioAPIException.Try(ReleaseBufferInternal(numFramesWritter, flags), c, "ReleaseBuffer");
 }
示例#7
0
 /// <summary>
 /// The ReleaseBuffer method releases the buffer space acquired in the previous call to the
 /// IAudioRenderClient::GetBuffer method.
 /// </summary>
 /// <returns>HRESULT</returns>
 public unsafe int ReleaseBufferInternal(int numFramesWritten, AudioClientBufferFlags flags)
 {
     return InteropCalls.CallI(_basePtr, unchecked(numFramesWritten), unchecked(flags), ((void**)(*(void**)_basePtr))[4]);
 }
示例#8
0
 public void ReleaseBuffer(uint numFramesWritten, AudioClientBufferFlags flags)
 {
     int hr = _RealClient.ReleaseBuffer(numFramesWritten, flags);
     Marshal.ThrowExceptionForHR(hr);
 }
示例#9
0
 /// <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)
 {
     Marshal.ThrowExceptionForHR(audioRenderClientInterface.ReleaseBuffer(numFramesWritten, bufferFlags));
 }
示例#10
0
        public void ReleaseBuffer(uint numFramesWritten, AudioClientBufferFlags flags)
        {
            int hr = _RealClient.ReleaseBuffer(numFramesWritten, flags);

            Marshal.ThrowExceptionForHR(hr);
        }
示例#11
0
 /// <summary>
 /// The ReleaseBuffer method releases the buffer space acquired in the previous call to the
 /// IAudioRenderClient::GetBuffer method.
 /// </summary>
 public void ReleaseBuffer(int numFramesWritter, AudioClientBufferFlags flags)
 {
     CoreAudioAPIException.Try(ReleaseBufferInternal(numFramesWritter, flags), c, "ReleaseBuffer");
 }
示例#12
0
 /// <summary>
 /// The ReleaseBuffer method releases the buffer space acquired in the previous call to the
 /// IAudioRenderClient::GetBuffer method.
 /// </summary>
 /// <returns>HRESULT</returns>
 public unsafe int ReleaseBufferInternal(int numFramesWritten, AudioClientBufferFlags flags)
 {
     return(InteropCalls.CallI(_basePtr, unchecked (numFramesWritten), unchecked (flags), ((void **)(*(void **)_basePtr))[4]));
 }
示例#13
0
 internal static unsafe int CallI(void *_basePtr, int p1, AudioClientBufferFlags audioClientBufferFlags, void *p2)
 {
     throw new NotImplementedException();
 }
示例#14
0
 /// <summary>
 ///     Releases the buffer space acquired in the previous call to the
 ///     <see cref="GetBuffer" /> method.
 /// </summary>
 /// <param name="numFramesWritten">
 ///     The number of audio frames written by the client to the data packet.
 ///     The value of this parameter must be less than or equal to the size of the data packet, as specified in the
 ///     <c>numFramesRequested</c> parameter passed to the <see cref="GetBuffer" /> method.
 /// </param>
 /// <param name="flags">The buffer-configuration flags.</param>
 public void ReleaseBuffer(int numFramesWritten, AudioClientBufferFlags flags)
 {
     CoreAudioAPIException.Try(ReleaseBufferNative(numFramesWritten, flags), InterfaceName, "ReleaseBuffer");
 }
示例#15
0
 /// <summary>
 ///     Releases the buffer space acquired in the previous call to the
 ///     <see cref="GetBuffer" /> method.
 /// </summary>
 /// <param name="numFramesWritten">
 ///     The number of audio frames written by the client to the data packet.
 ///     The value of this parameter must be less than or equal to the size of the data packet, as specified in the
 ///     <c>numFramesRequested</c> parameter passed to the <see cref="GetBuffer" /> method.
 /// </param>
 /// <param name="flags">The buffer-configuration flags.</param>
 /// <returns>HRESULT</returns>
 public unsafe int ReleaseBufferNative(int numFramesWritten, AudioClientBufferFlags flags)
 {
     return(LocalInterop.Calli(UnsafeBasePtr, unchecked (numFramesWritten), unchecked (flags),
                               ((void **)(*(void **)UnsafeBasePtr))[4]));
 }
示例#16
0
 internal static unsafe int CallI(void* _basePtr, int p1, AudioClientBufferFlags audioClientBufferFlags, void* p2)
 {
     throw new NotImplementedException();
 }
 /// <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)
 {
     Marshal.ThrowExceptionForHR(audioRenderClientInterface.ReleaseBuffer(numFramesWritten, bufferFlags));
 }
示例#18
0
 /// <summary>
 ///     Releases the buffer space acquired in the previous call to the
 ///     <see cref="GetBuffer" /> method.
 /// </summary>
 /// <param name="numFramesWritten">
 ///     The number of audio frames written by the client to the data packet.
 ///     The value of this parameter must be less than or equal to the size of the data packet, as specified in the
 ///     <c>numFramesRequested</c> parameter passed to the <see cref="GetBuffer" /> method.
 /// </param>
 /// <param name="flags">The buffer-configuration flags.</param>
 public void ReleaseBuffer(int numFramesWritten, AudioClientBufferFlags flags)
 {
     CoreAudioAPIException.Try(ReleaseBufferNative(numFramesWritten, flags), InterfaceName, "ReleaseBuffer");
 }
 /// <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);
 }
示例#20
0
        /// <summary>
        ///     Retrieves a pointer to the next available packet of data in the capture endpoint buffer.
        ///     For more information see
        ///     <see href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd370859%28v=vs.85%29.aspx" />.
        /// </summary>
        /// <param name="framesRead">
        ///     Variable into which the method writes the frame count (the number of audio frames available in
        ///     the data packet). The client should either read the entire data packet or none of it.
        /// </param>
        /// <param name="flags">Variable into which the method writes the buffer-status flags.</param>
        /// <returns>
        ///     Pointer to a variable which stores the starting address of the next data packet that is available for the
        ///     client to read.
        /// </returns>
        /// <remarks>
        ///     Use Marshal.Copy to convert the pointer to the buffer into an array.
        /// </remarks>
        public IntPtr GetBuffer(out int framesRead, out AudioClientBufferFlags flags)
        {
            Int64 p0, p1;

            return(GetBuffer(out framesRead, out flags, out p0, out p1));
        }