Ejemplo n.º 1
0
        /// <summary>
        /// Fades in a sample the specified number of times using
        /// the first available channel, stopping after the
        /// specified number of ms
        /// </summary>
        /// <param name="milliseconds">
        /// The number of milliseconds to fade in for
        /// </param>
        /// <param name="loops">The number of loops.
        /// Specify 1 to have the sample play twice</param>
        /// <param name="ticks">The time limit in milliseconds</param>
        /// <returns>The channel used to play the sample</returns>
        public Channel FadeInTimed(int milliseconds, int loops, int ticks)
        {
            int index = SdlMixer.Mix_FadeInChannelTimed(Mixer.FindAvailableChannel(), this.Handle, loops, milliseconds, ticks);

            if (index == (int)SdlFlag.Error)
            {
                throw SdlException.Generate();
            }
            this.channels++;
            return(new Channel(index));
        }
Ejemplo n.º 2
0
        public void FadeInChannelTimed()
        {
            InitAudio();
            int    result   = SdlMixer.Mix_GroupChannels(0, 7, 1);
            IntPtr chunkPtr = SdlMixer.Mix_LoadWAV("test.wav");

            result = SdlMixer.Mix_FadeInChannelTimed(1, chunkPtr, -1, 0, -1);
            Thread.Sleep(500);
            Console.WriteLine("PlayChannel: " + result.ToString());
            Assert.IsTrue(result != -1);
            QuitAudio();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Fades in a sound the specified number of times on
        /// a specific channel, stopping after the specified number of ms
        /// </summary>
        /// <param name="sound">The sound to play</param>
        /// <param name="milliseconds">The number of milliseconds to fade in for
        /// </param>
        /// <param name="loops">The number of loops.
        /// Specify 1 to have the sound play twice</param>
        /// <param name="ticks">The time limit in milliseconds</param>
        /// <returns>The channel used to play the sound</returns>
        /// <remarks></remarks>
        public int FadeIn(BaseSdlResource sound, int milliseconds, int loops, int ticks)
        {
            if (sound == null)
            {
                throw new ArgumentNullException("sound");
            }
            int ret = SdlMixer.Mix_FadeInChannelTimed(this.index, sound.Handle, loops, milliseconds, ticks);

            if (ret == (int)SdlFlag.Error)
            {
                throw SdlException.Generate();
            }
            return(ret);
        }