打印本文 打印本文 关闭窗口 关闭窗口
VB.NET实现DirectSound9 (7) 录音
作者:武汉SEO闵涛  文章来源:敏韬网  点击数10925  更新时间:2009/4/23 19:00:44  文章录入:mintao  责任编辑:mintao
ToString(ByVal format As WaveFormat) As String

        ''''-----------------------------------------------------------------------------

        '''' Name: ConvertWaveFormatToString()

        '''' Desc: Converts a wave format to a text string

        ''''-----------------------------------------------------------------------------

        Return format.SamplesPerSecond.ToString() + " Hz, " + format.BitsPerSample.ToString() + "-bit " + IIf(format.Channels = 1, "Mono", "Stereo")

    End Function ''''ConvertWaveFormatToString

    Sub FillFormatListBox()

        ''''-----------------------------------------------------------------------------

        '''' Name: FillFormatListBox()

        '''' Desc: Fills the format list box based on the availible formats

        ''''-----------------------------------------------------------------------------

        Dim info As New FormatInfo

        Dim strFormatName As String = String.Empty

        Dim format As New WaveFormat

 

        Dim iIndex As Integer

        For iIndex = 0 To InputFormatSupported.Length - 1

            If True = InputFormatSupported(iIndex) Then

                '''' Turn the index into a WaveFormat then turn that into a

                '''' string and put the string in the listbox

                GetWaveFormatFromIndex(iIndex, format)

                info.format = format

                Formats.Add(info)

            End If

        Next iIndex

        ListBox2.DataSource = Formats

    End Sub ''''FillFormatListBox

    Sub CreateRIFF()

        ''''*************************************************************************

        ''''

        ''''

        '''' Here is where the file will be created. A

        ''''

        '''' wave file is a RIFF file, which has chunks

        ''''

        '''' of data that describe what the file contains.

        ''''

        '''' A wave RIFF file is put together like this:

        ''''

        ''''

        ''''

        '''' The 12 byte RIFF chunk is constructed like this:

        ''''

        ''''   Bytes(0 - 3) ''''R'''' ''''I'''' ''''F'''' ''''F''''

        ''''

        '''' Bytes 4 - 7 : Length of file, minus the first 8 bytes of the RIFF description.

        ''''

        ''''                   (4 bytes for "WAVE" + 24 bytes for format chunk length +

        ''''

        ''''                   8 b

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

打印本文 打印本文 关闭窗口 关闭窗口