Beispiel #1
0
        /// <summary>
        /// Call this function when you are ready to begin reading from the device buffer.
        /// </summary>
        /// <param name="areas">The memory area data can be read from.</param>
        /// <param name="frameCount">Positive number of frames to read, returns the number of frames that will be actually read.</param>
        /// <returns>Value indicating operation success.</returns>
        /// <remarks>
        /// Call this function only from the OnReadCallback thread context. When done reading from areas, call EndRead.
        /// </remarks>
        public SoundIoError BeginRead(out SoundIOChannelAreas areas, ref int frameCount)
        {
            IntPtr       head;
            SoundIoError result = NativeMethods.SoundIoInstreamBeginRead(handle, out head, ref frameCount);

            if (head == IntPtr.Zero)
            {
                areas = null;
            }
            else
            {
                areas = new SoundIOChannelAreas(head, Layout.ChannelCount, frameCount);
            }

            return(result);
        }
Beispiel #2
0
 internal static extern IntPtr SoundIoStrError(
     [In] SoundIoError error
     );
Beispiel #3
0
 static void SoundIo_OnBackendDisconnected(object sender, SoundIoError eventArgs)
 {
     Console.WriteLine("OnBackendDisconnect");
 }
Beispiel #4
0
 internal SoundIOException(SoundIoError errorCode)
     : base(Marshal.PtrToStringAnsi(Natives.soundio_error_name(errorCode)))
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SoundIOException"/> class with an error message
 /// adequate to specified error code and a reference to the inner exception that is the cause of this exception.
 /// </summary>
 /// <param name="error">Error code to retrieve error message for.</param>
 /// <param name="innerException">The exception that is the cause of the current exception.</param>
 public SoundIOException(SoundIoError error, Exception innerException)
     : base(error.GetErrorMessage(), innerException)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SoundIOException"/> class with an error message
 /// adequate to specified error code.
 /// </summary>
 /// <param name="error">Error code to retrieve error message for.</param>
 public SoundIOException(SoundIoError error)
     : base(error.GetErrorMessage())
 {
 }
 /// <summary>
 /// Retrieves string message for specified error.
 /// </summary>
 /// <param name="error">Error for which to retrieve message.</param>
 /// <returns>String message for specified error.</returns>
 public static string GetErrorMessage(this SoundIoError error)
 {
     return(Marshal.PtrToStringAnsi(NativeMethods.SoundIoStrError(error)));
 }