Public Class Form1 Public PositionNotify As BufferPositionNotify() = New Microsoft.DirectX.DirectSound.BufferPositionNotify(NumberRecordNotifications) {} Public Const NumberRecordNotifications As Integer = 16 Public NotificationEvent As AutoResetEvent = Nothing Public applicationBuffer As CaptureBuffer = Nothing Public CaptureDeviceGuid As Guid = Guid.Empty Public applicationDevice As Capture = Nothing

If applicationNotify IsNot Nothing Then applicationNotify.Dispose() applicationNotify = Nothing End If If applicationBuffer IsNot Nothing Then applicationBuffer.Dispose() applicationBuffer = Nothing End If

' Tell DirectSound when to notify the app. The notification will come in the from ' of signaled events that are handled in the notify thread. applicationNotify.SetNotificationPositions(PositionNotify, NumberRecordNotifications) End Sub

Private Sub WaitThread() While Capturing 'Sit here and wait for a message to arrive NotificationEvent.WaitOne(Timeout.Infinite, True) RecordCapturedData() End While End Sub

If StartRecording Then ' Create a capture buffer, and tell the capture ' buffer to start recording CreateCaptureBuffer() applicationBuffer.Start(True) Else ' Stop the buffer, and read any data that was not ' caught by a notification applicationBuffer.[Stop]()

RecordCapturedData()

Writer.Seek(4, SeekOrigin.Begin) ' Seek to the length descriptor of the RIFF file. Writer.Write(CInt(SampleCount + 36)) ' Write the file length, minus first 8 bytes of RIFF description. Writer.Seek(40, SeekOrigin.Begin) ' Seek to the data length descriptor of the RIFF file. Writer.Write(SampleCount) ' Write the length of the sample data in bytes. Writer.Close() ' Close the file now. Writer = Nothing '<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>> '------------------------------------- ' Set the writer to null. ' Set the FileStream to null. Wave = Nothing End If End Sub

' Now fill in the data chunk. Writer.Write(ChunkData) Writer.Write(CInt(0)) ' The sample length will be written in later. '<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>

If Recording Then ' Stop the capture and read any data that ' was not caught by a notification StartOrStopRecord(False) Recording = False End If

' Update the UI controls to show the sound as loading a file checkboxRecord.Enabled = False Try CreateRIFF() Catch

End Try

' Update the UI controls to show the sound as the file is loaded labelFilename.Text = FileName checkboxRecord.Enabled = True

' Remember the path for next time Path = FileName.Substring(0, FileName.LastIndexOf("")) End Sub

End Class

Above code corectly record sound from mic and saving into the wav, but both channels and I need to split then into two mono wav's. Can anyone help me?pairs left channel, right channel, left...I'm tired of unsuccessful attempts...