DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 2 of 5 FirstFirst 1234 ... LastLast
Results 16 to 30 of 66

Thread: Help in Debugging this MP3 Player

  1. #16
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    I'll show you how to load a folder into a listbox.

    But, then you need to figure out how to select a listbox item and feed it to your player. I'm not gonna do everything.

    How much class time have you had in VB?

  2. #17
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Code:
    Private Sub Command1_Click()
    Dim strLoad As String
    List1.Clear
    strLoad = Dir("c:\mp3\*.mp3")
    Do While strLoad > vbNullString
       List1.AddItem strLoad
       strLoad = Dir
    Loop
    End Sub
    As I've never used mp3 files, I'm uncertain regarding their file extension, so if my example is wrong, then make the necessary changes.

  3. #18
    Join Date
    Mar 2008
    Posts
    130
    How much class time have you had in VB?
    none..hehe

    Private Sub Command1_Click()
    Dim strLoad As String
    List1.Clear
    strLoad = Dir("c:\mp3\*.mp3")
    Do While strLoad > vbNullString
    List1.AddItem strLoad
    strLoad = Dir
    Loop
    End Sub
    ill try this..

    im starting to like this community..fast reply on topics..

  4. #19
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    That should get all your files in your listbox.

    Now it is a matter of selecting one and feeding it into the player.

  5. #20
    Join Date
    Mar 2008
    Posts
    130
    hi how do i make the the progress bar work?
    Last edited by chokies12; 03-26-2008 at 07:27 AM.

  6. #21
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    I don't know what you mean by that.

  7. #22
    Join Date
    Mar 2008
    Posts
    130
    i placed a progress bar to my mp3 player..how will i make it work?how will i able to sync it while my mp3 is playing..

  8. #23
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Not unless you have programming code that is performing some type of loop.

  9. #24
    Join Date
    Mar 2008
    Posts
    130
    hmmp..i think i should put the timer first?can you help me with that?

  10. #25
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    You are jumping all over the place. What timer?

  11. #26
    Join Date
    Mar 2008
    Posts
    130
    oooppss..sorry..i want to put a timer to my mp3 player..so it will show the duration of a song..

  12. #27
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    And how will it know the duration of the song?

  13. #28
    Join Date
    Mar 2008
    Posts
    130
    this is what i want to do..this is in my reference mp3 player

    i think this is the code for it but i cant understand it

    Code:
    Private Sub playTimer_Timer()
    
    'Timer is available on playing
    If PlayerIsPlaying = True Then
      'Handle stop after the song is over
      If PlayerPos.CurrentPosition >= PlayerPos.Duration Then
         StopPlay
         PlayerIsPlaying = False
         playTimer.Enabled = False
         'Check if we should loop
         If chkLoop.Value = 1 Then
              Play
         End If
         Exit Sub
      End If
      'If still playing
      lblTimer.Caption = ToTimeValues(PlayerPos.CurrentPosition)
      'Animate icon
      If i > 1 Then i = 0
      Me.Icon = ImgIco(i).Picture
      i = i + 1
      'Position bar is for mp3 files only
      If LCase(Right(txtFile, 3)) = "mp3" Then
         ShowTime PlayerPos.CurrentPosition
      End If
     
    End If
    
    End Sub
    Function ToTimeValues(ByVal Seconds As Long) As String
    
    'Format input value to "00:00:00"
    Dim HH As Long                   'Hours
    Dim MM As Long                   'Minutes
    Dim SS As Long                   'Seconds
    Dim tmp As String                'Temporary value
    
     'Old values time is made of
     HH = Seconds \ 3600
     MM = Seconds \ 60 Mod 60
     SS = Seconds Mod 60
     
     'If there is hour
     If HH > 0 Then tmp = Format$(HH, "00:")
     'Format input
     ToTimeValues = tmp & Format$(MM, "00:") & Format$(SS, "00")
     
    End Function
    
    Sub ShowTime(ByVal iDur As Integer)
           
        'Set the position bar to player position
        picProgBack.Visible = True
        'Clear pictures
        picProgBack.Cls
        picProg.Cls
        'Customizable color of the position bar
        picProg.BackColor = vbBlue
        'Bar width depends on current position, when max is song duration
        picProg.Width = picProgBack.ScaleWidth * ((CInt(iDur)) / PlayerPos.Duration)
        picProgBack.CurrentX = picProgBack.ScaleWidth / 2
        picProgBack.CurrentY = 1
        picProg.CurrentX = picProg.ScaleWidth / 2
        picProg.CurrentY = 1
        
        DoEvents
        
    End Sub
    here's my mp3 player


  14. #29
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Well,it looks like you already have a progress bar and a timer.

    Is it that you just don't understand how they are working?

  15. #30
    Join Date
    Mar 2008
    Posts
    130
    actualy the doenst work..i remove it..btw i already made some progress on my listbox i know how to remove/add files on the list but i dont know how to play the files that are on the list...

Similar Threads

  1. automatic mp3 player
    By xiaobai00 in forum VB Classic
    Replies: 3
    Last Post: 10-29-2007, 06:37 PM
  2. play mp3 without windows media player
    By Psirus in forum VB Classic
    Replies: 0
    Last Post: 11-23-2000, 07:52 AM
  3. play mp3 without windows media player
    By Psirus in forum VB Classic
    Replies: 0
    Last Post: 11-23-2000, 07:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center