SecondaryBufferを再生

作ったサイン波を再生する。とりあえずなってる。

            Device device;
            device = new Device();
            device.SetCooperativeLevel(this, CooperativeLevel.Normal);
            devicesCollection = new DevicesCollection();

            waveFormat = new WaveFormat();
            waveFormat.Channels = 2;
            waveFormat.SamplesPerSecond = 44100;
            waveFormat.FormatTag = WaveFormatTag.Pcm;
            waveFormat.BitsPerSample = 16;
            waveFormat.BlockAlign = (short)(waveFormat.Channels * (waveFormat.BitsPerSample / 8));
            waveFormat.AverageBytesPerSecond = waveFormat.BlockAlign * waveFormat.SamplesPerSecond;

            BufferDescription bufferDescription = new BufferDescription();
            bufferDescription.Format = waveFormat;
            bufferDescription.BufferBytes = waveFormat.AverageBytesPerSecond;
            SecondaryBuffer secondaryBuffer = new SecondaryBuffer(bufferDescription, device);
            secondaryBuffer.Write(0, memoryStream, captureBufferDescription.BufferBytes, LockFlag.None);
            writeSin(secondaryBuffer, 440);
            secondaryBuffer.Play(0, BufferPlayFlags.Default);