示例#1
0
        override public void Dispose(bool disposing)
        {
            // If you need thread safety, use a lock around these
            // operations, as well as in your methods that use the resource.
            if (!m_disposed)
            {
                if (disposing)
                {
                    if (m_description3d != null)
                    {
                        m_description3d.Dispose();
                    }

                    if (m_secondaryBuffer != null)
                    {
                        m_secondaryBuffer.Dispose();
                    }

                    if (m_buffer3d != null)
                    {
                        m_buffer3d.Dispose();
                    }
                }

                m_description3d   = null;
                m_secondaryBuffer = null;
                m_buffer3d        = null;

                // Indicate that the instance has been disposed.
                m_disposed = true;
            }
        }
示例#2
0
        public Sound3d(string file, DirectSound.Device device)
        {
            m_description3d = new DirectSound.BufferDescription();
            m_description3d.ControlEffects        = false;
            m_description3d.GlobalFocus           = true;
            m_description3d.Control3D             = true;
            m_description3d.ControlVolume         = true;
            m_description3d.Guid3DAlgorithm       = DirectSound.DSoundHelper.Guid3DAlgorithmHrtfFull;
            m_description3d.ControlPositionNotify = true;

            m_secondaryBuffer = new DirectSound.SecondaryBuffer(file, m_description3d, device);

            m_buffer3d          = new DirectSound.Buffer3D(m_secondaryBuffer);
            m_buffer3d.Position = new SoundVector(0, 0, 1);
            m_buffer3d.Mode     = DirectSound.Mode3D.Normal;

            m_notify = new DirectSound.Notify(m_secondaryBuffer);
        }