Jump to content
  • Advertisement
Sign in to follow this  
subtitle

DirectSound - Secondary Buffer SetFormat fails

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

SetFormat function call gives error code 0x88780032. It works just fine with Primary Buffer.

 

Before SetFormat() call debuging shows following values:

 

BufferDescription.dwSize = 40
BufferDescription.dwFlags = 0;
BufferDescription.dwBufferBytes = 192000

 

WaveFormat.wFormatTag = 1
WaveFormat.nChannels = 2
WaveFormat.nSamplesPerSec = 48000
WaveFormat.wBitsPerSample = 16
WaveFormat.nBlockAlign = 4
WaveFormat.nAvgBytesPerSec = 192000
WaveFormat.cbSize = 0;

 

This is from Handmade Hero series (Day 7).

WAVEFORMATEX WaveFormat = {};
WaveFormat.wFormatTag = WAVE_FORMAT_PCM;
WaveFormat.nChannels = 2;
WaveFormat.nSamplesPerSec = SamplesPerSecond;
WaveFormat.wBitsPerSample = 16;
WaveFormat.nBlockAlign = (WaveFormat.nChannels * WaveFormat.wBitsPerSample) / 8;
WaveFormat.nAvgBytesPerSec = WaveFormat.nBlockAlign * WaveFormat.nSamplesPerSec;
WaveFormat.cbSize = 0;

DSBUFFERDESC BufferDescription = {};
BufferDescription.dwSize = sizeof(BufferDescription);
BufferDescription.dwFlags = 0;
BufferDescription.dwBufferBytes = BufferSize;
BufferDescription.lpwfxFormat = &WaveFormat;

LPDIRECTSOUNDBUFFER SecondaryBuffer;
if (SUCCEEDED(DirectSound->CreateSoundBuffer(&BufferDescription, &SecondaryBuffer, 0)))
{
	HRESULT Error = SecondaryBuffer->SetFormat(&WaveFormat);
	if (SUCCEEDED(Error))
	{
		OutputDebugStringA("SecondaryBuffer is fine!\n");
	}

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!