Jump to content
  • Advertisement
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

This topic is 2177 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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() );

Share this post


Link to post
Share on other sites
Advertisement
If you want to use return code, you should define an enumeration rather than returning values directly.


// 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() );


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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!