Results 1 to 7 of 7

Thread: Play .WAV file?

  1. #1

    Thread Starter
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157

    Play .WAV file?

    Hi,
    I am writting a C++ application using OpenGL and GLUT. I am working to avoid platform specific references in the code such as Windows. I hope to make this program port over to Linux OS with very little code change.

    Are there any Class source code samples for reading a WAV file for the purpose of adding sound effects to a program? A how-to tuturial would be even better so I can learn to do this. MIDI would be the next consideration...or anything else you might recommend that is better.

    My 7 year-old thinks the program is pretty cool but he must make up his own sound effects for shooting his laser... :-) He does sound pretty cool himself. ;-)

    Regards,
    ChuckB

  2. #2
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    Take a look into SDL. I hear it is a pretty good cross-platform library for a few things.

    You also might want to see if FMOD is corss-platform. That is audio only, but I dont know if it goes to linux or not.

    Z.

  3. #3
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Isn't there something called OpenSL? The sound pendant to OpenGL? I think I've heard of it...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  4. #4
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    I think it is OpenAL. I have heard of it too, but havent seen it used much.

    Z.

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I believe UT2003 uses it...at least, the beta I had () used it.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  6. #6

    Thread Starter
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157
    Thanks for the tips. I'll let you know what I find.
    Regards,
    ChuckB

  7. #7

    Thread Starter
    Addicted Member ChuckB's Avatar
    Join Date
    Jul 2002
    Location
    South Carolina, USA
    Posts
    157
    Success!
    I am attaching a simple program. I found a tutorial on using SDL and the SDL_mixer library. After some debugging, I put together a simple console program that starts, plays a 'phaser.wav' file. That's it. I am attaching the Dev-C++ 4.01 project, source and exe along with wav file.

    You need SDL_mixer.lib to compile. Check the path in my project linker options to match your system. I think SDL.DLL is required also in system folder.

    I did it without having to initialize SDL...which I thought was interesting because I thought this was a requirement.

    I will insert this code into my OpenGL project to see if it works well.

    Any idea where I can get some free WAV special effects files?

    Thanks for the help above.

    Regards,
    ChuckB
    Attached Files Attached Files

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