Exemplo n.º 1
0
 /// <summary>
 /// Set the 3D world position of the sound, if it is set to "Positional"
 /// </summary>
 /// <param name="x">X world position</param>
 /// <param name="y">Y world position</param>
 /// <param name="z">Z world position</param>
 public void Set3DPosition( float x, float y, float z )
 {
     if (_lsAudio.Contains(this) && this.Handle != 0 && this.Positional )
     {
         BASS_3DVECTOR vec = new BASS_3DVECTOR(x, y, z );
         Bass.BASS_ChannelSet3DPosition(this.Handle, vec, null, null);
         Bass.BASS_Apply3D();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Set the 3D world position of the sound, if it is set to "Positional"
 /// </summary>
 /// <param name="vecpos">The 3 dimensional world position of the sound</param>
 public void Set3DPosition(Vector3 vecpos)
 {
     if (_lsAudio.Contains(this) && this.Handle != 0 && this.Positional)
     {
         BASS_3DVECTOR vec = new BASS_3DVECTOR(vecpos.X, vecpos.Y, vecpos.Z);
         Bass.BASS_ChannelSet3DPosition(this.Handle, vec, null, null);
         Bass.BASS_Apply3D();
     }
 }
Exemplo n.º 3
0
        public static void Think( FrameEventArgs e )
        {
            if (View.Player != null)
            {
                BASS_3DVECTOR pos = new BASS_3DVECTOR(View.Position.X, View.Position.Y, View.Position.Z);
                BASS_3DVECTOR fwd = new BASS_3DVECTOR(View.ViewNormal.X, View.ViewNormal.Y, View.ViewNormal.Z);
                BASS_3DVECTOR up = new BASS_3DVECTOR(0, -1, 0);
                Bass.BASS_Set3DPosition(pos, null, fwd, up );
                Bass.BASS_Apply3D();
            }

            for (int i = 0; i < _lsAudio.Count; i++)
            {
                Audio audio = _lsAudio[i];
                if (audio.AttachedEntity != null)
                {
                    audio.Set3DPosition(audio.AttachedEntity.Position);
                }

                long seconds = Bass.BASS_ChannelGetPosition(audio.Handle, BASSMode.BASS_POS_BYTES);
                long length = Bass.BASS_ChannelGetLength(audio.Handle, BASSMode.BASS_POS_BYTES);

                if (audio.Handle != 0 && !audio.Looped)
                {
                    if (seconds >= length)
                    {
                        audio.Remove();
                        i--;
                    }
                }
                else if (audio.StartLoopPosition > 0 && audio.EndLoopPosition > 0 )
                {
                    if (seconds > audio.EndLoopPosition)
                    {
                        Bass.BASS_ChannelSetPosition(audio.Handle, audio.StartLoopPosition, BASSMode.BASS_POS_BYTES);
                    }
                }
            }
        }
Exemplo n.º 4
0
 public static extern bool BASS_ChannelGet3DPosition(int handle, [In, Out] BASS_3DVECTOR pos,
                                                     [In, Out] BASS_3DVECTOR orient, [In, Out] BASS_3DVECTOR vel);
Exemplo n.º 5
0
 public static extern bool BASS_Get3DPosition([In, Out] BASS_3DVECTOR pos, [In, Out] BASS_3DVECTOR vel,
                                              [In, Out] BASS_3DVECTOR front, [In, Out] BASS_3DVECTOR top);
Exemplo n.º 6
0
 /// <summary>
 ///     Used with getting and setting Channel3DPosition
 /// </summary>
 /// <param name="pos">position of the sound </param>
 /// <param name="orient">
 ///     orientation of the sound, this is irrelevant if it//s an
 ///     omnidirectional sound source
 /// </param>
 /// <param name="vel">velocity of the sound</param>
 public Channel3DPosition(BASS_3DVECTOR pos, BASS_3DVECTOR orient, BASS_3DVECTOR vel)
 {
     _pos = pos;
     _orient = orient;
     _vel = vel;
 }
Exemplo n.º 7
0
 /// <summary>
 ///     Use with setting and getting 3DPosition
 /// </summary>
 /// <param name="pos">Position of the listener </param>
 /// <param name="vel">listener's velocity, used to calculate doppler effect</param>
 /// <param name="top">Direction that listener's front is pointing</param>
 /// <param name="front">Direction that listener's top is pointing </param>
 public BASS3DPosition([NotNull] BASS_3DVECTOR pos, [NotNull] BASS_3DVECTOR vel, [NotNull] BASS_3DVECTOR top, [NotNull] BASS_3DVECTOR front)
 {
     _pos = pos;
     _vel = vel;
     _top = top;
     _front = front;
 }