Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


How to play sound Using DirectSound ??

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

I know how to initialise it : DirectSoundCreate(NULL,&soundDevice,NULL); soundDevice->SetCooperativeLevel( hWnd, DSSCL_PRIORITY); ZeroMemory(&bufferDesc,sizeof(bufferDesc)); bufferDesc.dwSize = sizeof(bufferDesc); bufferDesc.dwFlags = DSBCAPS_PRIMARYBUFFER; bufferDesc.dwBufferBytes = 0; bufferDesc.lpwfxFormat = NULL; soundDevice->CreateSoundBuffer(&bufferDesc, &primarySoundBuffer, NULL); WAVEFORMATEX format; ZeroMemory(&format,sizeof(format)); // request a 16-bit stereo primary sound buffer with 22 KHz sampling rate format.wFormatTag = WAVE_FORMAT_PCM; format.nChannels = 2; format.nSamplesPerSec = 22050; format.wBitsPerSample = 16; format.nBlockAlign = (format.wBitsPerSample / 8) * format.nChannels; format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign; primarySoundBuffer->SetFormat( &format ); soundDevice->SetSpeakerConfig(DSSPEAKER_STEREO); But now I want to load a .wav file and play using DirectSound and allow me to play with Pan and Vol. But I can''t find any tutorial on it. Thank for help

Share this post

Link to post
Share on other sites

  • 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!