Got rid of the exception, now I'm trying to setup the basic XAudio2 3D Sound.
Tried the following code:
pXAudio2->GetDeviceDetails(0, &details);
X3DAudioInitialize(details.OutputFormat.dwChannelMask, X3DAUDIO_SPEED_OF_SOUND, X3DInstance);
emitter.Position = D3DXVECTOR3(5.0f, 2.0f, 0.0f);
X3DAUDIO_CONE emitterCone;
emitter.pCone = &(emitterCone);
emitter.pCone->InnerAngle = 0.0f;
// Setting the inner cone angles to X3DAUDIO_2PI and
// outer cone other than 0 causes
// the emitter to act like a point emitter using the
// INNER cone settings only.
emitter.pCone->OuterAngle = 0.0f;
// Setting the outer cone angles to zero causes
// the emitter to act like a point emitter using the
// OUTER cone settings only.
emitter.InnerRadius = 0.0f;
emitter.InnerRadiusAngle = 0.0f;
emitter.pCone->InnerVolume = 0.0f;
emitter.pCone->OuterVolume = 1.0f;
emitter.pCone->InnerLPF = 0.0f;
emitter.pCone->OuterLPF = 1.0f;
emitter.pCone->InnerReverb = 0.0f;
emitter.pCone->OuterReverb = 1.0f;
emitter.OrientFront = D3DXVECTOR3( 0, 0, 1 );
emitter.OrientTop = D3DXVECTOR3( 0, 1, 0 );
emitter.ChannelCount = 8;
emitter.ChannelRadius = 1.0f;
FLOAT32 emitterAzimuths[8];
emitter.pChannelAzimuths = emitterAzimuths;
// Use of Inner radius allows for smoother transitions as
// a sound travels directly through, above, or below the listener.
// It also may be used to give elevation cues.
emitter.InnerRadius = 2.0f;
emitter.InnerRadiusAngle = X3DAUDIO_PI/4.0f;
emitter.pVolumeCurve = NULL; //(X3DAUDIO_DISTANCE_CURVE*)&X3DAudioDefault_LinearCurve;
emitter.pLFECurve = NULL; //(X3DAUDIO_DISTANCE_CURVE*)&Emitter_LFE_Curve;
emitter.pLPFDirectCurve = NULL; // use default curve
emitter.pLPFReverbCurve = NULL; // use default curve
emitter.pReverbCurve = (X3DAUDIO_DISTANCE_CURVE*)&Emitter_Reverb_Curve;
listener.OrientFront = D3DXVECTOR3( 0, 0, 1 );
listener.OrientTop = D3DXVECTOR3( 0, 1, 0 );
listener.Position = D3DXVECTOR3(0, 0, 0);
listener.OrientFront = D3DXVECTOR3( 0, 0, 1 );
listener.OrientTop = D3DXVECTOR3( 0, 1, 0 );
listener.pCone = NULL; //(X3DAUDIO_CONE*)&Listener_DirectionalCone;
listener.Position = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
ZeroMemory(&dspSettings, sizeof(dspSettings));
dspSettings.SrcChannelCount = 1;
dspSettings.DstChannelCount = details.OutputFormat.Format.nChannels;
dspSettings.pMatrixCoefficients = matrixCoefficients;
DWORD dwCalcFlags = X3DAUDIO_CALCULATE_MATRIX | X3DAUDIO_CALCULATE_DOPPLER
| X3DAUDIO_CALCULATE_LPF_DIRECT | X3DAUDIO_CALCULATE_LPF_REVERB
| X3DAUDIO_CALCULATE_REVERB;
X3DAudioCalculate(X3DInstance, &listener, &emitter, dwCalcFlags, &dspSettings);
pSourceVoice->SetFrequencyRatio(dspSettings.DopplerFactor);
pSourceVoice->SetOutputMatrix(NULL, 1, details.OutputFormat.Format.nChannels, dspSettings.pMatrixCoefficients);
I'm trying to play the sound in (x = 5.0f, y = 2.0f, z = 0.0f) which is the emitter position
and the listener position is located in (x = 0.0f, y = 0.0f, z = 0.0f)
I can hear the sound but it's not like in 3D space, whats wrong?