[Openal] Everything is ok but .wav file wont play.

Margin Marh marginproduction at gmail.com
Mon Mar 16 16:42:46 PDT 2009


I am using OpenAl with the help of Alure...
I made my own test program from the Alure play sample that is supposed to
play a .wav file but when i built it, it seems to build successfully but
when i debug it there is no sound coming out of my speakers.
I kept trying to find my error but i did not find any reason the file isn't
playing.
Here is the code of my sample test program :

> #include <stdio.h>
> #include <al.h>
> #include <alc.h>
> #include <AL/alure.h>
>
>
> #include <iostream>
> using namespace std;
>
> int main()
> {
>     ALCcontext *Context;
>     ALCdevice *Device;
>
>     ALuint src, buf;
>     ALint state;
>
>         Device = alcOpenDevice(NULL);
>         if (Device)
>         {
>         Context=alcCreateContext(Device,NULL);
>         alcMakeContextCurrent(Context);
>         }
>
>         if(!Device)
>         {
>             cout<<"error!"<<endl;
>             alcCloseDevice(Device);
>             return 0;
>         }
>             alGetError();
>             alGenSources(1, &src);
>             buf = alureCreateBufferFromFile("test.wav");
>
>             alSourcei(src, AL_BUFFER, buf);
>             alSourcePlay(src);
>
>             do {
>         alureSleep(0.001);
>         alGetSourcei(src, AL_SOURCE_STATE, &state);
>     } while(alGetError() == AL_NO_ERROR && state == AL_PLAYING);
>
>     alDeleteSources(1, &src);
>     alDeleteBuffers(1, &buf);
>
>     alureShutdownDevice();
>     return 0;
> }




Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://opensource.creative.com/pipermail/openal/attachments/20090316/8c5370d5/attachment.html


More information about the Openal mailing list