Re: sound corrupted on playing with openal

Chris Robinson <[email protected]>
Newsgroups gmane.comp.lib.openal
Message-ID <[email protected]>
On Wednesday 14 April 2010 11:19:48 am vinit agrawal wrote:
> Hi all,
> 
> I am new to openal and just setting things up , i found this on  first few
> search
> hits.
> http://www.kcat.strangesoft.net/openal-tutorial.html
> 
> It is basically using the mplayer encoder to decode audio files like mp3 ,
> and then putting the stream on the buffer through OpenAL, the code is
> compiling fine
> but when i run it to play some mp3 file its sounds noisy like the file is
> corrupted but files is all good. i can hear that it is able to open the
> file i give it, but it is very noisy, i am not sure of the reason. please
> suggest something , you can compile this code and see if it works on your
> machine.

Hi.

The code works fine for me (just re-tested it). That said, it is a bit of a 
messy hack; I wrote it as more of a proof-of-concept piece when there wasn't a 
simple all-in-one decoder that could handle many common formats (libsndfile 
comes close, but that neglects MP3 and some others for legal reasons).

One big issue with that is it doesn't properly byte-swap samples if you're not 
on a little-endian machine, which could account for it being just noise, and 
the execlp call isn't fully correct (the "-nogui" argument occupies argv[0], 
so that should be

execlp("mplayer", "mplayer", "-nogui", ...

yes, "mplayer" is listed twice). I should probably take that down and replace 
it with something using libsndfile instead. I should probably also take down 
the alFFmpeg code since ffmpeg is not all that stable, API wise.
_______________________________________________
Openal mailing list
[email protected]
http://opensource.creative.com/mailman/listinfo/openal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.