Esempio n. 1
0
 private SpeechEvent(SPEVENTENUM eEventId, SPEVENTLPARAMTYPE elParamType, ulong ullAudioStreamOffset, IntPtr wParam, IntPtr lParam)
 {
     _eventId           = eEventId;
     _paramType         = elParamType;
     _audioStreamOffset = ullAudioStreamOffset;
     _wParam            = (ulong)wParam.ToInt64();
     _lParam            = (ulong)(long)lParam;
     if (_paramType == SPEVENTLPARAMTYPE.SPET_LPARAM_IS_POINTER || _paramType == SPEVENTLPARAMTYPE.SPET_LPARAM_IS_STRING)
     {
         GC.AddMemoryPressure(_sizeMemoryPressure = Marshal.SizeOf((object)_lParam));
     }
 }
Esempio n. 2
0
        private SpeechEvent(SPEVENTENUM eEventId, SPEVENTLPARAMTYPE elParamType,
                            ulong ullAudioStreamOffset, IntPtr wParam, IntPtr lParam)
        {
            // We make a copy of the SPEVENTEX data but that's okay because the lParam will only be deleted once.
            _eventId           = eEventId;
            _paramType         = elParamType;
            _audioStreamOffset = ullAudioStreamOffset;
            _wParam            = (ulong)wParam.ToInt64();
            _lParam            = (ulong)lParam;

            // Let the GC know if we have a unmanaged object with a given size
            if (_paramType == SPEVENTLPARAMTYPE.SPET_LPARAM_IS_POINTER || _paramType == SPEVENTLPARAMTYPE.SPET_LPARAM_IS_STRING)
            {
                GC.AddMemoryPressure(_sizeMemoryPressure = sizeof(ulong));
            }
        }