play MP3 on win32 consol project

This is a discussion on play MP3 on win32 consol project within the C++ Programming forums, part of the General Programming Boards category; How can i do that ?!...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    5

    play MP3 on win32 consol project

    How can i do that ?!

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Code:
    ShellExecute(0, TEXT("open"), path, 0, 0, SW_SHOWNA);
    Do you really think playing MP3s is so trivial? You can call upon other programs to do the playing (as the above line does - it opens your standard media player), but playing an MP3 yourself is not trivial. You need to decode it, and you need to send the decoded data to the soundcard. Complicated.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    Dec 2007
    Posts
    5
    I dont want to really read the mp3 file convert it and play it, i just want to add to my application a backround music from mp3 i have.
    How do i do that ?
    i tried to use ShellExecute, but Visual studio 2005 doesnt reconize it... :\

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,702

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,029
    The matter is complicated. You could do it through an external library or use DirectShow. That's probably the easiest way. There are plenty of sample code on CodeProject to play mp3. Why not give it a look?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    DirectShow is the simplest way to do this short of using a third party library. Keep in mind that DirectShow is no longer a part of DirectX and is available in the Platform/Windows SDK (for XP). They are planning on removing DirectShow completely but I'm not sure if they have or not. They might as well since they already removed everything that is of worth in XP from Vista.

  7. #7
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Er, how will the myriad of video players work, then?
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  8. #8
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    I dunno. But I know there were plans to remove it.

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,029
    They plan to remove it!? Are they drinking beer again? :/
    Where did you originally learn this?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    I learned it way back when I began writing my DXShowWnd class which wrapped DirectShow. At first I thought it odd that it was no longer in the DX SDK. So I found out it was in the Platform SDK and that eventually it would be merged into something completely different in future versions. I'm not sure if that still holds true today.

    Microsoft changes fundamental designs in the blink of an eye. Unfortunately those decisions have far reaching impacts and are a pain in my arse.

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,029
    They are a pain to everyone. Although I wouldn't be sad if they were to upgrade it without the use of COM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Emulator
    Join Date
    Feb 2008
    Posts
    43
    Or you could just make your own background music using system beeps lol. They are featured in the windows library, super easy too! But as he said, it's complicated.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pls post here tricks that you know of in C/C++, thanks
    By mickey in forum C++ Programming
    Replies: 55
    Last Post: 06-12-2003, 05:28 PM
  2. Play Mp3...
    By Jperensky in forum C++ Programming
    Replies: 3
    Last Post: 04-26-2003, 03:08 PM
  3. Cribbage Game
    By PJYelton in forum Game Programming
    Replies: 14
    Last Post: 04-07-2003, 11:00 AM
  4. How do I play an MP3?
    By Hunter2 in forum Windows Programming
    Replies: 28
    Last Post: 05-20-2002, 09:49 PM
  5. MP3 Device Type with mciSendCommand
    By Unregistered in forum Windows Programming
    Replies: 0
    Last Post: 04-30-2002, 09:47 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21