home | login | register | DMCA | contacts | help | donate |      

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z


my bookshelf | genres | recommend | rating of books | rating of authors | reviews | new | | collections | | | add
fantasy
space fantasy
fantasy is horrors
heroic
prose
  military
  child
  russian
detective
  action
  child
  ironical
  historical
  political
western
adventure
adventure (child)
child's stories
love
religion
antique
Scientific literature
biography
business
home pets
animals
art
history
computers
linguistics
mathematics
religion
home_garden
sport
technique
publicism
philosophy
chemistry
close

Loading...









Cleaning up

In the CSound destructor we simply stop the sound from playing and release the objects. In CGame there is a new function called CleanUpDirectAudio which is shown below:

void CGame::CleanUpDirectAudio() {

//Stop all sounds.

m_pDirectAudioPerformance->Stop(NULL, NULL, 0, 0);

//CleanUp

m_pDirectAudioPerformance->CloseDown();

SafeRelease(m_pDirectAudioLoader);

SafeRelease(m_pDirectAudioPerformance);

LogInfo("

  • CleanUpDirectAudio finished.");

    }

    Here we first stop all sounds from playing (just in case), then we close down the performance object before releasing it and the loader object. Also, in the CGame deconstructor we need to call CoUninitialize to close down the COM library (shown below).

    CoUninitialize();

    So now we can play music and sounds in our applications. When the application starts, the background mp3 file plays. Move the mouse and click on a number to hear a different "sound effect". The background mp3 track is just a short loop so that I could keep the download size low, you can replace this with a larger track if you wish.

    DirectX 8 Programming Tutorial


  • A new class CSound | DirectX 8 Programming Tutorial | Summary







    Loading...