home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / DirectX / dxsdk_oct2004.exe / dxsdk.exe / Samples / Managed / DirectSound / Play3DSound / Algorithm.cs next >
Encoding:
Text File  |  2004-09-27  |  4.3 KB  |  113 lines

  1. //----------------------------------------------------------------------------
  2. // File: Algorithm.cs
  3. //
  4. // Copyright (c) Microsoft Corp. All rights reserved.
  5. //-----------------------------------------------------------------------------
  6. using System;
  7. using System.Drawing;
  8. using System.Windows.Forms;
  9. using Microsoft.DirectX.DirectSound;
  10.  
  11. public class AlgorithmForm : Form
  12. {
  13.     private Button buttonOk;
  14.     private Button buttonCancel;
  15.     private RadioButton radiobuttonNoVirtRadio;
  16.     private RadioButton radiobuttonHighVirtRadio;
  17.     private RadioButton radiobuttonLightVirtRadio;
  18.  
  19.     public AlgorithmForm()
  20.     {
  21.         //
  22.         // Required for Windows Form Designer support
  23.         //
  24.         InitializeComponent();
  25.     }
  26.     #region InitializeComponent code
  27.     private void InitializeComponent()
  28.     {
  29.         this.buttonOk = new System.Windows.Forms.Button();
  30.         this.buttonCancel = new System.Windows.Forms.Button();
  31.         this.radiobuttonNoVirtRadio = new System.Windows.Forms.RadioButton();
  32.         this.radiobuttonHighVirtRadio = new System.Windows.Forms.RadioButton();
  33.         this.radiobuttonLightVirtRadio = new System.Windows.Forms.RadioButton();
  34.         this.SuspendLayout();
  35.         // 
  36.         // buttonOk
  37.         // 
  38.         this.buttonOk.DialogResult = System.Windows.Forms.DialogResult.OK;
  39.         this.buttonOk.Location = new System.Drawing.Point(294, 72);
  40.         this.buttonOk.Name = "buttonOk";
  41.         this.buttonOk.TabIndex = 0;
  42.         this.buttonOk.Text = "OK";
  43.         this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click);
  44.         // 
  45.         // buttonCancel
  46.         // 
  47.         this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  48.         this.buttonCancel.Location = new System.Drawing.Point(375, 72);
  49.         this.buttonCancel.Name = "buttonCancel";
  50.         this.buttonCancel.TabIndex = 1;
  51.         this.buttonCancel.Text = "Cancel";
  52.         // 
  53.         // radiobuttonNoVirtRadio
  54.         // 
  55.         this.radiobuttonNoVirtRadio.Checked = true;
  56.         this.radiobuttonNoVirtRadio.Location = new System.Drawing.Point(10, 11);
  57.         this.radiobuttonNoVirtRadio.Name = "radiobuttonNoVirtRadio";
  58.         this.radiobuttonNoVirtRadio.Size = new System.Drawing.Size(339, 16);
  59.         this.radiobuttonNoVirtRadio.TabIndex = 2;
  60.         this.radiobuttonNoVirtRadio.TabStop = true;
  61.         this.radiobuttonNoVirtRadio.Text = "&No Virtualization (WDM or VxD. CPU efficient, but basic 3-D effect)";
  62.         // 
  63.         // radiobuttonHighVirtRadio
  64.         // 
  65.         this.radiobuttonHighVirtRadio.Location = new System.Drawing.Point(10, 28);
  66.         this.radiobuttonHighVirtRadio.Name = "radiobuttonHighVirtRadio";
  67.         this.radiobuttonHighVirtRadio.Size = new System.Drawing.Size(391, 16);
  68.         this.radiobuttonHighVirtRadio.TabIndex = 3;
  69.         this.radiobuttonHighVirtRadio.Text = "&High Quality (WDM only.  Highest quality 3D audio effect, but uses more CPU)";
  70.         // 
  71.         // radiobuttonLightVirtRadio
  72.         // 
  73.         this.radiobuttonLightVirtRadio.Location = new System.Drawing.Point(10, 46);
  74.         this.radiobuttonLightVirtRadio.Name = "radiobuttonLightVirtRadio";
  75.         this.radiobuttonLightVirtRadio.Size = new System.Drawing.Size(430, 16);
  76.         this.radiobuttonLightVirtRadio.TabIndex = 4;
  77.         this.radiobuttonLightVirtRadio.Text = "&Light Quality (WDM only.  Good 3-D audio effect, but uses less CPU than High Qua" +
  78.             "lity)";
  79.         // 
  80.         // AlgorithmForm
  81.         // 
  82.         this.AcceptButton = this.buttonOk;
  83.         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  84.         this.ClientSize = new System.Drawing.Size(460, 111);
  85.         this.Controls.AddRange(new System.Windows.Forms.Control[] {
  86.                                                                       this.buttonOk,
  87.                                                                       this.buttonCancel,
  88.                                                                       this.radiobuttonNoVirtRadio,
  89.                                                                       this.radiobuttonHighVirtRadio,
  90.                                                                       this.radiobuttonLightVirtRadio});
  91.         this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
  92.         this.MaximizeBox = false;
  93.         this.MinimizeBox = false;
  94.         this.Name = "AlgorithmForm";
  95.         this.Text = "Select 3D Algorithm ";
  96.         this.ResumeLayout(false);
  97.  
  98.     }
  99.     #endregion
  100.  
  101.     private void buttonOk_Click(object sender, System.EventArgs e)
  102.     {
  103.         if (true == radiobuttonNoVirtRadio.Checked)
  104.             Play3DSound.guid3DAlgorithm = DSoundHelper.Guid3DAlgorithmNoVirtualization;
  105.         else if (true == radiobuttonHighVirtRadio.Checked)
  106.             Play3DSound.guid3DAlgorithm = DSoundHelper.Guid3DAlgorithmHrtfFull;
  107.         else if (true == radiobuttonLightVirtRadio.Checked)
  108.             Play3DSound.guid3DAlgorithm = DSoundHelper.Guid3DAlgorithmHrtfLight;
  109.  
  110.         this.Close();
  111.     }
  112. }
  113.