/// <summary> /// Pequeno teste conceitual utilizando a placa de som padrao /// </summary> public void teste() { Capture cap = new Capture(new DeviceInformation().DriverGuid); CaptureBufferDescription desc = new CaptureBufferDescription(); CaptureBuffer buffer; WaveFormat wf = new WaveFormat(); wf.BitsPerSample = 16; wf.SamplesPerSecond = 44100; wf.Channels = 2; wf.BlockAlign = (short)(wf.Channels * wf.BitsPerSample / 8); wf.AverageBytesPerSecond = wf.BlockAlign * wf.SamplesPerSecond; wf.FormatTag = WaveFormatTag.Pcm; desc.Format = wf; desc.BufferBytes = SAMPLES * wf.BlockAlign; buffer = new Microsoft.DirectX.DirectSound.CaptureBuffer(desc, cap); buffer.Start(true); zed: Array samples = buffer.Read(0, typeof(Int16), LockFlag.FromWriteCursor, SAMPLE_FORMAT_ARRAY); System.Console.WriteLine(samples.GetValue(0, 0, 0).ToString()); goto zed; }
public void Init() { mCurrentDeviceName = mAudioDevices[mCurrentDeviceIndex].Description; Microsoft.DirectX.DirectSound.Capture audioCapture = new Capture(mAudioDevices[mCurrentDeviceIndex].DriverGuid); Microsoft.DirectX.DirectSound.CaptureBufferDescription audioCaptureDescription = new CaptureBufferDescription(); Microsoft.DirectX.DirectSound.WaveFormat audioFormat = new WaveFormat(); audioFormat.BitsPerSample = (short)(mChannels * 8); audioFormat.SamplesPerSecond = 44100; audioFormat.Channels = (short)mChannels; audioFormat.BlockAlign = (short)(mChannels * audioFormat.BitsPerSample / 8); audioFormat.AverageBytesPerSecond = audioFormat.BlockAlign * audioFormat.SamplesPerSecond; audioFormat.FormatTag = WaveFormatTag.Pcm; audioCaptureDescription.Format = audioFormat; audioCaptureDescription.BufferBytes = mSamples * audioFormat.BlockAlign; mAudioBuffer = new CaptureBuffer(audioCaptureDescription, audioCapture); mIsRunning = false; }
public Notify(CaptureBuffer lp) { throw new NotImplementedException(); }