Thread: Sound in OpenGL

    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Representin' Quebec
    Posts
    106
    Rep Power
    12

    Sound in OpenGL


    This is probably an easy stupid question. But I'm still deciding on wether to choose DirectX or OpenGL. I was going to go for OpenGL because of the simplicity and its portability, but I heard we have to use DirectSound for sound... Do I need the DirectX SDK to use DirectSound? Or is there an other way to play MIDI or .wav files in OpenGL? (I'm using C++ if that can help you answer)
  2. #2
  3. Perl Monkey
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    May 2003
    Location
    the far end of town where the Grickle-grass grows
    Posts
    1,860
    Rep Power
    109
    There probably are, but none will be as platform independent as OGL. Most people use DirectSound because it's easy to work with and well supported in Windows. Yes, DirectSound is part of DirectX, so I think you'd need the SDK for that, but I don't remember. It's been awhile since I've worked with it.

    Though there are other tools out there, I'm sure. From a quick google, try: http://ccrma-www.stanford.edu/~gary/rtaudio/
    Hadn't used it, but looks nice.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    14
    Rep Power
    0
    Doing sound with OpenGL would be like doing matrix algebra with winzip. But I'm sure you didn't quite mean it like that ;-)

    I recommend SDL_mixer. If you're not using direct3d, then DirectX has little to offer most developers beyond SDL. The major bonus of using SDL is that your code becomes very easily portable to mac, windows, linux, solaris, whatever floats your boat. Standards compliant C++/SDL/OpenGL should 'just work' on any supported platform.
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Representin' Quebec
    Posts
    106
    Rep Power
    12
    Cool, I checked around with both, but it said that you had to put a really high buffer rate with RtAudio on Windows or it will crash... And to use RtAudio I need the DirectSound source and headers. And SDL_mixer looks pretty good. Is SDL_mixer often updated?

    And I heard about OpenAL...how does that look?

    EDIT: Another thing about SDL_mixer, is it really 'known' by a lot of programmers? And, do you think it would be good enough to write a midi sequensing program?
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    14
    Rep Power
    0
    OpenAL is a more advanced solution than SDL_mixer. It includes powerful functionality relating to positional sound/effects. I believe that several commercial games have made use of OpenAL, including UT2003. If you're looking for something with industrial whack for 3d multimedia, then OpenAL may be for you.

    As for the amount of work going into SDL_mixer, I think that it's relatively complete. It's certainly not been abandoned, if that's what you mean.

    I believe that SDL_mixer is popular amongst non-directx developers.

    I am not informed on midi stuff. SDL_mixer has some basic timidity-based functionality, not sure if that's what you're looking for.
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Representin' Quebec
    Posts
    106
    Rep Power
    12
    Well...actually I don't know what I'm looking for yet! But what is timitdity? I went on the OpenAL and only a little bit of the hardware companies support it. And I have a good ol' crappy P166 with a 'no name' sound card. So until I get my laptop I want to hear what I'm doing! And why did you recommend SDL_mixer, do you have experience with it?
  12. #7
  13. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Representin' Quebec
    Posts
    106
    Rep Power
    12
    How about FMOD? It looks pretty good. It's even portable one the PS2 AND XBox! Anybody know a lot about FMOD?
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    14
    Rep Power
    0
    I have a little experience with SDL_mixer - I found the documentation really sane and easy to understand.

    Timidity is a free software midi synth.

    As for OpenAL, isn't that just going to use whatever sound implementation is present on your OS, rather than needing to support different sound cards itself? I exclude the advanced functionality (EAX, etc) of course.

    I've never heard of FMOD. Don't read anything into that, I'm no sound-guru.
  16. #9
  17. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Representin' Quebec
    Posts
    106
    Rep Power
    12
    Cool, thanks. Timidity is exactly what I'm looking for (i think...) But I downloaded an exmple program using OpenAL and the first thing it said was: DINPUT8.DLL was not found.

    If you didn't know, that is for DirectInput. I don't get this... why would it need that?

    FMOD is here: http://www.fmod.org/ just incase you want to see it and give me your opinion.
  18. #10
  19. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    14
    Rep Power
    0
    I guess that this particular example program used directinput - it certainly isn't a requirement for OpenAL. I quite frequently code something with a depenance on SDL when it's not strictly necessary just out of habit :-)

    As for fmod, thanks for the link - I hadn't heard about that project. It's not free software, so I probably wouldn't use it myself, but I'm glad to be aware of it.

IMN logo majestic logo threadwatch logo seochat tools logo