예제 #1
0
        /// <summary>
        /// Attempts to open an audio file at the <paramref name="path"/> location 
        /// with <paramref name="mode"/> based file access.
        /// </summary>
        /// <param name="path">Fully qualified path to location of audio file.</param>
        /// <param name="mode">File access to use when opening this file. ReadItems/Write/ReadWrite.</param>
        /// <param name="info"><see cref="LibsndfileInfo"/> structure contains information about the file we are opening.</param>
        /// <returns>Returns pointer to an internal object used by libsndfile that we can interact with.</returns>
        public IntPtr Open(string path, LibsndfileMode mode, ref LibsndfileInfo info)
        {
            if (string.IsNullOrEmpty(path))
                throw new ArgumentNullException("path", "Path cannot be null/empty.");

            return m_Api.Open(path, mode, ref info);
        }
예제 #2
0
        /// <summary>
        /// Attempts to open an audio file at the <paramref name="path"/> location
        /// with <paramref name="mode"/> based file access.
        /// </summary>
        /// <param name="path">Fully qualified path to location of audio file.</param>
        /// <param name="mode">File access to use when opening this file. ReadItems/Write/ReadWrite.</param>
        /// <param name="info"><see cref="LibsndfileInfo"/> structure contains information about the file we are opening.</param>
        /// <returns>Returns pointer to an internal object used by libsndfile that we can interact with.</returns>
        public IntPtr Open(string path, LibsndfileMode mode, ref LibsndfileInfo info)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException("path", "Path cannot be null/empty.");
            }

            return(m_Api.Open(path, mode, ref info));
        }
예제 #3
0
        /// <summary>
        /// Attempts to open an audio file with the <paramref name="handle"/> file descriptor
        /// using <paramref name="mode"/> based file access.
        /// </summary>
        /// <param name="handle">File descriptor handle</param>
        /// <param name="mode">File access to use when opening this file. ReadItems/Write/ReadWrite</param>
        /// <param name="info"><see cref="LibsndfileInfo"/> structure contains information about the file we are opening.</param>
        /// <param name="closeHandle">Decide if we want libsndfile to close the file descriptor for us.</param>
        /// <returns>Returns pointer to an internal object used by libsndfile that we can interact with.</returns>
        public IntPtr OpenFileDescriptor(int handle, LibsndfileMode mode, ref LibsndfileInfo info, int closeHandle)
        {
            if (handle <= 0)
            {
                throw new ArgumentOutOfRangeException("handle", "File handle cannot be zero/non-negative.");
            }

            return(m_Api.OpenFileDescriptor(handle, mode, ref info, closeHandle));
        }
        /// <summary>
        /// Set the GUID of a the <paramref name="sndfile"/> WAVEX file to indicate an Ambisonic format.
        /// </summary>
        /// <param name="sndfile">Audio file to set ambisonic format of.</param>
        /// <param name="mode">Ambisonic format to use.</param>
        /// <returns>Success of setting ambisonic format for the given file.</returns>
        public bool SetAmbisonic(IntPtr sndfile, LibsndfileMode mode)
        {
            var retval = m_Api.Command(sndfile, LibsndfileCommand.WavexSetAmbisonic, IntPtr.Zero, (int)mode);

            if (!LibsndfileCommandUtilities.IsValidResult(sndfile, LibsndfileCommand.WavexSetAmbisonic, retval))
            {
                throw new LibsndfileException("Unable to set ambisonic format for the given file.");
            }

            return((LibsndfileMode)retval == mode);
        }
예제 #5
0
        /// <summary>
        /// Set the GUID of a the <paramref name="sndfile"/> WAVEX file to indicate an Ambisonic format.
        /// </summary>
        /// <param name="sndfile">Audio file to set ambisonic format of.</param>
        /// <param name="mode">Ambisonic format to use.</param>
        /// <returns>Success of setting ambisonic format for the given file.</returns>
        public bool SetAmbisonic(IntPtr sndfile, LibsndfileMode mode)
        {
            if (sndfile == IntPtr.Zero)
            {
                throw new ArgumentException("File handle is invalid/closed.");
            }
            if (mode != LibsndfileMode.AmbisonicNone || mode != LibsndfileMode.AmbisonicBFormat)
            {
                throw new ArgumentException("Mode must be set.");
            }

            return(m_Api.SetAmbisonic(sndfile, mode));
        }
예제 #6
0
 internal static extern IntPtr sf_open(string path, LibsndfileMode mode, ref LibsndfileInfo info);
예제 #7
0
 internal static extern IntPtr sf_open_fd(int handle, LibsndfileMode mode, ref LibsndfileInfo info, int closeHandle);
예제 #8
0
 internal static extern IntPtr sf_open_fd(int handle, LibsndfileMode mode, ref LibsndfileInfo info, int closeHandle);
예제 #9
0
        /// <summary>
        /// Set the GUID of a the <paramref name="sndfile"/> WAVEX file to indicate an Ambisonic format.
        /// </summary>
        /// <param name="sndfile">Audio file to set ambisonic format of.</param>
        /// <param name="mode">Ambisonic format to use.</param>
        /// <returns>Success of setting ambisonic format for the given file.</returns>
        public bool SetAmbisonic(IntPtr sndfile, LibsndfileMode mode)
        {
            if (sndfile == IntPtr.Zero)
                throw new ArgumentException("File handle is invalid/closed.");
            if (mode != LibsndfileMode.AmbisonicNone || mode != LibsndfileMode.AmbisonicBFormat)
                throw new ArgumentException("Mode must be set.");

            return m_Api.SetAmbisonic(sndfile, mode);
        }
