Here's the code:
/* initialize random seed: */
srand ( time(NULL) );
ALCdevice* Device;
ALCcontext* Context;
ALsizei taille = 260000; // The size of my buffer
ALuint * MesTampons; // My AL buffer pointers
ALuint * LaSource; // My AL source pointer
MesTampons = new ALuint[2];
LaSource = new ALuint[1];
ALvoid * PTampon1; // My Buffer
short * Tampon1;
Tampon1 = (short*)PTampon1;
Tampon1 = new short [taille];
alGenBuffers(2,MesTampons);
// I generate pseudo white noise for testing purpose
double AleatD;
ALuint Aleat;
for(int i = 0; i < taille; i++)
{
AleatD = rand() * pow(2,16);
Aleat = (ALuint)AleatD;
Tampon1[i] = Aleat;
}
// Open the default device
Device = alcOpenDevice(NULL); // select the "preferred device"
if (Device)
{
Context=alcCreateContext(Device,NULL);
alcMakeContextCurrent(Context);
}
std::cout << "Buffers ... " << std::endl;
alBufferData(MesTampons[0], AL_FORMAT_STEREO16, PTampon1, taille, 44100); // Hangs here when size > ~ 250'000
alGenSources(1,LaSource);
alSourcei(LaSource[0], AL_BUFFER, MesTampons[0]);
alSourcePlay(LaSource[0]);
std::cout << "Playing ... " << std::endl;
// Verifying status
ALint * Etat;
Etat = new ALint;
alGetSourcei(LaSource[0], AL_SOURCE_STATE, Etat);
// Run until sound stops
while (*Etat != AL_STOPPED)
{
alGetSourcei(LaSource[0], AL_SOURCE_STATE, Etat);
}
alcDestroyContext(Context);
alcCloseDevice(Device);
_______________________________________________
Openal mailing list
Openal@...
http://opensource.creative.com/mailman/listinfo/openal