예제 #1
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();*/
        }
예제 #2
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);
        }