diff options
| author | Girish Pattabiraman <[email protected]> | 2017-02-16 15:00:10 -0800 |
|---|---|---|
| committer | Girish Pattabiraman <[email protected]> | 2017-02-16 15:00:10 -0800 |
| commit | ab9a793f9b908506d38964ce433c23ccde922a16 (patch) | |
| tree | 937131e3461195acbdc889472b22048406584e4f | |
| parent | a982f7e243ac4cb584e7fa89265dc6ccd4404880 (diff) | |
Resolve SAL issues for floating point hardware state.
Comment explaining warning 6386
| -rw-r--r-- | audio/sysvad/EndpointsCommon/micarraytopo.cpp | 21 | ||||
| -rw-r--r-- | audio/sysvad/SwapAPO/APO/swapapomfx.cpp | 1 |
2 files changed, 18 insertions, 4 deletions
diff --git a/audio/sysvad/EndpointsCommon/micarraytopo.cpp b/audio/sysvad/EndpointsCommon/micarraytopo.cpp index 3316ee84..a8125a08 100644 --- a/audio/sysvad/EndpointsCommon/micarraytopo.cpp +++ b/audio/sysvad/EndpointsCommon/micarraytopo.cpp @@ -535,6 +535,8 @@ NT status code. NTSTATUS ntStatus = STATUS_INVALID_DEVICE_REQUEST; ULONG nPinId = (ULONG)-1; + KFLOATING_SAVE saveData; + NTSTATUS fstatus; if (PropertyRequest->InstanceSize >= sizeof(ULONG)) { @@ -569,16 +571,27 @@ NT status code. if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_MIC_SENSITIVITY) { LONG* micSensitivity = (LONG*)PropertyRequest->Value; - // Return microphone sensitivity information. - *micSensitivity = FloatToFixedPoint16_16(MICARRAY_SENSITIVITY); // convert float dBFS to fixed point arithmetic + + fstatus = KeSaveFloatingPointState(&saveData); + if (NT_SUCCESS(fstatus)) + { + // Return microphone sensitivity information. + *micSensitivity = FloatToFixedPoint16_16(MICARRAY_SENSITIVITY); // convert float dBFS to fixed point arithmetic + KeRestoreFloatingPointState(&saveData); + } PropertyRequest->ValueSize = sizeof(LONG); ntStatus = STATUS_SUCCESS; } else if (PropertyRequest->PropertyItem->Id == KSPROPERTY_AUDIO_MIC_SNR) { LONG* micSNR = (LONG*)PropertyRequest->Value; - // Return microphone SNR information. - *micSNR = FloatToFixedPoint16_16(MICARRAY_SNR); // convert float dB to fixed point arithmetic + fstatus = KeSaveFloatingPointState(&saveData); + if (NT_SUCCESS(fstatus)) + { + // Return microphone SNR information. + *micSNR = FloatToFixedPoint16_16(MICARRAY_SNR); // convert float dB to fixed point arithmetic + KeRestoreFloatingPointState(&saveData); + } ntStatus = STATUS_SUCCESS; } } diff --git a/audio/sysvad/SwapAPO/APO/swapapomfx.cpp b/audio/sysvad/SwapAPO/APO/swapapomfx.cpp index 99677425..43cd78fb 100644 --- a/audio/sysvad/SwapAPO/APO/swapapomfx.cpp +++ b/audio/sysvad/SwapAPO/APO/swapapomfx.cpp @@ -881,6 +881,7 @@ HRESULT CSwapAPOMFX::ValidateAndCacheConnectionInfo(UINT32 u32NumInputConnection f32InverseChannelCount = 1.0f/m_u32SamplesPerFrame; for (UINT16 u16Index=0; u16Index<m_u32SamplesPerFrame; u16Index++) { + // m_u32SamplesPerFrame will not be modified by any other entity or context #pragma warning(suppress:6386) m_pf32Coefficients[u16Index] = 1.0f - (FLOAT32)(f32InverseChannelCount)*u16Index; } |
