Thread: Playing sound files...

  1. #1
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133

    Playing sound files...

    Hi.
    If I want to play a *.mp3 file I use something like this:

    PHP Code:
    mciSendString "Play blah.mp3"00); 
    and that works fine but I have 2 problems/questions:

    1. How to play a sound file that has spaces in his name like "blah blah.mp3", I have tried many thing but they all didn't work, ?

    2. How can I find/get the duration of sound file, something like Media Player, ?

    Thanks Yuri.

  2. #2
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    this should work
    Code:
     mciSendString ( "Play \"blah with spaces.mp3\"", 0, 0, 0 );
    Kurt

  3. #3
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  4. #4
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133
    To ZuK: On one way or another that doesn't work for me, with quotes, I don't know why but it just doesn't. There are other ways to do this but I am just finding the easiest one.

  5. #5
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    Hey Yuri, are you a skater?
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  6. #6
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133
    Ehh yeah, why? And what got this to do with my problem, =p.

  7. #7
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    well nothing, just that there are rare skater-programmers
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  8. #8
    Banned Yuri's Avatar
    Join Date
    Aug 2005
    Location
    Breukelen, The Netherlands
    Posts
    133
    I started skating when I was bored in the summer holliday, it was nice wetter, but then the next year in the summer holliday it was raining a lot so I couldn't skate very much and I after always playing games I was interested in how they actually work, because of that I started programming and learning tutorials, I also have a lot of help from my famely because almost my whole famely are programmers, too bad that my father is a Main Frame programma and he works with Cobol so he can't actually help me.

    Now back to the problem; Because the program reads the filename and put it in a string I can rename the *.mp3 file to a name without spaces and then play it and after use rename it back, what do you think?

  9. #9
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Here's how we know you're a skater. http://cboard.cprogramming.com/showthread.php?t=69450 (in signature).

    Because the program reads the filename and put it in a string I can rename the *.mp3 file to a name without spaces and then play it and after use rename it back, what do you think?
    Yes you could, or
    Code:
    mciSendString ( "Play blah.mp3", 0, 0, 0 );
    ->
    Code:
    mciSendString ( "Play \"blah with spaces.mp3\"", 0, 0, 0 );
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  10. #10
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    Quote Originally Posted by dwks
    Here's how we know you're a skater. http://cboard.cprogramming.com/showthread.php?t=69450
    I just looked at the avatar. "ZERO"
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  11. #11
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Oh. Well, in my link, his email address contains "skate".
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  12. #12
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    Quote Originally Posted by dwks
    his email address contains "skate".
    good notice indeed !
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  13. #13
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    hey dwks what does DWK means ?
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

  14. #14
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Initials.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  15. #15
    the Great ElastoManiac's Avatar
    Join Date
    Nov 2005
    Location
    Republika Srpska - Balkan
    Posts
    377
    ahhhh, i searched it with google and got some strange garman site "Digitale Werkstukken Kast".
    So i was curious...
    lu lu lu I've got some apples lu lu lu You've got some too lu lu lu Let's make some applesauce Take off our clothes and lu lu lu

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Playing MP3 files in C++
    By peyman_k in forum C++ Programming
    Replies: 6
    Last Post: 07-29-2008, 05:25 PM
  2. Playing a sound wave?
    By Blackroot in forum C++ Programming
    Replies: 1
    Last Post: 01-08-2006, 02:01 AM
  3. Playing sound without internal speaker in C
    By Rainy in forum C Programming
    Replies: 1
    Last Post: 03-30-2005, 11:24 AM
  4. I Need To Know Some Things That I Can Put Into A Batch File
    By TheRealNapster in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 10-20-2003, 08:12 PM
  5. Help me modify my Sound Server
    By zdude in forum C Programming
    Replies: 1
    Last Post: 05-14-2003, 05:15 PM