?? form1.frm
字號:
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4320
TabIndex = 2
Top = 360
Width = 855
End
Begin VB.CommandButton bofang
Caption = "播放"
BeginProperty Font
Name = "楷體_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 960
TabIndex = 1
Top = 360
Width = 855
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private list2liebiao As Integer
Private anxiastop As Boolean
Private anguobofang As Boolean
Private danjilist1 As Boolean
Private danjilist2 As Boolean
Private removemusic As Integer
Private seeking As Integer
Private ActFrame As Long
Private yinliang As Integer
Private timer1can As Boolean
Private Sub bofang_Click()
Dim mp3str As String
Dim mpopen As Integer
mp3str = List2.List(0)
mpopen = Mp.Open(mp3str, "")
Mp.Play
anxiastop = False
anguobofang = True
ToToTime
mp3pinlv
End Sub
Private Sub Command1_Click()
Dim i As Integer
cd.ShowOpen
fn = cd.FileName
If fn <> "" Then bofang.Enabled = True
jingyibuchuliwenjianming
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub dakai_Click()
Dim i As Integer
cd.ShowOpen
fn = cd.FileName
If fn <> "" Then bofang.Enabled = True
jingyibuchuliwenjianming
End Sub
Private Sub Form_Load()
fenjiantoliebiao
With cd
.FileName = ""
.DialogTitle = "打開MP3文件"
.Flags = &H200 Or &H80000 Or &H4
.Filter = "MP3文件 (*.MP3)|*.mp3"
'.CancelError = True
End With
Dim MP3Pass As String
MP3Pass = Mp.Authorize("LightBringer", "1441658209")
remove.Enabled = False
Sliyin.Value = -50
Sliyin_Change
Slibofangsudu.Value = 100
Slishengdaoo.Value = 0
Sliguocheng.Enabled = False
timer1can = True
If List1.ListCount = 0 Then
bofang.Enabled = False
End If
kuaijin.Enabled = False
kuaitui.Enabled = False
shangyishou.Enabled = False
xiayishou.Enabled = False
tingzhi.Enabled = False
zanting.Enabled = False
End Sub
'////////
Private Sub chushihuaguocheng()
rc = mixerOpen(hmixer, DEVICEID, 0, 0, 0)
If ((MMSYSERR_NOERROR <> rc)) Then
MsgBox "11不能打開混音器,聲音動態顯示條將不能顯示" '///////判斷是否有聲卡
Timer1.Enabled = False
Pic1.Cls
Pic2.Cls
timer1can = False
Exit Sub
End If
' Get the output volume meter
ok = GetControl(hmixer, MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT, MIXERCONTROL_CONTROLTYPE_PEAKMETER, outputVolCtrl)
If (ok = True) Then
zuidayinliang = outputVolCtrl.lMaximum '///////////
Else
MsgBox "22不能打開混音器,聲音動態顯示條將不能顯示"
Timer1.Enabled = False
Pic1.Cls
Pic2.Cls
timer1can = False
End If
' Initialize mixercontrol structure
mxcd.cbStruct = Len(mxcd)
volHmem = GlobalAlloc(&H0, Len(volume)) ' Allocate a buffer for the volume value
mxcd.paDetails = GlobalLock(volHmem)
mxcd.cbDetails = Len(volume)
mxcd.cChannels = 1
Started = False
End Sub
Private Sub shishixianshiguocheng()
If (zuidayinliang <> 0) Then
mxcd.dwControlID = outputVolCtrl.dwControlID
mxcd.item = outputVolCtrl.cMultipleItems
rc = mixerGetControlDetails(hmixer, mxcd, MIXER_GETCONTROLDETAILSF_VALUE)
CopyStructFromPtr volume, mxcd.paDetails, Len(volume)
End If
If (volume < 0) Then volume = -volume
End Sub
Private Sub Form_Unload(Cancel As Integer)
GlobalFree volHmem '////退出時用
liebiaotofenjian
End Sub
'////////聲卡
Private Sub kuaijin_Click()
Mp.Seek (seeking + 255) '---想不到會如此順利
End Sub
Private Sub kuaitui_Click()
Mp.Seek (seeking - 255) '---想不到會如此順利
End Sub
Private Sub List1_Click()
danjilist1 = True
remove.Enabled = True
removemusic = List1.ListIndex
End Sub
Private Sub List1_DblClick()
Dim mp3str As String
Dim mpopen As Integer
If anguobofang = True Then
list2liebiao = List1.ListIndex - 1
Mp.Stop
Else
mp3str = List2.List(List1.ListIndex)
mpopen = Mp.Open(mp3str, "")
Mp.Play
list2liebiao = List1.ListIndex - 1
anguobofang = True
ToToTime
mp3pinlv
End If
anxiastop = False
End Sub
Private Sub List2_Click()
danjilist2 = True
remove.Enabled = True
removemusic = List2.ListIndex
'list2liebiao = List2.ListIndex
End Sub
Private Sub List2_DblClick()
Dim mp3str As String
Dim mpopen As Integer
If anguobofang = True Then
list2liebiao = List2.ListIndex - 1
Mp.Stop
Else
mp3str = List2.List(List2.ListIndex)
mpopen = Mp.Open(mp3str, "")
Mp.Play
list2liebiao = List2.ListIndex - 1
anguobofang = True
ToToTime
mp3pinlv
End If
anxiastop = False
End Sub
Private Sub mp_ThreadEnded()
If anxiastop = False Then
list2liebiao = list2liebiao + 1
If list2liebiao = List2.ListCount Then list2liebiao = 0
Dim mp3str As String
Dim mpopen As Integer
mp3str = List2.List(list2liebiao)
mpopen = Mp.Open(mp3str, "")
Mp.Play
ToToTime
mp3pinlv
End If
Slibofangsudu_Change
Slishengdaoo_Change
Timer1.Enabled = False
Pic1.Cls
Pic2.Cls
End Sub
Private Sub remove_Click()
'If List1.ListCount = 0 Then remove.Enabled = False
If danjilist1 = True Or danjilist2 = True Then
List1.RemoveItem removemusic
List2.RemoveItem removemusic
'List1.Selected(List1.ListIndex - 1) = True
End If
remove.Enabled = False
End Sub
Private Sub shangyishou_Click()
list2liebiao = list2liebiao - 2
If list2liebiao < 0 Then
list2liebiao = List2.ListCount - 2
End If
Mp.Stop
End Sub
Private Sub Slibofangsudu_Change()
Dim pvel As Variant
Dim i As Integer
i = 200 - Slibofangsudu.Value
pvel = Mp.SetSpeed(i) '控制播放速度,值越大越慢100是比較正常的
End Sub
Private Sub Sliguocheng_Change()
Dim i As Integer
Dim j As Integer
i = Sliguocheng.Value
j = Text3.Text
If i - j > 255 Or i - j < -255 Then
Mp.Seek Sliguocheng.Value
Text3.Text = Sliguocheng.Value
End If
End Sub
Private Sub Slishengdaoo_Change()
Dim zuoshengdao As Integer
Dim youshengdao As Integer
Dim pvol As Integer
If Slishengdaoo.Value < 0 Then
zuoshengdao = yinliang - Slishengdaoo.Value
youshengdao = yinliang + Slishengdaoo.Value
ElseIf Slishengdaoo.Value > 0 Then
zuoshengdao = yinliang - Slishengdaoo.Value
youshengdao = yinliang + Slishengdaoo.Value
Else
zuoshengdao = yinliang
youshengdao = yinliang
End If
pvol = Form1.Mp.SetVolumeP(zuoshengdao, youshengdao) '////控制左右聲道
End Sub
Private Sub Sliyin_Change()
yinliang = -Sliyin.Value
Dim pvol As Integer
pvol = Form1.Mp.SetVolumeP(yinliang, yinliang) '////控制音量0--120
End Sub
Private Sub Text1_Change()
If timer1can = True Then
chushihuaguocheng
Timer1.Enabled = True
End If
End Sub
Private Sub Text2_Change()
kuaijin.Enabled = True
kuaitui.Enabled = True
shangyishou.Enabled = True
xiayishou.Enabled = True
tingzhi.Enabled = True
zanting.Enabled = True
bofang.Enabled = False
End Sub
Private Sub Text3_Change()
Sliguocheng.Value = Text3.Text
Sliguocheng.Enabled = True
End Sub
Private Sub Text4_Change()
Sliguocheng.Min = 0
Sliguocheng.Max = Text4.Text
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Pic1.Cls
Pic2.Cls
' i As Variant
' Get the current output level
shishixianshiguocheng
'Dim liangdu As Double
'liangdu = Pic1.Height / zuidayinliang
'Pic1.Line (0, Pic1.Height)-(Pic1.Width, volume * liangdu * 2), RGB(0, 33, 123), BF
drawline Pic1
drawline Pic2
End Sub
Private Sub tingzhi_Click()
Mp.Stop
anxiastop = True
kuaijin.Enabled = False
kuaitui.Enabled = False
shangyishou.Enabled = False
xiayishou.Enabled = False
tingzhi.Enabled = False
zanting.Enabled = False
bofang.Enabled = True
End Sub
Private Sub xiayishou_Click()
Mp.Stop
End Sub
Private Sub zanting_Click()
Mp.Pause
If zanting.Caption = "暫停" Then
zanting.Caption = "繼續"
Timer1.Enabled = False
Pic1.Cls
Pic2.Cls
tingzhi.Enabled = False
kuaijin.Enabled = False
kuaitui.Enabled = False
shangyishou.Enabled = False
xiayishou.Enabled = False
Else
zanting.Caption = "暫停"
tingzhi.Enabled = True
kuaijin.Enabled = True
kuaitui.Enabled = True
shangyishou.Enabled = True
xiayishou.Enabled = True
End If
End Sub
'////text1最終顯示的是動的時間
Private Sub Mp_ActFrame(ByVal ActFrame As Long) '---計算時間與進度條
Dim AllSecGx As String
Dim MinGx As String
Dim SecGx As String
Dim nLen
seeking = ActFrame '---可以快進快退了
AllSecGx = (ActFrame * Mp.MsPerFrame) \ 1000
MinGx = str$(AllSecGx \ 60)
If Len(MinGx) < 3 Then
MinGx = "0" + Right(MinGx, 1)
Else
MinGx = Right(MinGx, 2)
End If
SecGx = str$(AllSecGx Mod 60)
If Len(SecGx) < 3 Then
SecGx = "0" + Right(SecGx, 1)
Else
SecGx = Right(SecGx, 2)
End If
Text1 = "00:" + MinGx + ":" + SecGx
'////text1最終顯示的是動的時間
nLen = ActFrame / Mp.FrameCount '///不知什么用處
Text3 = ActFrame '/// mp.FrameCount 歌曲總真數
Text4 = Mp.FrameCount 'FrameCount///顯示當前播放的總總真數
'////每秒播放的幀數 mp.MsPerFrame
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -