コード例 #1
0
ファイル: Coin.cs プロジェクト: smldev/smlimitless
        public override void Initialize(Section owner)
        {
            graphics = (AnimatedGraphicsObject)ContentPackageManager.GetGraphicsResource("SMBCoin");
            IsMoving = false;
            collectSound = new CachedSound(ContentPackageManager.GetAbsoluteFilePath("nsmbwiiCoin"));

            base.Initialize(owner);
        }
コード例 #2
0
 /// <summary>
 ///   Initializes a new instance of the <see
 ///   cref="CachedSoundSampleProvider" /> class.
 /// </summary>
 /// <param name="cachedSound">The sound to provide samples from.</param>
 public CachedSoundSampleProvider(CachedSound cachedSound)
 {
     this.cachedSound = cachedSound;
 }
コード例 #3
0
ファイル: SectionExit.cs プロジェクト: smldev/smlimitless
        /// <summary>
        ///   Initializes a new instance of the <see cref="SectionExit" /> class.
        /// </summary>
        /// <param name="owner">The section this exit is in.</param>
        public SectionExit(Section owner)
        {
            Owner = owner;

            warpSound = new CachedSound(ContentPackageManager.GetAbsoluteFilePath("nsmbwiiWarpPipe"));
        }
コード例 #4
0
ファイル: Sound.cs プロジェクト: smldev/smlimitless
 /// <summary>
 ///   Initializes this sound.
 /// </summary>
 public void Initialize()
 {
     soundData = new CachedSound(FilePath);
 }
コード例 #5
0
ファイル: SimplePlayer.cs プロジェクト: smldev/smlimitless
        public SimplePlayer()
        {
            Size = new Vector2(16f);

            jumpSound = new CachedSound(ContentPackageManager.GetAbsoluteFilePath("nsmbwiiJump"));
        }
コード例 #6
0
 /// <summary>
 ///   Plays a <see cref="CachedSound" /> instance.
 /// </summary>
 /// <param name="sound">The sound to play.</param>
 /// <param name="additionalOnPlaybackEndedHandler">
 ///   An event handler raised when the playback ends.
 /// </param>
 public void PlaySound(CachedSound sound, EventHandler additionalOnPlaybackEndedHandler)
 {
     //if (!playingSoundFileNames.Contains(sound.Name))
     //{
     CachedSoundSampleProvider provider = new CachedSoundSampleProvider(sound);
     playingSoundFileNames.Add(sound.Name);
     provider.PlaybackEndedEvent += (sender, e) => playingSoundFileNames.Remove(sound.Name);
     provider.PlaybackEndedEvent += additionalOnPlaybackEndedHandler;
     AddMixerInput(provider);
     //}
 }
コード例 #7
0
        /// <summary>
        ///   Plays a <see cref="CachedSound" /> instance that fades in and/or out.
        /// </summary>
        /// <param name="sound">The sound to play.</param>
        /// <param name="additionalOnPlaybackEndedHandler">
        ///   An event handler raised when the playback ends.
        /// </param>
        /// <param name="beginFadeInAction">
        ///   An action called when the fade-in begins.
        /// </param>
        /// <param name="beginFadeOutAction">
        ///   An action called when the fade-out begins.
        /// </param>
        public void PlayFadeableSound(CachedSound sound, EventHandler additionalOnPlaybackEndedHandler, out Action<double> beginFadeInAction, out Action<double> beginFadeOutAction)
        {
            if (!playingSoundFileNames.Contains(sound.Name))
            {
                CachedSoundSampleProvider provider = new CachedSoundSampleProvider(sound);
                playingSoundFileNames.Add(sound.Name);
                provider.PlaybackEndedEvent += (sender, e) => playingSoundFileNames.Remove(sound.Name);
                provider.PlaybackEndedEvent += additionalOnPlaybackEndedHandler;

                FadeInFadeOutSampleProvider fadeSampleProvider = new FadeInFadeOutSampleProvider(provider);
                beginFadeInAction = fadeSampleProvider.BeginFadeIn;
                beginFadeOutAction = fadeSampleProvider.BeginFadeOut;

                AddMixerInput(fadeSampleProvider);
            }
            else
            {
                beginFadeInAction = beginFadeOutAction = (value) => { };
            }
        }