; Return
End If
'''' 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.
WaveFile = Nothing '''' Set the FileStream to null.
End If
End Sub ''''StartOrStopRecord
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CreateRIFF()
StartOrStopRecord(True)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
StartOrStopRecord(False)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
DevPlay.SetCooperativeLevel(Me, CooperativeLevel.Priority)
BufPlay = New SecondaryBuffer(TextBox1.Text, DevPlay)
BufPlay.Play(0, BufferPlayFlags.Default)
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
BufPlay.Stop()
BufPlay.Dispose()
End Sub
Private Sub MainForm_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If Not Nothing Is NotificationEvent Then
NotificationEvent.Set()
End If
If Not Nothing Is applicationBuffer Then
If applicationBuffer.Capturing Then
StartOrStopRecord(False)
End If
End If
End
End Sub ''''MainForm_Closing
End Class
======================================= OK DirectSound最后的部分写完了.总体感觉微软的封装还是有道理的
既要体现出易用性,而且还要充分发挥硬件的能力.如果你觉得某 << 上一页 [11] [12] 下一页 [聊天工具]让IE 7也用上鼠标手势 [常用软件]IE 7出炉,Firefox 2当道.谁才是“王者”? [常用软件]绕过WGA安装IE 7 Beta3 5450 [VB.NET程序]VB.NET实现DirectSound9 (8) 音效控制器 [VB.NET程序]VB.NET实现DirectSound9 (6) 声音特效 [VB.NET程序]VB.NET 实现DirectSound9 (5) DS3D2 [VB.NET程序]用VB.Net实现DirectSound9 (4) DS3D [VB.NET程序]VB.NET 使用DirectSound 3 [VB.NET程序]学习笔记,VB.NET使用DirectSound9 (2) [VB.NET程序]学习笔记,VB.NET使用DirectSound9 (1)
|