Jump to content
  • Advertisement
Sign in to follow this  
Sobero

About the scope of CSoundManager Object

This topic is 4857 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

Hello every one, I am writing a program using direct sound. I have some questions on the scope of the CSoundManager Object. I create the object in one function and call its Create() method in another function just like below codes: void Initialize() { ................. if (SUCCEEDED(snd_manager->Initialize(g_phWnd,DSSCL_PRIORITY))) cout << "Initialize Sound Manager!\n"; ..................... ................... } void Play() {....................... if (SUCCEEDED(snd_manager->Create(&snd,TEXT("c:\\ding.wav"),0,GUID_NULL,1))) cout << "Sound loaded!\n"; if (SUCCEEDED(snd->Play(0,0))) cout << "Sound played!\n"; .................................... ............................. } The CSoundManager and CSound variables are declared as global. But I found that after exit the Initialize() function and call the Play() function, the CSoundManager object becomes NULL. Why does it occur even if the CSoundManager object is declared as global variables? Thank you!!

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!