Results 1 to 2 of 2

Thread: Multimedia and MP3

  1. #1
    appi101
    Guest

    Multimedia and MP3

    Hi

    Is there anyway of knowing when a multimedia device finishes playing. At the moment I am making an MP3 player and I want to know when the current file which is playing finishes playing so that I can go to the next file in the playlist.

    I am using the mcisendstring command to play the MP3 file. The notify flag does not work.

    Thanks in advance

    Appi

  2. #2
    Hyperactive Member Wak's Avatar
    Join Date
    Nov 2000
    Location
    Brisbane, Queensland
    Posts
    298
    Just get the current mpeg position of playing:

    Code:
    Public Function GetCurrentMPEGPos() As Long
    Dim dwReturn As Long
    Dim pos As String * 255
    
    dwReturn = mciSendString("status mpeg position", pos, 255, 0&)
    
    If Not dwReturn = 0 Then  'not success
        GetCurrentMPEGPos = -1
        Exit Function
    End If
    
    GetCurrentMPEGPos = Val(pos)
    End Function
    And the total length (in Milliseconds)
    Code:
    Public Function GetTotalTimeByMS() As Long
    Dim dwReturn As Long
    Dim TotalTime As String * 255
    
    
    dwReturn = mciSendString("set mpeg time format ms", Total, 255, 0&)
    dwReturn = mciSendString("status mpeg length", TotalTime, 255, 0&)
    
    mciSendString "set mpeg time format frames", Total, 255, 0& ' return focus to frames not to time
    
    If Not dwReturn = 0 Then  'not success
        GetTotalTimeByMS = -1
        Exit Function
    End If
    
    GetTotalTimeByMS = Val(TotalTime)
    End Function
    And if GetCurrentMPEGPos >= GetTotalTimeByMS then MP3 Finished. Make sense?
    Visual Basic 6.0 Enterprise
    Visual C++ 6.0 Professional

    Wak

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width