And (Not WaveRecordingImmediate) _
And (Not WaveRecording) Then
WaveReset
WaveSet
WaveRecord
WaveRecording = True
cmdStop. Enabled = True 'Enable the STOP BUTTON
cmdPlay. Enabled = False 'Disable the "PLAY" button
cmdSave. Enabled = False 'Disable the "SAVE AS" button
cmdRecord. Enabled = False 'Disable the "RECORD" button
End If
If (Now > WaveRecordingStopTime) And (Not WaveRecordingReady) And (Not WaveRecordingImmediate) Then
WaveStop
cmdSave. Enabled = True 'Enable the "SAVE AS" button
cmdPlay. Enabled = True 'Enable the "PLAY" button
cmdStop. Enabled = False 'Disable the "STOP" button
If WavePosition > 0 Then
Slider1. Max = WavePosition
Else
Slider1. Max = 10
WaveRecording = False
WaveRecordingReady = True
If WaveAutomaticSave Then
WaveFileName = "Radio_from_" & CStr (WaveRecordingStartTime) & "_to_" & CStr (WaveRecordingStopTime)
WaveFileName = Replace (WaveFileName, ": ", ". ")
WaveFileName = Replace (WaveFileName, " ", "_")
WaveFileName = WaveFileName & ". wav"
WaveSaveAs (WaveFileName)
msg = "Recording has been saved" & vbCrLf
msg = msg & "Filename: " & WaveFileName
MsgBox (msg)
msg = "Recording is ready" & vbCrLf
msg = msg & "Don't forget to save recording..."
frmSettings. optRecordProgrammed. Value = False
frmSettings. optRecordImmediate. Value = True
End Sub
Option Explicit
Private Sub cmdFileName_Click ()
WaveFileName = InputBox ("Filename: ", "Filename for automatic saving", WaveFileName)
Private Sub cmdMidi_Click ()
CommonDialog2. CancelError = True
On Error GoTo ErrHandler1
CommonDialog2. Filter = "Midi file (*. mid*) |*. mid"
CommonDialog2. Flags = &H2 Or &H400
CommonDialog2. ShowOpen
WaveMidiFileName = CommonDialog2. FileName
WaveMidiFileName = GetShortName (WaveMidiFileName)
ErrHandler1:
Private Sub cmdOke_Click ()
Unload Me
Private Sub cmdStartTime_Click ()
Dim wrst As String
wrst = WaveRecordingStartTime
wrst = InputBox ("Enter start time recording", "Start time", wrst)
If wrst = "" Then Exit Sub
If Not IsDate (wrst) Then
MsgBox ("The date/time you entered was not valid!")
' String returned from InputBox is a valid time,
' so store it as a date/time value in WaveRecordingStartTime.
If CDate (wrst) < Now Then
MsgBox ("Recording events in the past is not possible... ")
WaveRecordingStartTime = Now + TimeSerial (0, 15, 0)
WaveRecordingStartTime = CDate (wrst)
If WaveRecordingStopTime < WaveRecordingStartTime Then WaveRecordingStopTime = WaveRecordingStartTime + TimeSerial (0, 15, 0)
Private Sub cmdStopTime_Click ()
wrst = WaveRecordingStopTime
If wrst < WaveRecordingStartTime Then wrst = WaveRecordingStartTime + TimeSerial (0, 15, 0)
wrst = InputBox ("Enter stop time recording", "Stop time", wrst)
MsgBox ("The time you entered was not valid!")
If CDate (wrst) < WaveRecordingStartTime Then
MsgBox ("The stop time has to be later then the start time!")
WaveRecordingStopTime = WaveRecordingStartTime + TimeSerial (0, 5, 0)
WaveRecordingStopTime = CDate (wrst)
Private Sub Form_Load ()
Select Case Rate
Case 44100
optRate44100. Value = True
Case 22050
optRate22050. Value = True
Case 11025
optRate11025. Value = True
Case 8000
optRate8000. Value = True
Case 6000
optRate6000. Value = True
End Select
Select Case Channels
Case 1
optMono. Value = True
Case 2
optStereo. Value = True
Select Case Resolution
Case 8
opt8bits. Value = True
Case 16
opt16bits. Value = True
If WaveRecordingImmediate Then
optRecordImmediate. Value = True
optRecordProgrammed. Value = True
Option11. Value = True
Option10. Value = True
Private Sub optRate11025_Click ()
Rate = 11025
Private Sub optRate44100_Click ()
Rate = 44100
Private Sub Option10_Click ()
WaveAutomaticSave = False
Private Sub Option11_Click ()
WaveAutomaticSave = True
Private Sub optRate22050_Click ()
Rate = 22050
Private Sub optRate8000_Click ()
Rate = 8000
Private Sub optRate6000_Click ()
Rate = 6000
Private Sub optMono_Click ()
Channels = 1
Private Sub optStereo_Click ()
Channels = 2
Private Sub opt8bits_Click ()
Resolution = 8
Private Sub opt16bits_Click ()
Resolution = 16
Private Sub optRecordImmediate_Click ()
WaveRecordingImmediate = True
frmManualAuto. Visible = False
frmTimes. Visible = False
lblTimes. Visible = False
AudioRecorder. cmdRecord. Enabled = True
Private Sub optRecordProgrammed_Click ()
WaveRecordingImmediate = False
frmManualAuto. Visible = True
frmTimes. Visible = True
lblTimes. Visible = True
AudioRecorder. cmdRecord. Enabled = False
If WaveRecordingStartTime < Now Then
WaveRecordingStopTime = WaveRecordingStartTime + TimeSerial (0, 15, 0)
Public Declare Function ShellExecute Lib "shell32. dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As _
String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Rate As Long
Public Channels As Integer
Public Resolution As Integer
Public WaveStatusMsg As String * 255
Public WaveStatisticsMsg As String
Public WaveRecordingImmediate As Boolean
Public WaveRecordingStartTime As Date
Public WaveRecordingStopTime As Date
Public WaveRecordingReady As Boolean
Public WaveRecording As Boolean
Public WavePlaying As Boolean
Public WaveAutomaticSave As Boolean
Public WaveFileName As String
Public WaveMidiFileName As String
Public WaveLongFileName As String
Public WaveShortFileName As String
Public WaveRenameNecessary As Boolean
'These were the public variables
'=====================================================
Private Declare Function mciSendString Lib "winmm. dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrrtning As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Declare Function GetShortPathName Lib "kernel32" _
Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Страницы: 1, 2, 3