Beispiel #1
0
 public void Stop()
 {
     if (sound != null)
     {
         sound.Stop();
         sound = null;
     }
 }
Beispiel #2
0
        public void Play(string filename, bool loop = false)
        {
            Stop();
            var stream = File.OpenRead(filename);
            var data   = SoundLoader.Open(stream);

            sound          = dev.CreateStreaming(data);
            sound.Volume   = Volume;
            sound.Stopped += Sound_Stopped;
            sound.Begin(loop);
        }
Beispiel #3
0
        public void Play(string filename, float attenuation = 0, bool loop = false)
        {
            Stop();
            var stream = File.OpenRead(filename);
            var data   = SoundLoader.Open(stream);

            sound            = dev.CreateStreaming(data, filename);
            sound.Stopped   += Sound_Stopped;
            this.attenuation = attenuation;
            UpdateGain();
            sound.Begin(loop);
        }