class sound

Upload: thien-long

Post on 03-Feb-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/21/2019 Class Sound

    1/1

    class Sound{ private SoundPlayer sndPlayer = new SoundPlayer();

    public void Play(UnmanagedMemoryStream soundResId) { // retrieve .wav from resource file. sndPlayer = new SoundPlayer(soundResId); sndPlayer.Play(); }

    public void Halt() { sndPlayer.Stop(); }

    ~Sound() { sndPlayer.Stop(); sndPlayer.Dispose(); }}

    Sound sndEffect = new Sound();

    sndEffect.Play(global::Game.SoundResource.S100);