internal void InitRun(AudioBase audioDevice, int defaultRate, Prompt prompt) { _audio = audioDevice; _prompt = prompt; _defaultRate = defaultRate; _actions = (SPVESACTIONS.SPVES_RATE | SPVESACTIONS.SPVES_VOLUME); }
public Stream LoadResource(Uri uri, string mediaType) { try { string mimeType; Uri baseUri; string localPath; using (Stream stream = _resourceLoader.LoadFile(uri, out mimeType, out baseUri, out localPath)) { int num = (int)stream.Length; MemoryStream memoryStream = new MemoryStream(num); byte[] array = new byte[num]; stream.Read(array, 0, array.Length); _resourceLoader.UnloadFile(localPath); memoryStream.Write(array, 0, num); memoryStream.Position = 0L; return(memoryStream); } } catch (Exception exception) { Exception ex = _exception = exception; _actions |= SPVESACTIONS.SPVES_ABORT; } return(null); }
public void AddEvents([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] SpeechEventInfo[] events, int ulCount) { try { for (int i = 0; i < events.Length; i++) { SpeechEventInfo sapiEvent = events[i]; int num = 1 << (int)sapiEvent.EventId; if (sapiEvent.EventId == 2 && _eventMapper != null) { _eventMapper.FlushEvent(); } if ((num & _eventInterest) != 0) { TTSEvent evt = CreateTtsEvent(sapiEvent); if (_eventMapper == null) { AddEvent(evt); } else { _eventMapper.AddEvent(evt); } } } } catch (Exception exception) { Exception ex = _exception = exception; _actions |= SPVESACTIONS.SPVES_ABORT; } }
public int Write(IntPtr pBuff, int cb) { try { _audio.Play(pBuff, cb); return(cb); } catch (Exception exception) { Exception ex = _exception = exception; _actions |= SPVESACTIONS.SPVES_ABORT; return(cb); } }
internal void Abort() { _actions = SPVESACTIONS.SPVES_ABORT; }