/// <summary> /// Attempts to execute the <paramref name="command"/> against the <paramref name="sndfile"/> audio /// file while either passing or receiving data through the <paramref name="data"/> buffer. /// </summary> /// <param name="sndfile">Audio file we run this command against. /// Use NULL if you wish to run a static command against the library.</param> /// <param name="command"><see cref="NLibsndfile.Native.LibsndfileCommand"/> to run against the given audio file.</param> /// <param name="data">Ref long(long*) buffer passing or receiving data based on <paramref name="command"/> specifications.</param> /// <param name="size">Size, in bytes, of a long.</param> /// <returns>Returns a specific value based on the <paramref name="command"/>.</returns> public int Command(IntPtr sndfile, LibsndfileCommand command, ref long data, int size) { if (sndfile == IntPtr.Zero && !LibsndfileCommandUtilities.IsStaticCommand(command)) { throw new ArgumentException("File handle is invalid/closed."); } var retval = m_Api.Command(sndfile, command, ref data, size); if (!LibsndfileCommandUtilities.IsValidResult(sndfile, command, retval)) { throw new LibsndfileException(string.Format("Command {0} returned an invalid result.", command)); } return(retval); }
/// <summary> /// Attempts to execute the <paramref name="command"/> against the <paramref name="sndfile"/> audio /// file while either passing or receiving data through the <paramref name="data"/> buffer. /// </summary> /// <param name="sndfile">Audio file we run this command against. /// Use NULL if you wish to run a static command against the library.</param> /// <param name="command"><see cref="NLibsndfile.Native.LibsndfileCommand"/> to execute</param> /// <param name="data">Double[](double*) buffer passing or receiving data based on <paramref name="command"/> specifications.</param> /// <param name="size">Size, in bytes, of (double * buffer length)</param> /// <returns>Returns a specific value based on the <paramref name="command"/>.</returns> public int Command(IntPtr sndfile, LibsndfileCommand command, double[] data, int size) { if (sndfile == IntPtr.Zero && !LibsndfileCommandUtilities.IsStaticCommand(command)) { throw new ArgumentException("File handle is invalid/closed."); } if (data == null) { throw new ArgumentNullException("data", "Data cannot be null."); } if (data.Length == 0) { throw new ArgumentNullException("data", "Data must be initialized."); } var retval = m_Api.Command(sndfile, command, data, size); if (!LibsndfileCommandUtilities.IsValidResult(sndfile, command, retval)) { throw new LibsndfileException(string.Format("Command {0} returned an invalid result.", command)); } return(retval); }