Лабораторная работа: Audio recorder on visual basic
' i = mciSendString ("set capture alignment 1 bitspersample 8 samplespersec 8000 channels 1 bytespersec 8000", rtn, Len (rtn), 0)
' i = mciSendString ("set capture alignment 2 bitspersample 8 samplespersec 6000 channels 2 bytespersec 12000", rtn, Len (rtn), 0)
' i = mciSendString ("set capture alignment 1 bitspersample 8 samplespersec 6000 channels 1 bytespersec 6000", rtn, Len (rtn), 0)
i = mciSendString (settings, rtn, Len (rtn), 0)
If i <> 0 Then MsgBox ("Settings for recording not consistent")
' If the combination is not supported you get an error!
End Sub
Public Sub WaveRecord ()
Dim rtn As String
Dim i As Long
Dim msg As String
rtn = Space$ (260)
If WaveMidiFileName <> "" Then
If WaveRecordingImmediate Then MsgBox ("Midi file " & WaveMidiFileName & " will be recorded")
i = mciSendString ("open " & WaveMidiFileName & " type sequencer alias midi", rtn, Len (rtn), 0)
If i <> 0 Then MsgBox ("Opening midi file failed!")
i = mciSendString ("play midi", rtn, Len (rtn), 0) 'Start the recording
If i <> 0 Then MsgBox ("Playing midi file failed!")
End If
i = mciSendString ("record capture", rtn, Len (rtn), 0) 'Start the recording
If i <> 0 Then MsgBox ("Recording not possible, please restart your computer... ")
End Sub
Public Sub WaveSaveAs (sName As String)
Dim rtn As String
Dim i As Long
'If file already exists then remove it
If FileExist (sName) Then
Kill (sName)
End If