ToolTipText = "Sets the bitrate of the output file. The higher the bitrate, the better the quality, the larger the size"
Top = 1920
Width = 735
End
Begin VB.CheckBox Check1
Caption = "Use VBR"
Height = 255
Left = 480
TabIndex = 7
Top = 1560
Width = 1335
End
Begin VB.ComboBox cmbMode
Height = 315
Left = 1080
Style = 2 'Dropdown List
TabIndex = 6
ToolTipText = "Sets the encoding mode (Stereo, Mono, etc)"
Top = 960
Width = 1335
End
Begin VB.ComboBox cmbFreq
Height = 315
Left = 3960
Style = 2 'Dropdown List
TabIndex = 5
ToolTipText = "Sets the frequency of the output file. Set to Auto if you do not know the original frequency of the input file"
Top = 360
Width = 855
End
Begin VB.ComboBox cmbBitrate
Height = 315
Left = 1080
Style = 2 'Dropdown List
TabIndex = 4
ToolTipText = "Sets the bitrate of the output file. The higher the bitrate, the better the quality, the larger the size"
Top = 360
Width = 735
End
Begin VB.Label Label10
Caption = "Quality:"
Enabled = 0 'False
Height = 255
Left = 3120
TabIndex = 25
Top = 1965
Width = 615
End
Begin VB.Label Label9
Caption = "Max. Bitrate:"
Enabled = 0 'False
Height = 255
Left = 480
TabIndex = 24
Top = 1965
Width = 1095
End
Begin VB.Label Label8
Caption = "kbits/sec"
Enabled = 0 'False
Height = 255
Left = 2280
TabIndex = 23
Top = 1965
Width = 735
End
Begin VB.Label Label7
Caption = "Mode:"
Height = 255
Left = 480
TabIndex = 19
Top = 1000
Width = 615
End
Begin VB.Label Label6
Caption = "Hz"
Height = 255
Left = 4920
TabIndex = 18
Top = 400
Width = 375
End
Begin VB.Label Label5
Caption = "Frequency:"
Height = 255
Left = 3000
TabIndex = 17
Top = 405
Width = 975
End
Begin VB.Label Label4
Caption = "kbits/sec"
Height = 255
Left = 1920
TabIndex = 16
Top = 400
Width = 735
End
Begin VB.Label Label3
Caption = "Bitrate:"
Height = 255
Left = 480
TabIndex = 15
Top = 405
Width = 615
End
End
Begin VB.Frame Frame1
Caption = "File Settings"
Height = 1815
Left = 240
TabIndex = 0
Top = 240
Width = 5655
Begin VB.TextBox txtFile
Height = 285
Left = 1080
TabIndex = 1
Top = 360
Width = 4215
End
Begin VB.CommandButton cmdBrowse
Caption = "Browse"
Height = 375
Left = 4080
TabIndex = 2
Top = 720
Width = 1215
End
Begin VB.TextBox txtOutput
Height = 285
Left = 1080
TabIndex = 3
Top = 1200
Width = 4215
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Caption = "File:"
Height = 255
Left = 600
TabIndex = 13
Top = 390
Width = 375
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "Output:"
Height = 255
Left = 360
TabIndex = 12
Top = 1245
Width = 615
End
End
Begin MSComDlg.CommonDialog cd1
Left = 5400
Top = 3840
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.Label lblPercent
Alignment = 1 'Right Justify
Caption = "0%"
Height = 255
Left = 4680
TabIndex = 22
Top = 5535
Width = 375
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click()
If Check1.Value = 1 Then
Label8.Enabled = True
Label9.Enabled = True
cmbMaxBitRate.Enabled = True
Label10.Enabled = True
vbrQual.Enabled = True
Else
Label8.Enabled = False
Label9.Enabled = False
cmbMaxBitRate.Enabled = False
Label10.Enabled = False
vbrQual.Enabled = False
End If
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
cmdEditID3.Enabled = True
Else
cmdEditID3.Enabled = False
End If
End Sub
Private Sub cmbEncode_Click()
On Local Error Resume Next
Dim Mode As Byte
Dim ret As EncodingErrors
Dim SampleRate As Long
If cmbMode.Text = "Stereo" Then Mode = 0
If cmbMode.Text = "Joint Stereo" Then Mode = 1
If cmbMode.Text = "Dual Channel" Then Mode = 2
If cmbMode.Text = "Mono" Then Mode = 3
cmbEncode.Enabled = False
cmdCancel.Enabled = True
SampleRate = Val(cmbFreq.Text)
Err.Clear
If cmbFreq.ListIndex = 0 Then
Open txtFile.Text For Binary Access Read As #1
If Err Then
MsgBox "Could not open input file!", vbExclamation + vbOKOnly, App.Title
Exit Sub
End If
Get #1, 25, SampleRate
Close #1
If SampleRate <> 32000 And SampleRate <> 44100 And SampleRate <> 48000 Then
If cmbBitrate.Text <> "128" Then
MsgBox "The detected sample rate (" & (SampleRate / 1000) & " KHz) is not fully supported by the encoder. For higher compatibility, the bitrate will be automatically set to 128 kbits/sec. There is a possibility that encoding will not succeed.", vbOKOnly + vbInformation
cmbBitrate.ListIndex = 8
End If
End If
Debug.Print SampleRate
End If
If Check1.Value = 1 Then
If SampleRate <> 32000 And SampleRate <> 44100 And SampleRate <> 48000 Then
MsgBox "The detected sample rate (" & (SampleRate / 1000) & " KHz) is not supported by VBR! Please choose between 32000, 44100, or 48000.", vbOKOnly + vbExclamation
cmbEncode.Enabled = True
cmdCancel.Enabled = False
Exit Sub
End If
ret = SetVBR(1, vbrQual.Value, VBR_METHOD_DEFAULT, Val(cmbMaxBitRate.Text))
End If
ret = EncodeMp3(txtFile.Text, txtOutput.Text, Val(cmbBitrate.Text), SampleRate, Mode, AddressOf EnumEncoding)