Sign in to follow this  
Aguia

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

Recommended Posts

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
If you want to use return code, you should define an enumeration rather than returning values directly.

[code]
// Set the sound to loop over it's entirety.
buffer.xaBuffer().LoopBegin = 0;
buffer.xaBuffer().LoopLength = 0;
buffer.xaBuffer().LoopCount = XAUDIO2_LOOP_INFINITE;

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

Hope that helps.

[Edit] Please use code tags rather than coloured text, it's a nightmare to reply :) Edited by Telios

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