Sign in to follow this  
Aguia

XAudio2 Loop wav file?

Recommended Posts

Aguia    123
how to loop in my wav file regarding the code below, only this step I need the wav file to be playing infinite


[color=#000080] //load a wave file
if( !buffer.load( "Audio\\mus0.wav" ) )
{
g_engine->Release();
CoUninitialize();
return -3;
}


//create the source voice, based on loaded wave format
if( FAILED( g_engine->CreateSourceVoice( &g_source, buffer.wf(),1 ) ) )
{
g_engine->Release();
CoUninitialize();
return -4;
}


//start consuming audio in the source voice
g_source->Start(1,0);

//play the sound
g_source->SubmitSourceBuffer( buffer.xaBuffer() );[/color]

Share this post


Link to post
Share on other sites
Ashaman73    13715
You need to adjust the buffer and set the loop data, more informations about looping buffers: [url="http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.xaudio2.xaudio2_buffer%28v=vs.85%29.aspx"]clicky[/url]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this