示例#1
0
文件: Output.cs 项目: tdwright/VoxSSD
 public Output(int _rows)
 {
     device = new AudioDevice();
     this.rows = _rows;
     this.waves = new OutputStream[this.rows];
     int i;
     for (i = 0; i < this.rows; i++)
     {
         waves[i] = device.CreateTone(musical_constrained(i));
         waves[i].Volume = 0f;
         waves[i].Play();
     }
 }
示例#2
0
 public Audio()
 {
     int centrePitch = ((MaxPitch-MinPitch)/2)+MinPitch;
     int pitchStep = (MaxPitch - MinPitch) / 10;
     this.device = new AudioDevice();
     this.waves = new OutputStream[4, 5];
     int panLeft; int pitchHigh;
     for (int i = 0; i < 4; i++)
     {
         // If this quadrant is in the left 50%, pan left (-1), else pan right (1)
         panLeft = ((i % 2) == 0) ? -1 : 1;
         // If this quadrant is in the top 50%, add pitch steps to centre pitch, else subtract
         pitchHigh = (i < 2) ? 1 : -1;
         for (int j = 0; j < 5; j++)
         {
             int pitch = centrePitch + (j * pitchStep * pitchHigh);
             float pan = ((float)(5 + (j * panLeft)) / 5f) - 1f;
             waves[i, j] = device.CreateTone((double)pitch);
             waves[i, j].Volume = 0f;
             waves[i, j].Pan = pan;
             waves[i, j].Play();
         }
     }
 }