Exemplo n.º 1
0
        /// <summary>
        /// Gets the duration of the specified channel in seconds.
        /// </summary>
        /// <param name="handle">The handle of the channel to evaluate.</param>
        /// <returns>The duration of the specified channel in seconds.</returns>
        public static Double GetDurationInSeconds(UInt32 handle)
        {
            var length = BASSNative.ChannelGetLength(handle, 0);

            if (!BASSUtil.IsValidValue(length))
            {
                throw new BASSException();
            }

            var seconds = BASSNative.ChannelBytes2Seconds(handle, length);

            if (seconds < 0)
            {
                throw new BASSException();
            }

            return(seconds);
        }