예제 #10
0
        /// <summary>
        /// Attempts to open an audio file with the <paramref name="handle"/> file descriptor 
        /// using <paramref name="mode"/> based file access.
        /// </summary>
        /// <param name="handle">File descriptor handle</param>
        /// <param name="mode">File access to use when opening this file. ReadItems/Write/ReadWrite</param>
        /// <param name="info"><see cref="LibsndfileInfo"/> structure contains information about the file we are opening.</param>
        /// <param name="closeHandle">Decide if we want libsndfile to close the file descriptor for us.</param>
        /// <returns>Returns pointer to an internal object used by libsndfile that we can interact with.</returns>
        public IntPtr OpenFileDescriptor(int handle, LibsndfileMode mode, ref LibsndfileInfo info, int closeHandle)
        {
            if (handle <= 0)
                throw new ArgumentOutOfRangeException("handle", "File handle cannot be zero/non-negative.");

            return m_Api.OpenFileDescriptor(handle, mode, ref info, closeHandle);
        }
예제 #11
0
 internal static extern IntPtr sf_open(string path, LibsndfileMode mode, ref LibsndfileInfo info);
예제 #12
0
 internal static extern unsafe IntPtr sf_open_virtual(ref SF_VIRTUAL_IO sfvirtual, LibsndfileMode mode, ref LibsndfileInfo info, void* userData);
 /// <summary>
 /// Attempts to open an audio file at the <paramref name="path"/> location
 /// with <paramref name="mode"/> based file access.
 /// </summary>
 /// <param name="path">Fully qualified path to location of audio file.</param>
 /// <param name="mode">File access to use when opening this file. ReadItems/Write/ReadWrite.</param>
 /// <param name="info"><see cref="LibsndfileInfo"/> structure contains information about the file we are opening.</param>
 /// <returns>Returns pointer to an internal object used by libsndfile that we can interact with.</returns>
 public IntPtr Open(string path, LibsndfileMode mode, ref LibsndfileInfo info)
 {
     return(LibsndfileApiNative.sf_open(path, mode, ref info));
 }
예제 #14
0
 public unsafe IntPtr OpenVirtual(ref SF_VIRTUAL_IO sfvirtual, LibsndfileMode mode, ref LibsndfileInfo info, void* userData)
 {
     return m_Api.OpenVirtual(ref sfvirtual, mode, ref info, userData);
 }
예제 #15
0
 /// <summary>
 /// Attempts to open an audio file with the <paramref name="handle"/> file descriptor 
 /// using <paramref name="mode"/> based file access.
 /// </summary>
 /// <param name="handle">File descriptor handle</param>
 /// <param name="mode">File access to use when opening this file. ReadItems/Write/ReadWrite</param>
 /// <param name="info"><see cref="LibsndfileInfo"/> structure contains information about the file we are opening.</param>
 /// <param name="closeHandle">Decide if we want libsndfile to close the file descriptor for us.</param>
 /// <returns>Returns pointer to an internal object used by libsndfile that we can interact with.</returns>
 public IntPtr OpenFileDescriptor(int handle, LibsndfileMode mode, ref LibsndfileInfo info, int closeHandle)
 {
     return LibsndfileApiNative.sf_open_fd(handle, mode, ref info, closeHandle);
 }
예제 #16
0
 /// <summary>
 /// Attempts to open an audio file at the <paramref name="path"/> location 
 /// with <paramref name="mode"/> based file access.
 /// </summary>
 /// <param name="path">Fully qualified path to location of audio file.</param>
 /// <param name="mode">File access to use when opening this file. ReadItems/Write/ReadWrite.</param>
 /// <param name="info"><see cref="LibsndfileInfo"/> structure contains information about the file we are opening.</param>
 /// <returns>Returns pointer to an internal object used by libsndfile that we can interact with.</returns>
 public IntPtr Open(string path, LibsndfileMode mode, ref LibsndfileInfo info)
 {
     return LibsndfileApiNative.sf_open(path, mode, ref info);
 }
        /// <summary>
        /// Set the GUID of a the <paramref name="sndfile"/> WAVEX file to indicate an Ambisonic format.
        /// </summary>
        /// <param name="sndfile">Audio file to set ambisonic format of.</param>
        /// <param name="mode">Ambisonic format to use.</param>
        /// <returns>Success of setting ambisonic format for the given file.</returns>
        public bool SetAmbisonic(IntPtr sndfile, LibsndfileMode mode)
        {
            var retval = m_Api.Command(sndfile, LibsndfileCommand.WavexSetAmbisonic, IntPtr.Zero, (int)mode);
            if (!LibsndfileCommandUtilities.IsValidResult(sndfile, LibsndfileCommand.WavexSetAmbisonic, retval))
                throw new LibsndfileException("Unable to set ambisonic format for the given file.");

            return ((LibsndfileMode)retval == mode);
        }
 /// <summary>
 /// Attempts to open an audio file with the <paramref name="handle"/> file descriptor
 /// using <paramref name="mode"/> based file access.
 /// </summary>
 /// <param name="handle">File descriptor handle</param>
 /// <param name="mode">File access to use when opening this file. ReadItems/Write/ReadWrite</param>
 /// <param name="info"><see cref="LibsndfileInfo"/> structure contains information about the file we are opening.</param>
 /// <param name="closeHandle">Decide if we want libsndfile to close the file descriptor for us.</param>
 /// <returns>Returns pointer to an internal object used by libsndfile that we can interact with.</returns>
 public IntPtr OpenFileDescriptor(int handle, LibsndfileMode mode, ref LibsndfileInfo info, int closeHandle)
 {
     return(LibsndfileApiNative.sf_open_fd(handle, mode, ref info, closeHandle));
 }