⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.frm

📁 it works 100% to Record Wave in visual basic 6.0
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         DumpInput       =   ""
         IsFormatProvider=   -1  'True
         MinActiveTime   =   0
         MinVolumeLevel  =   0
         OverNum         =   5
         PcmBitsPerSample=   16
         PcmNumChannels  =   2
         PcmSamplesPerSec=   44100
         DumpOutput      =   ""
         DeviceId        =   -1
         DeviceDirect    =   0   'False
         DeviceMapped    =   0   'False
         SyncEvents      =   0   'False
      End
      Begin VCProX.vcproWaveRiffX recWaveRiffX 
         Height          =   495
         Left            =   2760
         TabIndex        =   12
         Top             =   2280
         Width           =   735
         Active          =   0   'False
         AutoActivate    =   -1  'True
         CalcVolume      =   0   'False
         DumpInput       =   ""
         DumpOutput      =   ""
         IsFormatProvider=   0   'False
         OverNum         =   5
         PcmBitsPerSample=   16
         PcmNumChannels  =   2
         PcmSamplesPerSec=   44100
         FileName        =   ""
         IsInput         =   0   'False
         Loop            =   0   'False
         RealTime        =   0   'False
         SyncEvents      =   0   'False
         FormatTag       =   1
      End
      Begin VCProX.vcproDisplayBandsX bandR1 
         Height          =   855
         Left            =   120
         TabIndex        =   25
         Top             =   3480
         Width           =   1575
         Active          =   0   'False
         Interval        =   10
         Channel         =   0
         BandGap         =   0
         BandWidth       =   1
         Steps           =   8
         BandColorLow    =   49152
         BandColorMed    =   65535
         BandColorTop    =   255
         Color           =   0
      End
      Begin VCProX.vcproDisplayBandsX bandR2 
         Height          =   855
         Left            =   1920
         TabIndex        =   27
         Top             =   3480
         Width           =   1575
         Active          =   0   'False
         Interval        =   10
         Channel         =   1
         BandGap         =   0
         BandWidth       =   1
         Steps           =   8
         BandColorLow    =   49152
         BandColorMed    =   65535
         BandColorTop    =   255
         Color           =   0
      End
      Begin VB.CommandButton btnQuality 
         Caption         =   "Quality..."
         Height          =   375
         Left            =   120
         TabIndex        =   36
         Top             =   840
         Width           =   1095
      End
      Begin VB.CommandButton btnRSetup 
         Caption         =   "Setup..."
         Height          =   375
         Left            =   2760
         TabIndex        =   34
         Top             =   240
         Width           =   735
      End
      Begin VB.ComboBox cbRDevice 
         Height          =   315
         Left            =   720
         Style           =   2  'Dropdown List
         TabIndex        =   15
         Top             =   240
         Width           =   1935
      End
      Begin VB.TextBox Text3 
         Height          =   315
         Left            =   120
         TabIndex        =   7
         Text            =   "C:\Temp\Stream44.wav"
         Top             =   1680
         Width           =   3375
      End
      Begin VB.CommandButton btnWavRecStop 
         Caption         =   "Stop"
         Height          =   375
         Left            =   1200
         TabIndex        =   6
         Top             =   2400
         Width           =   975
      End
      Begin VB.CommandButton btnWavRecStart 
         Caption         =   "Start"
         Height          =   375
         Left            =   120
         TabIndex        =   5
         Top             =   2400
         Width           =   975
      End
      Begin VB.Label Label10 
         AutoSize        =   -1  'True
         Caption         =   "Right channel"
         Height          =   195
         Left            =   1920
         TabIndex        =   31
         Top             =   3240
         Width           =   990
      End
      Begin VB.Label Label9 
         AutoSize        =   -1  'True
         Caption         =   "Left channel"
         Height          =   195
         Left            =   120
         TabIndex        =   30
         Top             =   3240
         Width           =   885
      End
      Begin VB.Label laBytesRecorded 
         AutoSize        =   -1  'True
         Caption         =   "laBytesRecorded"
         Height          =   195
         Left            =   120
         TabIndex        =   18
         Top             =   2880
         Width           =   1215
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Device"
         Height          =   195
         Left            =   120
         TabIndex        =   14
         Top             =   300
         Width           =   510
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "Save recording to file"
         Height          =   195
         Index           =   1
         Left            =   120
         TabIndex        =   1
         Top             =   1440
         Width           =   1500
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub SetLink(provider As VCProX.IvcproProvider, consumer As VCProX.IvcproConsumer)
    provider.AddConsumer consumer
