次のように system.speech.synthesis を使用する場合:
using (_speech)
{
_speech.SelectVoice("Anne");
_speech.SpeakCompleted += OnSpeakCompleted;
_speech.Rate = Convert.ToInt32(Rate);
_speech.Volume = Convert.ToInt32(Volume);
_speech.SpeakAsync(text);
}
次のエラーが表示されます。
System.AccessViolationException was unhandled
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=System.Speech
StackTrace:
at System.Speech.Internal.ObjectTokens.ObjectToken.ISpObjectWithToken.SetObjectToken(ISpObjectToken pToken)
at System.Speech.Internal.ObjectTokens.ObjectToken.CreateObjectFromToken[T](String name)
at System.Speech.Internal.Synthesis.VoiceSynthesis.GetComEngine(VoiceInfo voiceInfo)
at System.Speech.Internal.Synthesis.VoiceSynthesis.GetProxyEngine(VoiceInfo voiceInfo)
at System.Speech.Internal.Synthesis.VoiceSynthesis.ThreadProc()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
音声合成装置のオブジェクト作成時は発生しませんが、使用時に発生します。Fx。速度、音量などを変更します。
この種の問題の解決策はありますか?解決?ヒント?この厄介な問題を解決するのに役立つものはありますか?