Skip to main content
GameDev.net gamedev.net
🔒 Locked

CSound: Reset, Play, Repeat.

Started by Petar Titelski Mar 29, 2006 at 4:37 AM 2 replies 950+ views
Original Post
Petar Titelski
Petar Titelski
When I play sound in game many times, it mutes after a while. (for example, program plays sound repeatedly while enter is pressed) Anyone has any ideas?

//Global
CSoundManager*	g_pSoundManager1 = NULL;
CSound*		g_Sound1 = NULL;

//Initialize
g_pSoundManager1 = new CSoundManager();
g_pSoundManager1->Initialize( DXUTGetHWND(), DSSCL_PRIORITY );
g_pSoundManager1->SetPrimaryBufferFormat( 2, 22050, 16 );
LPWSTR soundFileName = L"Media\\Sounds\\gun1.wav";
g_pSoundManager1->Create( &g_Sound1, soundFileName, 0, GUID_NULL );


// Game Loop
g_Sound1->Reset();
g_Sound1->Play();


(if FAILED(hr) initialization checks are removed for simplicity) [Edited by - Petar Titelski on March 29, 2006 5:03:09 AM]
Adriano
Adriano
What is the scope of g_Soundl? Does it stop because it is deallocated? Just guessing..
Petar Titelski
Petar Titelski
Nope, debugging says that everything is ok with CSound, and Play and Reset function return HR_OK ...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.