예제 #1
0
 /// <summary>
 /// Slides the pan of the specified channel.
 /// </summary>
 /// <param name="handle">The handle that represents the channel to slide.</param>
 /// <param name="pan">The channel's new pan.</param>
 /// <param name="time">The time over which to perform the slide.</param>
 public static void SlidePan(UInt32 handle, Single pan, TimeSpan time)
 {
     if (!BASSNative.ChannelSlideAttribute(handle, BASSAttrib.ATTRIB_PAN, pan, (uint)time.TotalMilliseconds))
     {
         throw new BASSException();
     }
 }
예제 #2
0
        /// <summary>
        /// Sets the pitch of the specified channel.
        /// </summary>
        /// <param name="handle">The handle that represents the channel to adjust.</param>
        /// <param name="pitch">The channel's new pitch.</param>
        public static void SetPitch(UInt32 handle, Single pitch)
        {
            if (BASSNative.ChannelIsSliding(handle, BASSAttrib.ATTRIB_TEMPO_PITCH))
            {
                if (!BASSNative.ChannelSlideAttribute(handle, BASSAttrib.ATTRIB_TEMPO_PITCH, pitch * SemitonesPerOctave, 0))
                {
                    throw new BASSException();
                }
            }
            else
            {
                if (!BASSNative.ChannelSetAttribute(handle, BASSAttrib.ATTRIB_TEMPO_PITCH, pitch * SemitonesPerOctave))
                {
                    throw new BASSException();
                }
            }

            var tempo = (Math.Pow(2.0, pitch) - 1.0) * 100.0;

            if (BASSNative.ChannelIsSliding(handle, BASSAttrib.ATTRIB_TEMPO))
            {
                if (!BASSNative.ChannelSlideAttribute(handle, BASSAttrib.ATTRIB_TEMPO, (float)tempo, 0))
                {
                    throw new BASSException();
                }
            }
            else
            {
                if (!BASSNative.ChannelSetAttribute(handle, BASSAttrib.ATTRIB_TEMPO, (float)tempo))
                {
                    throw new BASSException();
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Slides the pitch of the specified channel.
        /// </summary>
        /// <param name="handle">The handle that represents the channel to slide.</param>
        /// <param name="pitch">The channel's new pitch.</param>
        /// <param name="time">The time over which to perform the slide.</param>
        public static void SlidePitch(UInt32 handle, Single pitch, TimeSpan time)
        {
            if (!BASSNative.ChannelSlideAttribute(handle, BASSAttrib.ATTRIB_TEMPO_PITCH, pitch * SemitonesPerOctave, (uint)time.TotalMilliseconds))
            {
                throw new BASSException();
            }

            var tempo = (Math.Pow(2.0, pitch) - 1.0) * 100.0;

            if (!BASSNative.ChannelSlideAttribute(handle, BASSAttrib.ATTRIB_TEMPO, (float)tempo, (uint)time.TotalMilliseconds))
            {
                throw new BASSException();
            }
        }
예제 #4
0
 /// <summary>
 /// Sets the pan of the specified channel.
 /// </summary>
 /// <param name="handle">The handle that represents the channel to adjust.</param>
 /// <param name="pan">The channel's new pan.</param>
 public static void SetPan(UInt32 handle, Single pan)
 {
     if (BASSNative.ChannelIsSliding(handle, BASSAttrib.ATTRIB_PAN))
     {
         if (!BASSNative.ChannelSlideAttribute(handle, BASSAttrib.ATTRIB_PAN, pan, 0))
         {
             throw new BASSException();
         }
     }
     else
     {
         if (!BASSNative.ChannelSetAttribute(handle, BASSAttrib.ATTRIB_PAN, pan))
         {
             throw new BASSException();
         }
     }
 }
예제 #5
0
 /// <summary>
 /// Sets the volume of the specified channel.
 /// </summary>
 /// <param name="handle">The handle that represents the channel to adjust.</param>
 /// <param name="volume">The channel's new volume./</param>
 public static void SetVolume(UInt32 handle, Single volume)
 {
     if (BASSNative.ChannelIsSliding(handle, BASSAttrib.ATTRIB_VOL))
     {
         if (!BASSNative.ChannelSlideAttribute(handle, BASSAttrib.ATTRIB_VOL, volume, 0))
         {
             throw new BASSException();
         }
     }
     else
     {
         if (!BASSNative.ChannelSetAttribute(handle, BASSAttrib.ATTRIB_VOL, volume))
         {
             throw new BASSException();
         }
     }
 }