Gast
#296235
Hallo zusammen. Habe mir ein kleines Progrämmchen geschrieben, das
einmal auf einem Epia Board im Auto laufen soll. Nun habe ich ein
Problem: 90 Prozent auslastung auf einem P4 mit 3 Ghz. Habe den Code
angefügt. Könnt ihr vielleicht etwas finden????
Dim tinseconden As Integer
Private Sub Command1_Click() ' Play / Pause
If File1.FileName = "" Then
Else
If Command1.Caption = "Play" Then
Command1.Caption = "Pause"
playf
Else
Command1.Caption = "Play"
MediaPlayer1.Pause
End If
End If
End Sub
Private Sub Command2_Click() '1 Lied vor
If File1.ListIndex = File1.ListCount - 1 Then
File1.ListIndex = "0"
Else
File1.ListIndex = File1.ListIndex + "1"
End If
MediaPlayer1.FileName = File1.Path + "\" + File1.FileName
playf
End Sub
Private Sub Command3_Click() ' Ein Lied zurück
If File1.ListIndex - 1 <= 0 Then
File1.ListIndex = "0"
Else
File1.ListIndex = File1.ListIndex - "1"
End If
MediaPlayer1.FileName = File1.Path + "\" + File1.FileName
playf
End Sub
Private Sub Command4_Click() ' Quelle wählen
If List1.ListIndex = List1.ListCount - 1 Then
List1.ListIndex = "0"
Else
List1.ListIndex = List1.ListIndex + "1"
End If
update
End Sub
Private Sub Command5_Click() ' 20 Lieder vor
If File1.ListIndex + 20 >= File1.ListCount - 1 Then
File1.ListIndex = File1.ListCount - 1
Else
File1.ListIndex = File1.ListIndex + "20"
End If
MediaPlayer1.FileName = File1.Path + "\" + File1.FileName
playf
End Sub
Private Sub Command6_Click() ' 20 Lieder zurück
If File1.ListIndex - 20 <= 0 Then
File1.ListIndex = "0"
Else
File1.ListIndex = File1.ListIndex - "20"
End If
MediaPlayer1.FileName = File1.Path + "\" + File1.FileName
playf
End Sub
Private Sub Command7_Click() 'Forwärtz spielen
If MediaPlayer1.CurrentPosition <= MediaPlayer1.Duration Then
MediaPlayer1.CurrentPosition = MediaPlayer1.CurrentPosition + 20
Else
End If
End Sub
Private Sub Command8_Click() ' Rückwärts spielen
If MediaPlayer1.CurrentPosition >= 20 Then
MediaPlayer1.CurrentPosition = MediaPlayer1.CurrentPosition - 20
Else
MediaPlayer1.CurrentPosition = 0
End If
End Sub
Private Sub Command9_Click()
SystemDown
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Form_Load()
ReadIni
File1.FontSize = 12
List1.AddItem "Techno"
List1.AddItem "Hip Hop"
List1.AddItem "Diverses"
List1.ListIndex = 0
update
File1.ListIndex = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
'SaveIni
MediaPlayer1.Stop
End
End Sub
Private Sub Timer1_Timer()
If MediaPlayer1.CurrentPosition + 0.03 >= MediaPlayer1.Duration Then
If File1.ListIndex = File1.ListCount - 1 Then
If List1.ListIndex = List1.ListCount - 1 Then
List1.ListIndex = "0"
Else
List1.ListIndex = List1.ListIndex + "1"
End If
update
Else
File1.ListIndex = File1.ListIndex + "1"
End If
MediaPlayer1.FileName = File1.Path + "\" + File1.FileName
MediaPlayer1.Play
Else
End If
End Sub
Function update()
If List1.ListIndex = 0 Then Dir1.Path = "D:\techno"
If List1.ListIndex = 1 Then Dir1.Path = "D:\HIPHOP"
If List1.ListIndex = 2 Then Dir1.Path = "D:\DIVERSES"
File1.ListIndex = 0
playf
End Function
Function playf()
'If Check9.Value = 1 Then MediaPlayer1.FileName = Label4.Caption
'If Check9.Value = 1 Then MediaPlayer1.CurrentPosition =
Label3.Caption
'If Check9.Value = 1 Then File1.ListIndex = CInt(Label5.Caption)
MediaPlayer1.FileName = File1.Path + "\" + File1.FileName
If File1.FileName = "" Then
Else
MediaPlayer1.Play
End If
End Function
Private Sub Timer2_Timer()
tinseconden = MediaPlayer1.CurrentPosition
Dim sec9 As Integer
Dim TotalMin As Integer
Dim TotalSec As Integer
Dim PauseTime, Start, Finish, TotalTime
TotalMin = MediaPlayer1.Duration \ 60
TotalSec = MediaPlayer1.Duration - (TotalMin * 60)
Min = tinseconden \ 60
sec9 = tinseconden - (Min * 60)
If sec9 = "-1" Then sec9 = "0"
If sec9 < 10 Then sec9 = "0" & sec9
Text1.Text = " " & Min & ":" & IIf(sec9 < 10, "0", "") & sec9
PauseTime = 0.4
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
Finish = Timer ' Bis hier her für vergangene Spielzeit
tinseconden = MediaPlayer1.Duration
TotalMin = MediaPlayer1.Duration \ 60
TotalSec = MediaPlayer1.Duration - (TotalMin * 60)
Min = tinseconden \ 60
sec9 = tinseconden - (Min * 60)
If sec9 = "-1" Then sec9 = "0"
If sec9 < 10 Then sec9 = "0" & sec9
Text2.Text = " " & Min & ":" & IIf(sec9 < 10, "0", "") & sec9
PauseTime = 0.4
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
Finish = Timer
Label2.Caption = Text1.Text & " / " & Text2.Text & " / " &
File1.ListIndex + 1
End Sub
Im Dankeschön voraus