home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Audio_Reco210496362008.psc / frmMP3Settings.frm < prev    next >
Text File  |  2008-02-22  |  12KB  |  397 lines

  1. VERSION 5.00
  2. Begin VB.Form frmMP3Settings 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "MP3 Encoding configuration"
  5.    ClientHeight    =   4095
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   6630
  9.    BeginProperty Font 
  10.       Name            =   "Tahoma"
  11.       Size            =   8.25
  12.       Charset         =   238
  13.       Weight          =   400
  14.       Underline       =   0   'False
  15.       Italic          =   0   'False
  16.       Strikethrough   =   0   'False
  17.    EndProperty
  18.    LinkTopic       =   "Form1"
  19.    MaxButton       =   0   'False
  20.    MinButton       =   0   'False
  21.    ScaleHeight     =   4095
  22.    ScaleWidth      =   6630
  23.    ShowInTaskbar   =   0   'False
  24.    StartUpPosition =   1  'CenterOwner
  25.    Begin VB.OptionButton optABR 
  26.       Caption         =   "ABR"
  27.       Height          =   255
  28.       Left            =   5040
  29.       TabIndex        =   20
  30.       Top             =   120
  31.       Width           =   735
  32.    End
  33.    Begin VB.OptionButton optVBR 
  34.       Caption         =   "VBR"
  35.       Height          =   255
  36.       Left            =   2640
  37.       TabIndex        =   19
  38.       Top             =   120
  39.       Width           =   735
  40.    End
  41.    Begin VB.OptionButton optCBR 
  42.       Caption         =   "CBR"
  43.       Height          =   255
  44.       Left            =   600
  45.       TabIndex        =   18
  46.       Top             =   120
  47.       Width           =   735
  48.    End
  49.    Begin VB.CommandButton btnClose 
  50.       Caption         =   "Close"
  51.       Height          =   375
  52.       Left            =   2520
  53.       TabIndex        =   17
  54.       Top             =   3600
  55.       Width           =   1455
  56.    End
  57.    Begin VB.Frame fraABR 
  58.       Height          =   1095
  59.       Left            =   4320
  60.       TabIndex        =   12
  61.       Top             =   360
  62.       Width           =   2175
  63.       Begin VB.ComboBox cmbABRAvgBitrate 
  64.          Height          =   315
  65.          ItemData        =   "frmMP3Settings.frx":0000
  66.          Left            =   1200
  67.          List            =   "frmMP3Settings.frx":0016
  68.          Style           =   2  'Dropdown List
  69.          TabIndex        =   13
  70.          Top             =   600
  71.          Width           =   855
  72.       End
  73.       Begin VB.Label lblABRMinBitrate 
  74.          AutoSize        =   -1  'True
  75.          Caption         =   "Average bitrate:"
  76.          Height          =   195
  77.          Left            =   120
  78.          TabIndex        =   14
  79.          Top             =   300
  80.          Width           =   1200
  81.       End
  82.    End
  83.    Begin VB.Frame fraLamePath 
  84.       Caption         =   "Path to lame.exe"
  85.       Height          =   1215
  86.       Left            =   120
  87.       TabIndex        =   10
  88.       Top             =   2160
  89.       Width           =   6375
  90.       Begin VB.OptionButton optAppPath 
  91.          Caption         =   "Application Path"
  92.          Height          =   255
  93.          Left            =   240
  94.          TabIndex        =   16
  95.          Top             =   360
  96.          Width           =   1695
  97.       End
  98.       Begin VB.OptionButton optSpecific 
  99.          Caption         =   "Specific:"
  100.          Height          =   255
  101.          Left            =   240
  102.          TabIndex        =   15
  103.          Top             =   780
  104.          Width           =   1815
  105.       End
  106.       Begin VB.TextBox txtLamePath 
  107.          Height          =   350
  108.          Left            =   2160
  109.          TabIndex        =   11
  110.          Top             =   720
  111.          Width           =   3975
  112.       End
  113.    End
  114.    Begin VB.Frame fraVBR 
  115.       Height          =   1695
  116.       Left            =   2040
  117.       TabIndex        =   1
  118.       Top             =   360
  119.       Width           =   2175
  120.       Begin VB.ComboBox cmbVBRRoutine 
  121.          Height          =   315
  122.          ItemData        =   "frmMP3Settings.frx":0036
  123.          Left            =   1200
  124.          List            =   "frmMP3Settings.frx":0040
  125.          Style           =   2  'Dropdown List
  126.          TabIndex        =   22
  127.          Top             =   1320
  128.          Width           =   855
  129.       End
  130.       Begin VB.ComboBox cmbVBRMinBitrate 
  131.          Height          =   315
  132.          ItemData        =   "frmMP3Settings.frx":004E
  133.          Left            =   1200
  134.          List            =   "frmMP3Settings.frx":0064
  135.          Style           =   2  'Dropdown List
  136.          TabIndex        =   9
  137.          Top             =   600
  138.          Width           =   855
  139.       End
  140.       Begin VB.ComboBox cmbVBRMaxBitrate 
  141.          Height          =   315
  142.          ItemData        =   "frmMP3Settings.frx":0084
  143.          Left            =   1200
  144.          List            =   "frmMP3Settings.frx":009A
  145.          Style           =   2  'Dropdown List
  146.          TabIndex        =   8
  147.          Top             =   960
  148.          Width           =   855
  149.       End
  150.       Begin VB.ComboBox cmbVBRQuality 
  151.          Height          =   315
  152.          ItemData        =   "frmMP3Settings.frx":00BA
  153.          Left            =   1200
  154.          List            =   "frmMP3Settings.frx":00BC
  155.          Style           =   2  'Dropdown List
  156.          TabIndex        =   5
  157.          Top             =   240
  158.          Width           =   855
  159.       End
  160.       Begin VB.Label lblVBRRoutine 
  161.          AutoSize        =   -1  'True
  162.          Caption         =   "VBR Routine:"
  163.          Height          =   195
  164.          Left            =   120
  165.          TabIndex        =   21
  166.          Top             =   1380
  167.          Width           =   945
  168.       End
  169.       Begin VB.Label lblMaxBitrate 
  170.          Caption         =   "Max. bitrate:"
  171.          Height          =   255
  172.          Left            =   120
  173.          TabIndex        =   7
  174.          Top             =   1020
  175.          Width           =   1095
  176.       End
  177.       Begin VB.Label lblMinBitrate 
  178.          AutoSize        =   -1  'True
  179.          Caption         =   "Min. bitrate:"
  180.          Height          =   195
  181.          Left            =   120
  182.          TabIndex        =   6
  183.          Top             =   660
  184.          Width           =   885
  185.       End
  186.       Begin VB.Label lblQuality 
  187.          AutoSize        =   -1  'True
  188.          Caption         =   "Quality:"
  189.          Height          =   195
  190.          Left            =   120
  191.          TabIndex        =   4
  192.          Top             =   300
  193.          Width           =   570
  194.       End
  195.    End
  196.    Begin VB.Frame fraCBR 
  197.       Height          =   735
  198.       Left            =   120
  199.       TabIndex        =   0
  200.       Top             =   360
  201.       Width           =   1815
  202.       Begin VB.ComboBox cmbCBRBitrate 
  203.          Height          =   315
  204.          ItemData        =   "frmMP3Settings.frx":00BE
  205.          Left            =   840
  206.          List            =   "frmMP3Settings.frx":00D4
  207.          Style           =   2  'Dropdown List
  208.          TabIndex        =   3
  209.          Top             =   240
  210.          Width           =   855
  211.       End
  212.       Begin VB.Label lblBitrate 
  213.          AutoSize        =   -1  'True
  214.          Caption         =   "Bitrate:"
  215.          Height          =   195
  216.          Left            =   120
  217.          TabIndex        =   2
  218.          Top             =   300
  219.          Width           =   540
  220.       End
  221.    End
  222. End
  223. Attribute VB_Name = "frmMP3Settings"
  224. Attribute VB_GlobalNameSpace = False
  225. Attribute VB_Creatable = False
  226. Attribute VB_PredeclaredId = True
  227. Attribute VB_Exposed = False
  228. Option Explicit
  229.  
  230. Dim bLoaded As Boolean
  231.  
  232. Private Sub btnClose_Click()
  233.     With MP3_Settings
  234.         If optCBR.Value = True Then
  235.             .MP3_Type = CBR
  236.         ElseIf optVBR.Value = True Then
  237.             .MP3_Type = vbr
  238.         ElseIf optABR.Value = True Then
  239.             .MP3_Type = ABR
  240.         End If
  241.         
  242.         .VBR_Quality = cmbVBRQuality.ListIndex
  243.         .VBR_Routine = cmbVBRRoutine.ListIndex
  244.         .VBR_MaxBitrate = FindBitrate(cmbVBRMaxBitrate.ListIndex)
  245.         .VBR_MinBitrate = FindBitrate(cmbVBRMinBitrate.ListIndex)
  246.         .ABR_AvgBitrate = FindBitrate(cmbABRAvgBitrate.ListIndex)
  247.         .CBR_Bitrate = FindBitrate(cmbCBRBitrate.ListIndex)
  248.         
  249.         If optSpecific.Value = True Then
  250.             .LAME = txtLamePath.Text
  251.         Else
  252.             .LAME = ""
  253.         End If
  254.     End With
  255.     
  256.     Unload Me
  257. End Sub
  258.  
  259. Private Sub Form_Load()
  260.     Dim i As Integer
  261.     
  262.     For i = 0 To 9
  263.         cmbVBRQuality.AddItem CStr(i), i
  264.     Next i
  265.     
  266.     With MP3_Settings
  267.         cmbCBRBitrate.ListIndex = FindIndex(.CBR_Bitrate)
  268.         cmbABRAvgBitrate.ListIndex = FindIndex(.ABR_AvgBitrate)
  269.         cmbVBRQuality.ListIndex = .VBR_Quality
  270.         cmbVBRMinBitrate.ListIndex = FindIndex(.VBR_MinBitrate)
  271.         cmbVBRMaxBitrate.ListIndex = FindIndex(.VBR_MaxBitrate)
  272.         cmbVBRRoutine.ListIndex = .VBR_Routine
  273.         
  274.         If .MP3_Type = CBR Then
  275.             optCBR.Value = True
  276.         ElseIf .MP3_Type = ABR Then
  277.             optABR.Value = True
  278.         ElseIf .MP3_Type = vbr Then
  279.             optVBR.Value = True
  280.         End If
  281.         
  282.         If .LAME = "" Then
  283.             optAppPath.Value = True
  284.         Else
  285.             optSpecific.Value = True
  286.             txtLamePath.Text = .LAME
  287.         End If
  288.     End With
  289.     
  290.     bLoaded = True
  291. End Sub
  292.  
  293. Private Sub optABR_Click()
  294.     If optABR.Value = True Then
  295.         ABR_Enable
  296.         VBR_Disable
  297.         CBR_Disable
  298.     End If
  299. End Sub
  300.  
  301. Private Sub optAppPath_Click()
  302.     txtLamePath.Enabled = False
  303. End Sub
  304.  
  305. Private Sub optSpecific_Click()
  306.     txtLamePath.Enabled = True
  307.     If bLoaded = True Then txtLamePath.SetFocus
  308. End Sub
  309.  
  310. Private Sub optVBR_Click()
  311.     If optVBR.Value = True Then
  312.         VBR_Enable
  313.         ABR_Disable
  314.         CBR_Disable
  315.     End If
  316. End Sub
  317.  
  318. Private Sub optCBR_Click()
  319.     If optCBR.Value = True Then
  320.         CBR_Enable
  321.         VBR_Disable
  322.         ABR_Disable
  323.     End If
  324. End Sub
  325.  
  326. Sub CBR_Enable()
  327.     fraCBR.Enabled = True
  328.     cmbCBRBitrate.Enabled = True
  329. End Sub
  330.  
  331. Sub CBR_Disable()
  332.     fraCBR.Enabled = False
  333.     cmbCBRBitrate.Enabled = False
  334. End Sub
  335.  
  336. Sub VBR_Enable()
  337.     fraVBR.Enabled = True
  338.     cmbVBRMinBitrate.Enabled = True
  339.     cmbVBRMaxBitrate.Enabled = True
  340.     cmbVBRQuality.Enabled = True
  341.     cmbVBRRoutine.Enabled = True
  342. End Sub
  343.  
  344. Sub VBR_Disable()
  345.     fraVBR.Enabled = False
  346.     cmbVBRMinBitrate.Enabled = False
  347.     cmbVBRMaxBitrate.Enabled = False
  348.     cmbVBRQuality.Enabled = False
  349.     cmbVBRRoutine.Enabled = False
  350. End Sub
  351.  
  352. Sub ABR_Enable()
  353.     fraABR.Enabled = True
  354.     cmbABRAvgBitrate.Enabled = True
  355. End Sub
  356.  
  357. Sub ABR_Disable()
  358.     fraABR.Enabled = False
  359.     cmbABRAvgBitrate.Enabled = False
  360. End Sub
  361.  
  362. Function FindIndex(ByVal Bitrate As Integer) As Integer
  363.     If Bitrate = 320 Then
  364.         FindIndex = 0
  365.     ElseIf Bitrate = 256 Then
  366.         FindIndex = 1
  367.     ElseIf Bitrate = 192 Then
  368.         FindIndex = 2
  369.     ElseIf Bitrate = 128 Then
  370.         FindIndex = 3
  371.     ElseIf Bitrate = 96 Then
  372.         FindIndex = 4
  373.     ElseIf Bitrate = 64 Then
  374.         FindIndex = 5
  375.     Else
  376.         FindIndex = -1
  377.     End If
  378. End Function
  379.  
  380. Function FindBitrate(ByVal Index As Integer) As Integer
  381.     If Index = 0 Then
  382.         FindBitrate = 320
  383.     ElseIf Index = 1 Then
  384.         FindBitrate = 256
  385.     ElseIf Index = 2 Then
  386.         FindBitrate = 192
  387.     ElseIf Index = 3 Then
  388.         FindBitrate = 128
  389.     ElseIf Index = 4 Then
  390.         FindBitrate = 96
  391.     ElseIf Index = 5 Then
  392.         FindBitrate = 96
  393.     Else
  394.         FindBitrate = -1
  395.     End If
  396. End Function
  397.