Using SDL_mixer to play ogg sound (not music) effects
I am loading a .ogg file to play as music which works correctly.
According to Mix_LoadWAV you can load .ogg files to play as sound as well. I was able to load a .wav file and play it properly, but attempting to load a .ogg file (the same music file, I removed loading it for music) I get "Unrecognized sound file type"
Has anyone had any luck loading .oggs for sound effects? Does anyone know what might be incorrect?
According to Mix_LoadWAV you can load .ogg files to play as sound as well. I was able to load a .wav file and play it properly, but attempting to load a .ogg file (the same music file, I removed loading it for music) I get "Unrecognized sound file type"
Has anyone had any luck loading .oggs for sound effects? Does anyone know what might be incorrect?
You probably want to use libvorbisfile to load the ogg file and turn it into sound buffer data which you then send directly to SDL_mixer, get this libs from here http://www.xiph.org/downloads/ you need ogg and vorbis.
There are some good tutorials (mostly targeted at OpenAL although the actual ogg loading part would be the same regardless) around and if you want I can paste some code i've written that streams ogg's using OpenAL if you think that would be useful.
I would also think about switching from SDL_mixer to OpenAL, it gives you full 3D sound 'for free' and is a lot better in terms of sound quality and API usability.
There are some good tutorials (mostly targeted at OpenAL although the actual ogg loading part would be the same regardless) around and if you want I can paste some code i've written that streams ogg's using OpenAL if you think that would be useful.
I would also think about switching from SDL_mixer to OpenAL, it gives you full 3D sound 'for free' and is a lot better in terms of sound quality and API usability.
Sir, e^iπ + 1 = 0, hence God exists; reply!
I can play an ogg vorbis file as a sound effect. Calling Mix_LoadWav() is all you should have to do. Email me, and I can send you my code that plays an ogg vorbis sound effect.
Ok, it must be the file that I have (a music ogg file). Your code works for me, Mark, but when I plug my filename into your application I get the same error of "Unrecognized sound file type." It is interesting to me that I can load it as music but not as a sound chunk. Is there a reason for this?
Oh, and I do want to at least try OpenAL in the long term but this project is pretty simple and is more about my getting comfortable with the release side of development on the Mac. Thank you for the information though, either way I will be integrating that into my work.
Oh, and I do want to at least try OpenAL in the long term but this project is pretty simple and is more about my getting comfortable with the release side of development on the Mac. Thank you for the information though, either way I will be integrating that into my work.
Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
Music Composition, Sound Design and Implementation for your games | MyMiniGemini | 0 | 2,840 |
Oct 21, 2014 03:13 PM Last Post: MyMiniGemini |
|
Background music and Sound FX on the Mac | ipeku | 9 | 14,530 |
Sep 26, 2011 06:50 AM Last Post: ipeku |
|
LoFi/8-bit Sound and Music | metacollin | 11 | 11,308 |
May 20, 2009 10:52 AM Last Post: Gamecues |
|
SDl_mixer and image | bronxbomber92 | 3 | 5,032 |
Dec 15, 2006 12:27 PM Last Post: bronxbomber92 |
|
Installing SDL_image & SDL_mixer | bronxbomber92 | 8 | 9,263 |
Oct 14, 2006 09:39 PM Last Post: szymczyk |