/// <summary> /// Scan <paramref name="sndfile"/> file and return single peak value for each channel. /// </summary> /// <param name="sndfile">Audio file we want to scan.</param> /// <param name="channels">Number of audio channels in the audio file.</param> /// <returns>Peak values for each channel.</returns> public double[] CalcMaxAllChannels(IntPtr sndfile, int channels) { if (sndfile == IntPtr.Zero) { throw new ArgumentException("File handle is invalid/closed."); } if (channels <= 0) { throw new ArgumentOutOfRangeException("channels", channels, "Channels must be greater than zero."); } var max = m_Api.CalcMaxAllChannels(sndfile, channels); if (max == null || max.Length == 0) { throw new LibsndfileException("Unable to retrieve signal max for all channels."); } return(max); }