Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.21 KB | None | 0 0
  1. using System;
  2. using System.Net;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using System.Windows.Documents;
  6. using System.Windows.Ink;
  7. using System.Windows.Input;
  8. using System.Windows.Media;
  9. using System.Windows.Media.Animation;
  10. using System.Windows.Shapes;
  11. using Microsoft.Xna;
  12. using Microsoft.Xna.Framework;
  13. using Microsoft.Xna.Framework.Audio;
  14.  
  15. namespace Drummer_Pro
  16. {
  17.     public static class DrumSounds
  18.     {
  19.         public class DrumSoundEngine
  20.         {
  21.             private MediaElement _crash = new MediaElement();
  22.             private MediaElement _openHH = new MediaElement();
  23.             private MediaElement _closeHH = new MediaElement();
  24.             private MediaElement _snare = new MediaElement();
  25.             private MediaElement _hiTom = new MediaElement();
  26.             private MediaElement _midTom = new MediaElement();
  27.             private MediaElement _lowTom = new MediaElement();
  28.             private MediaElement _kick = new MediaElement();
  29.  
  30.             public DrumSoundEngine()
  31.             {
  32.                 _crash.Source = new Uri("Sounds/Crash.wav", UriKind.Relative);
  33.                 _openHH.Source = new Uri("Sounds/Crash.wav", UriKind.Relative);
  34.                 _closeHH.Source = new Uri("Sounds/Crash.wav", UriKind.Relative);
  35.                 _snare.Source = new Uri("Sounds/Crash.wav", UriKind.Relative);
  36.                 _hiTom.Source = new Uri("Sounds/Crash.wav", UriKind.Relative);
  37.                 _midTom.Source = new Uri("Sounds/Crash.wav", UriKind.Relative);
  38.                 _lowTom.Source = new Uri("Sounds/Crash.wav", UriKind.Relative);
  39.                 _kick.Source = new Uri("Sounds/Crash.wav", UriKind.Relative);
  40.             }
  41.  
  42.             public void Crash() { _crash.Stop(); _crash.Play(); }
  43.             public void OpenHiHat() { _openHH.Stop(); _openHH.Play(); }
  44.             public void CloseHiHat() { _closeHH.Stop(); _closeHH.Play(); }
  45.             public void Snare() { _snare.Stop(); _snare.Play(); }
  46.             public void HiTom() { _hiTom.Stop(); _hiTom.Play(); }
  47.             public void MidTom() { _midTom.Stop(); _midTom.Play(); }
  48.             public void LowTom() { _lowTom.Stop(); _lowTom.Play(); }
  49.             public void Kick() { _kick.Stop(); _kick.Play(); }
  50.         }
  51.        
  52.         public static DrumSoundEngine Play = new DrumSoundEngine();
  53.  
  54.         //public class DrumSoundEngine
  55.         //{
  56.         //    private SoundEffect _crash = SoundEffect.FromStream(App.GetResourceStream(new Uri("Sounds/Crash.wav", UriKind.Relative)).Stream);
  57.         //    private SoundEffect _openHH = SoundEffect.FromStream(App.GetResourceStream(new Uri("Sounds/OpenHH.wav", UriKind.Relative)).Stream);
  58.         //    private SoundEffect _closeHH = SoundEffect.FromStream(App.GetResourceStream(new Uri("Sounds/CloseHH.wav", UriKind.Relative)).Stream);
  59.         //    private SoundEffect _snare = SoundEffect.FromStream(App.GetResourceStream(new Uri("Sounds/Snare.wav", UriKind.Relative)).Stream);
  60.         //    private SoundEffect _hiTom = SoundEffect.FromStream(App.GetResourceStream(new Uri("Sounds/HiTom.wav", UriKind.Relative)).Stream);
  61.         //    private SoundEffect _midTom = SoundEffect.FromStream(App.GetResourceStream(new Uri("Sounds/MidTom.wav", UriKind.Relative)).Stream);
  62.         //    private SoundEffect _lowTom = SoundEffect.FromStream(App.GetResourceStream(new Uri("Sounds/LowTom.wav", UriKind.Relative)).Stream);
  63.         //    private SoundEffect _kick = SoundEffect.FromStream(App.GetResourceStream(new Uri("Sounds/Kick.wav", UriKind.Relative)).Stream);
  64.  
  65.         //    public void Crash() { _crash.Play(); }
  66.         //    public void OpenHiHat() { _openHH.Play(); }
  67.         //    public void CloseHiHat() { _closeHH.Play(); }
  68.         //    public void Snare() { _snare.Play(); }
  69.         //    public void HiTom() { _hiTom.Play(); }
  70.         //    public void MidTom() { _midTom.Play(); }
  71.         //    public void LowTom() { _lowTom.Play(); }
  72.         //    public void Kick() { _kick.Play(); }
  73.  
  74.         //}
  75.  
  76.         //private static DrumSoundEngine _play = new DrumSoundEngine();
  77.  
  78.         //public static void Prepare() { FrameworkDispatcher.Update(); }
  79.  
  80.         //public static DrumSoundEngine Play
  81.         //{
  82.         //    get { return _play; }
  83.         //}
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement