public override void Initialize(Section owner) { graphics = (AnimatedGraphicsObject)ContentPackageManager.GetGraphicsResource("SMBCoin"); IsMoving = false; collectSound = new CachedSound(ContentPackageManager.GetAbsoluteFilePath("nsmbwiiCoin")); base.Initialize(owner); }
/// <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; }
/// <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")); }
/// <summary> /// Initializes this sound. /// </summary> public void Initialize() { soundData = new CachedSound(FilePath); }
public SimplePlayer() { Size = new Vector2(16f); jumpSound = new CachedSound(ContentPackageManager.GetAbsoluteFilePath("nsmbwiiJump")); }
/// <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); //} }
/// <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) => { }; } }