End Sub

Private Sub btnPSetup_Click()
    Shell "sndvol32 /p /d" + Str(cbPDevice.ListIndex), vbNormalFocus
End Sub

Private Sub btnQuality_Click()
    If recWaveRiffX.FormatChoose("Sound quality", Handle) Then
        wavInDeviceX.PcmBitsPerSample = recWaveRiffX.PcmBitsPerSample
        wavInDeviceX.PcmNumChannels = recWaveRiffX.PcmNumChannels
        wavInDeviceX.PcmSamplesPerSec = recWaveRiffX.PcmSamplesPerSec
    End If
End Sub

Private Sub btnRSetup_Click()
    Shell "sndvol32 /r /d" + Str(cbRDevice.ListIndex), vbNormalFocus
End Sub

Private Sub Form_Load()
    'WAV recording design-time changes:
    'wavInDeviceX.MinActiveTime = 0
    'recWaveRiffX.IsInput = False
    
    'WAV playback design-time changes:
    'playWaveRiffX.IsFormatProvider = True
    'playWaveRiffX.RealTime = True
    
    For i = 0 To wavInDeviceX.GetDeviceCount - 1
        cbRDevice.AddItem (wavInDeviceX.GetDeviceName(i))
    Next
    cbRDevice.ListIndex = 0
    
    For i = 0 To wavOutDeviceX.GetDeviceCount - 1
        cbPDevice.AddItem (wavOutDeviceX.GetDeviceName(i))
    Next
    cbPDevice.ListIndex = 0
    
    'link devices
    SetLink wavInDeviceX.Object, recWaveRiffX.Object
    SetLink playWaveRiffX.Object, wavOutDeviceX.Object
    
    SetLink wavInDeviceX.Object, bandR1.Object
    SetLink wavInDeviceX.Object, bandR2.Object
    SetLink playWaveRiffX.Object, bandP1.Object
    SetLink playWaveRiffX.Object, bandP2.Object
End Sub

Private Sub Form_Unload(Cancel As Integer)
    wavInDeviceX.Active = False
    playWaveRiffX.Active = False
End Sub

Private Sub btnWavRecStart_Click()
    wavInDeviceX.DeviceId = cbRDevice.ListIndex
    
    recWaveRiffX.FileName = Text3.Text
    wavInDeviceX.Active = True
End Sub

Private Sub btnWavRecStop_Click()
    wavInDeviceX.Active = False
End Sub

Private Sub btnWavPlayStart_Click()
    wavOutDeviceX.DeviceId = cbPDevice.ListIndex
    
    playWaveRiffX.Loop = (chPLoop.Value = 1)
    playWaveRiffX.FileName = Text4.Text
    playWaveRiffX.Active = True
    
    txtPBits.Text = Str(playWaveRiffX.PcmBitsPerSample)
    txtPSamplingRate.Text = Str(playWaveRiffX.PcmSamplesPerSec)
    If playWaveRiffX.PcmNumChannels = 2 Then chPStereo.Value = 1 Else chPStereo.Value = 0
End Sub

Private Sub btnWavPlayStop_Click()
    playWaveRiffX.Active = False
End Sub

Private Sub Timer1_Timer()
    laBytesRecorded.Caption = "bytes recorded: " + Str(wavInDeviceX.DataSizeOut)
    laBytesPlayed.Caption = "bytes played back: " + Str(wavOutDeviceX.DataSizeIn) + "/" + Str(playWaveRiffX.FileSize)
    
    btnWavRecStart.Enabled = Not recWaveRiffX.Active
    btnWavRecStop.Enabled = recWaveRiffX.Active
    btnWavPlayStart.Enabled = Not playWaveRiffX.Active
    btnWavPlayStop.Enabled = playWaveRiffX.Active
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -