Jump to content
  • Advertisement
Sign in to follow this  
VanillaSnake21

XAudio2 fails, please help!

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

Hi, I ran into a very frustrating error recently. My app crashes right after I make a call to "CreateSourceVoice(...)". This is some of my code:

	m_WaveFormFormat.wFormatTag = m_Wave->GetFormatTag(); 
	m_WaveFormFormat.nChannels = m_Wave->GetChannels();
	m_WaveFormFormat.nSamplesPerSec = m_Wave->GetSampleRate();
	m_WaveFormFormat.nAvgBytesPerSec = m_Wave->GetBytesPerSec();
	m_WaveFormFormat.nBlockAlign = m_Wave->GetBlockAlign();
	m_WaveFormFormat.wBitsPerSample = m_Wave->GetBitsPerSapmple();
	m_WaveFormFormat.cbSize = 0; 
	
	HRESULT hr;
	if(FAILED(hr = m_IXAudio2->CreateSourceVoice(&m_SourceSound, &m_WaveFormFormat)))
	{
		switch(hr)
		{
		case XAUDIO2_E_INVALID_CALL: MessageBox(NULL, "1", 0, 0); break;
		case XAUDIO2_E_XMA_DECODER_ERROR: MessageBox(NULL, "2", 0, 0); break;
		case XAUDIO2_E_XAPO_CREATION_FAILED: MessageBox(NULL, "3", 0, 0); break;
		case XAUDIO2_E_DEVICE_INVALIDATED: MessageBox(NULL, "4", 0, 0); break;
		case S_OK: MessageBox(NULL, "6", 0, 0); break;
		default: MessageBox(NULL, "5", 0, 0);
		}
			DWORD Error = GetLastError();
		delete pbWaveData;
		pbWaveData = NULL;
		return 0;
	}

The weird thing is, is that the HRESULT comes back with something like -20600000 and I have no idea what's causing it. Please help, I tried everything but nothing works [sad]

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!