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

            Try

                pDSCaptureBuffer = New CaptureBuffer(dscheckboxd, cap)

                InputFormatSupported(iIndex) = True

            Catch

                InputFormatSupported(iIndex) = False

            End Try

            pDSCaptureBuffer.Dispose()

        Next iIndex

        Cursor = Cursors.Default

    End Sub ''''ScanAvailableInputFormats

    Private Sub GetWaveFormatFromIndex(ByVal Index As Integer, ByRef format As WaveFormat)

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

        '''' Name: GetWaveFormatFromIndex()

        '''' Desc: Returns 20 different wave formats based on Index

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

        Dim SampleRate As Integer = Index / 4

        Dim iType As Integer = Index Mod 4

 

        Select Case SampleRate

            Case 0

                format.SamplesPerSecond = 48000

            Case 1

                format.SamplesPerSecond = 44100

            Case 2

                format.SamplesPerSecond = 22050

            Case 3

                format.SamplesPerSecond = 11025

            Case 4

                format.SamplesPerSecond = 8000

        End Select

 

        Select Case iType

            Case 0

                format.BitsPerSample = 8

                format.Channels = 1

            Case 1

                format.BitsPerSample = 16

                format.Channels = 1

            Case 2

                format.BitsPerSample = 8

                format.Channels = 2

            Case 3

                format.BitsPerSample = 16

                format.Channels = 2

        End Select

 

        format.BlockAlign = CShort(format.Channels * (format.BitsPerSample / 8))

        format.AverageBytesPerSecond = format.BlockAlign * format.SamplesPerSecond

    End Sub ''''GetWaveFormatFromIndex

    Private Shared Function ConvertWaveFormat

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

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