Results 1 to 10 of 10

Thread: Can't play MP3 with VB 6 and MMControl

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    12

    Can't play MP3 with VB 6 and MMControl

    I'm using Windows XP +SP3 and Visual Basic 6

    For the life of me, I can not play MP3 audio files with MMControl.

    WAV files play OK. The MP3 files play using other commerical audio players so I know the file is OK.

    Here's my code:

    MMControl1.Command = "close"
    MMControl1.Notify = False
    MMControl1.Wait = True
    MMControl1.Shareable = False

    MMControl1.FileName = ProgPath + "James.mp3"
    MMControl1.Command = "Open"
    MMControl1.Command = "Play"

    I have tried adding MMControl1.DeviceType with "WaveAudio" and
    "MPEGVideo" but I get the same results: WAV plays, MP3 does not.

    I have downloaded a couple of VB6 MMControl programs from Planet Source that are reported to play MP3 audio but I get the same results. WAV yes, MP3 no.

    Are there any other settings that I need to make to get this thing to work?

    All help is greatly appreciated!!

    Peter

  2. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Can't play MP3 with VB 6 and MMControl

    Try my DirectShow engine that I use to play mp3's in my programs. It's easy as one two three. For any other projects including yours, you'll need to add the ActiveMovie control type library in Project > References and my modDirectShow module. With my engine you even have control over the speed of the song, volumn, balance, position, play, pause, stop, and loop.

    [EDIT] The Index's in my functions of the engine are used for if your program wants to use multiple songs like for example a game. Like for song 1 its index 0, song 2 is index 1, and so on. To load a song and play it you would do this:


    vb Code:
    1. Private Sub Form_Load()
    2.  
    3.     DirectShow_Load App.Path & "\your song here.mp3", 0
    4.     DirectShow_Play 0
    5.  
    6. End Sub
    Attached Files Attached Files

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    12

    Re: Can't play MP3 with VB 6 and MMControl

    Thanks for your response Jacob!

    I tried to download and run your DirectShow but the zip file is missing the module modDirectShow.bas.

    Any chance you could email it to me at [email protected]?

    Your ability to change the speed is exactly what my application needs.

    Big Thanks

    Peter

  4. #4
    Fanatic Member
    Join Date
    Mar 2009
    Posts
    804

    Re: Can't play MP3 with VB 6 and MMControl

    MMControl1.FileName = ProgPath + "James.mp3"
    You code works fine for me, when I change the above line
    to the actual path of an mp3. Does ProgPath have a trailing backslash?

    Try Debug.Print ProgPath + "James.mp3"
    Perhaps you meant App.Path & "\James.mp3" ?

  5. #5
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Can't play MP3 with VB 6 and MMControl

    Sorry about that. I deleted the attachment, rezipped it, and now it has modDirectShow.mod located about. Refer back to post 2 for the project.

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    12

    Re: Can't play MP3 with VB 6 and MMControl

    VBBClassicRocks:

    Yes, I am OK on the value of ProgPaath. I set it via:

    ProgPath = App.Path+"\"

    Jacob:

    Thanks for the module, it ran OK but mp3 still will not play.

    I found a property with MMControl to get me an error code.

    My code is now:
    MMControl1.Command = "Open"
    Debug.Print "Open ";MMControl1.Error;" "; MMControl1.ErrorMessage
    MMControl1.Command = "Play"
    Debug.Print "Play ";MMControl1.Error;" "; MMControl1.ErrorMessage

    and get the following:
    Open 296 The specified file cannot be played on the specified MCI device. The file may be corrupt, not in the correct format, or no file handler available for this format.
    Play 257 Invalid MCI device ID. Use the ID returned when opening the MCI device.

    What I have now is:
    1. My (and others) VB6 programs using MMControl or sndPlaySound or PlaySound functions will play WAV files but not MP3.

    2. My commerical audio players, QuickTime, Audacity, Dell Jukbox, Virtual DJ, Real Player, will play both.

    3. Windows Media Player gives a message:

    "An audio codec is needed to play this file. To determine if this codec is avail to download from the Web, click Web Help". Clicking Web Help button goes to a web page that says:
    Windows Media Player Error Message Help

    "You've encountered error message C00D10D1 while using Windows Media Player. The following information might help you troubleshoot the issue.

    "Codec is missing

    "Windows Media Player cannot play the file (or cannot play either the audio or video portion of the file) because the MP3 - MPEG Layer III (55) codec is not installed on your computer.

    "The missing codec might be available to download from the Internet. For more information about codecs, see Codecs: frequently asked questions."

    So, now I learn about Codecs!

    Thanka alkl.

    Peter
    St. Augustine

  7. #7

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    12

    Re: Can't play MP3 with VB 6 and MMControl

    Oh man, I'm still stuck.

    I deleted VB6 and reinstalled it after several attempts. No change.

    Then, I downlkoaded and installed K-Lite_Codec_Pack_790_Full.exe from
    www.majorgeeks.com web site.

    Still no change. WAV yes, MP3 no.

    Anybody got any ideas????

    Peter

  8. #8
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Can't play MP3 with VB 6 and MMControl

    I think something on your computer got accidently deleted cause mp3s should run like nothing by default, and most definitely on Windows XP SP3. Your best bet is to reinstall Windows XP OS without having to delete whats already on your harddrive.

    If you arern't able to reinstall Windows or feel you don't want to, you also could try downloading an updated Windows Media Player (32 bit version of course) which has the necessary codecs to run. Installing DivX codec may help too, even though it's mainly for movies, I heard it supports mp3's as well. Also note that it's not VB6 that's the issue if Windows Media Player is popping an error message. It's definitely codec related.

  9. #9

    Thread Starter
    New Member
    Join Date
    Mar 2008
    Posts
    12

    Smile Re: Can't play MP3 with VB 6 and MMControl

    EUREKA !!

    I got it working. It was a Codec problem.

    First, I unistalled VB6 and installed it again (not sure if this did any good)

    Downloaded and ran "Layer III Audio Encoder 1.0.70111.exe"
    One site is:
    http://www.free-codecs.com/download/...io_Encoder.htm

    In my VB6 program, I used MMControl1.DeviceType = "MPEGVideo" instead of "Wave Audio"

    And it all worke.

    Thanks for the help, guys.

  10. #10
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Can't play MP3 with VB 6 and MMControl

    Glad you got it working. Please make the thread "Resolved" if you have finished with it by following the instructions in my sig.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

Tags for this Thread

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