Beispiel #1
0
        /// <summary>
        /// Gets the position of the specified channel.
        /// </summary>
        /// <param name="handle">The handle of the channel to evaluate.</param>
        /// <returns>The current position of the channel in seconds.</returns>
        public static Double GetPositionInSeconds(UInt32 handle)
        {
            var position = BASSNative.ChannelGetPosition(handle, 0);

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

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

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

            return(seconds);
        }
Beispiel #2
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);
        }