Sign in to follow this  

Reasons for CreateSubmixVoice failing?

This topic is 2336 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!

I'm working on a game, and one of the beta testers is having trouble getting the sound system to load. For him, it bombs out when the program tries to create a submix voice. I tried having him run the XAudio2Sound3D sample, but that bombs out for him too, which is alarming to me. The error code I'm getting is XAUDIO2_E_XAPO_CREATION_FAILED, and I'm trying to figure out why I'm getting it. I would think if there was a problem with his DirectX installation, a problem would surface earlier.

Anyway, here's the code:

[code]
ULONG ulFlags;
XAUDIO2FX_REVERB_PARAMETERS ReverbParameters;
FXECHO_PARAMETERS EchoParameters;
XAUDIO2_EFFECT_DESCRIPTOR SubmixEffects[2];
XAUDIO2_EFFECT_CHAIN SubmixEffectChain;

ulFlags = 0;
#ifdef _DEBUG
ulFlags |= XAUDIO2FX_DEBUG;
#endif

// Create our reverb effect.
if ( FAILED( XAudio2CreateReverb( &m_pReverbEffect, ulFlags )))
ERROR_FatalError( "%s: Failed to initalize reverb effect!", __FUNCTION__ );

// Create our echo effect.
if ( FAILED( CreateFX( __uuidof( FXEcho ), &m_pEchoEffect )))
ERROR_FatalError( "%s: Failed to initalize echo effect!", __FUNCTION__ );

// Set up the submix effect chain.
SubmixEffects[0].pEffect = m_pReverbEffect;
SubmixEffects[0].InitialState = true;
SubmixEffects[0].OutputChannels = 1;

SubmixEffects[1].pEffect = m_pEchoEffect;
SubmixEffects[1].InitialState = true;
SubmixEffects[1].OutputChannels = 1;

// The submix effect chain has two effects (reverb, echo).
SubmixEffectChain.EffectCount = 2;
SubmixEffectChain.pEffectDescriptors = SubmixEffects;

// Create our submix voice, and set its effect chain.
HRESULT hResult;
hResult = m_pXAudio2->CreateSubmixVoice( &m_pSubmixVoice, 1, m_DeviceDetails.OutputFormat.Format.nSamplesPerSec, 0, 0, NULL, &SubmixEffectChain );
if ( FAILED( hResult ))
{
switch ( hResult )
{
case XAUDIO2_E_INVALID_CALL:

ERROR_FatalError( "%s: Failed to initalize submix voice: XAUDIO2_E_INVALID_CALL!", __FUNCTION__ );
break;
case XAUDIO2_E_XMA_DECODER_ERROR:

ERROR_FatalError( "%s: Failed to initalize submix voice: XAUDIO2_E_XMA_DECODER_ERROR!", __FUNCTION__ );
break;
case XAUDIO2_E_XAPO_CREATION_FAILED:

ERROR_FatalError( "%s: Failed to initalize submix voice: XAUDIO2_E_XAPO_CREATION_FAILED!", __FUNCTION__ );
break;
case XAUDIO2_E_DEVICE_INVALIDATED:

ERROR_FatalError( "%s: Failed to initalize submix voice: XAUDIO2_E_DEVICE_INVALIDATED!", __FUNCTION__ );
break;
default:

ERROR_FatalError( "%s: Failed to initalize submix voice: Unknown error, %d!", __FUNCTION__, hResult );
break;
}
}
[/code]

Again, the error he's getting here is XAUDIO2_E_XAPO_CREATION_FAILED. None of the earlier XAudio2 initialization functions create an error.

Any help would be greatly appreciated. Thank you

Share this post


Link to post
Share on other sites
You should probably try to verify if it is the reverb or the echo (or both or neither) that is causing the error. If I understand correctly XAPOs (even the built in ones) use COM to do their business and the XAudio2CreateReverb page on msdn is pretty explicit about the need to call CoInitalizeEx before trying to do anything with the XAPOs. So that is at least place to start. You might also verify the COM related services on the problem box or try to make some non-Xaudio2 related COM calls. If the sample is crapping out that machine as well it does point towards a environment problem.

Share this post


Link to post
Share on other sites
Well, it's definitely the reverb effect that's doing it. The DirectX sample doesn't use echo (just reverb), and it still bombs out. If I disable both submix effects (reverb and echo), it works fine for him.

How would I verify whether or not this user's COM-related services are working?

Share this post


Link to post
Share on other sites
Well I am not really a COM expert or anything, but there is a COM+ Event service you can check. You might also try samples from some other COM centered library (like SAPI or OLEDB) to see if they work at all. You could try setting up a custom XAPO and see if it loads and if you get the callbacks you expect (just do a buffer copy in Process() and log a message or something). COM loading often relies on the registry, so if that is messed up it could cause this kind of problem (try re-installing the DirectX redist & make sure nobody is running a registry cleaner or something bad like that).

Share this post


Link to post
Share on other sites

This topic is 2336 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this