Beispiel #1
0
 public PlayingSound(AudioEngine.SoundEffectInstance instance, SoundTrackChannel channel, WaitHandle waitHandle)
 {
     _instance   = instance;
     _channel    = channel;
     _waitHandle = waitHandle;
     _released   = false;
 }
Beispiel #2
0
 public static void StopChannel(SoundTrackChannel channel)
 {
     for (int i = 0; i < _playingSounds.Count; i++)
     {
         if (_playingSounds[i].Channel == channel)
         {
             _playingSounds[i].Stop();
         }
     }
 }
Beispiel #3
0
 public SoundTrackResource(string name, System.IO.Stream stream, Resource.ResourceManager content)
     : base(name, stream)
 {
     foreach (Resource.InfoSection section in Sections)
     {
         if (section.Name.Equals("SoundTrack", StringComparison.OrdinalIgnoreCase))
         {
             foreach (Resource.InfoLine line in section.Lines)
             {
                 string soundType;
                 if (line.TryGetAttribute("SoundType", out soundType))
                 {
                     if (soundType.Equals("SFX", StringComparison.OrdinalIgnoreCase))
                     {
                         _channel = SoundTrackChannel.SFX;
                     }
                     else if (soundType.Equals("Ambient", StringComparison.OrdinalIgnoreCase))
                     {
                         _channel = SoundTrackChannel.Ambient;
                     }
                     else if (soundType.Equals("Music", StringComparison.OrdinalIgnoreCase))
                     {
                         _channel = SoundTrackChannel.Music;
                     }
                     else if (soundType.Equals("Dialogue", StringComparison.OrdinalIgnoreCase))
                     {
                         _channel = SoundTrackChannel.Dialog;
                     }
                 }
             }
         }
         else if (section.Name.Equals("Wait", StringComparison.OrdinalIgnoreCase))
         {
             _nodes.Add(new SoundTrackWaitNode(section));
         }
         else if (section.Name.Equals("Sound", StringComparison.OrdinalIgnoreCase))
         {
             _nodes.Add(new SoundTrackSoundNode(section, content));
         }
         else if (section.Name.Equals("PRS", StringComparison.OrdinalIgnoreCase))
         {
             _nodes.Add(new SoundTrackPrsNode(section, content));
         }
     }
 }
Beispiel #4
0
        public static PlayingSound PlaySound3DToChannel(AudioEngine.SoundEffect sound, float x, float y, float z, SoundTrackChannel channel, WaitHandle waitHandle = null)
        {
            PlayingSound s = new PlayingSound(sound.CreateInstance(), channel, waitHandle);

            s.Instance.SetPosition(false, new Math.Vector3(x, y, z));
            s.Play();
            _playingSounds.Add(s);

            return(s);

            /*AudioSource source = getFreeSource(null);
             * if (source != null)
             * {
             *  source.IsLooping
             *
             *  Al.alSourcei(source, Al.AL_BUFFER, sound.Buffer);
             *  Al.alSource3f(source, Al.AL_POSITION, x, y, z);
             *  Al.alSourcei(source, Al.AL_SOURCE_RELATIVE, Al.AL_FALSE);
             *  Al.alSourcef(source, Al.AL_MAX_DISTANCE, sound.DefaultMaxDistance);
             *  Al.alSourcef(source, Al.AL_REFERENCE_DISTANCE, sound.DefaultMinDistance);
             *  Al.alSourcePlay(source);
             *
             *  _channelSounds[channel].Add(source);// BUG: this should be adding this sound to a collection!
             *
             *  return new PlayingSound(source, false);
             * }
             *
             * return new PlayingSound();*/
        }
Beispiel #5
0
        public static PlayingSound PlaySound2DToChannel(AudioEngine.SoundEffect sound, SoundTrackChannel channel, WaitHandle waitHandle = null)
        {
            PlayingSound s = new PlayingSound(sound.CreateInstance(), channel, waitHandle);

            s.Instance.SetPosition(true, Math.Vector3.Zero);
            s.Play();
            _playingSounds.Add(s);

            return(s);
        }
Beispiel #6
0
 public PlayingSound Play3D(SoundTrackChannel channel, float x, float y, float z)
 {
     return(new PlayingSound());
 }
Beispiel #7
0
 public PlayingSound Play2D(SoundTrackChannel channel, bool wait)
 {
     return(new PlayingSound(wait));
 }
Beispiel #8
0
 public PlayingSound Play2D(SoundTrackChannel channel)
 {
     return(new PlayingSound());
 }