fix: Fix TTS COM exception in IL2CPP
This commit is contained in:
805
Assets/Plugins/Windows/Interop.SpeechLib/_ISpeechVoiceEvents.cs
Normal file
805
Assets/Plugins/Windows/Interop.SpeechLib/_ISpeechVoiceEvents.cs
Normal file
@@ -0,0 +1,805 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Threading;
|
||||
|
||||
namespace SpeechLib {
|
||||
[ComVisible(false)]
|
||||
public delegate void _ISpeechVoiceEvents_StartStreamEventHandler([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition);
|
||||
|
||||
[ComVisible(false)]
|
||||
public delegate void _ISpeechVoiceEvents_EndStreamEventHandler([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition);
|
||||
|
||||
[ComVisible(false)]
|
||||
public delegate void _ISpeechVoiceEvents_VoiceChangeEventHandler([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In][MarshalAs(UnmanagedType.Interface)] SpObjectToken VoiceObjectToken);
|
||||
|
||||
[ComVisible(false)]
|
||||
public delegate void _ISpeechVoiceEvents_BookmarkEventHandler([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In][MarshalAs(UnmanagedType.BStr)] string Bookmark, [In] int BookmarkId);
|
||||
|
||||
[ComVisible(false)]
|
||||
public delegate void _ISpeechVoiceEvents_WordEventHandler([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In] int CharacterPosition, [In] int Length);
|
||||
|
||||
[ComVisible(false)]
|
||||
public delegate void _ISpeechVoiceEvents_SentenceEventHandler([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In] int CharacterPosition, [In] int Length);
|
||||
|
||||
[ComVisible(false)]
|
||||
public delegate void _ISpeechVoiceEvents_PhonemeEventHandler([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In] int Duration, [In] short NextPhoneId, [In] SpeechVisemeFeature Feature, [In] short CurrentPhoneId);
|
||||
|
||||
[ComVisible(false)]
|
||||
public delegate void _ISpeechVoiceEvents_VisemeEventHandler([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In] int Duration, [In] SpeechVisemeType NextVisemeId, [In] SpeechVisemeFeature Feature, [In] SpeechVisemeType CurrentVisemeId);
|
||||
|
||||
[ComVisible(false)]
|
||||
public delegate void _ISpeechVoiceEvents_AudioLevelEventHandler([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In] int AudioLevel);
|
||||
|
||||
[ComVisible(false)]
|
||||
public delegate void _ISpeechVoiceEvents_EnginePrivateEventHandler([In] int StreamNumber, [In] int StreamPosition, [In][MarshalAs(UnmanagedType.Struct)] object EngineData);
|
||||
|
||||
[ComImport]
|
||||
[InterfaceType(2)]
|
||||
[Guid("A372ACD1-3BEF-4BBD-8FFB-CB3E2B416AF8")]
|
||||
[TypeLibType(4096)]
|
||||
public interface _ISpeechVoiceEvents {
|
||||
[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[DispId(1)]
|
||||
void StartStream([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition);
|
||||
|
||||
[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[DispId(2)]
|
||||
void EndStream([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition);
|
||||
|
||||
[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[DispId(3)]
|
||||
void VoiceChange([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In][MarshalAs(UnmanagedType.Interface)] SpObjectToken VoiceObjectToken);
|
||||
|
||||
[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[DispId(4)]
|
||||
void Bookmark([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In][MarshalAs(UnmanagedType.BStr)] string Bookmark, [In] int BookmarkId);
|
||||
|
||||
[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[DispId(5)]
|
||||
void Word([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In] int CharacterPosition, [In] int Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[DispId(7)]
|
||||
void Sentence([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In] int CharacterPosition, [In] int Length);
|
||||
|
||||
[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[DispId(6)]
|
||||
void Phoneme([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In] int Duration, [In] short NextPhoneId, [In] SpeechVisemeFeature Feature, [In] short CurrentPhoneId);
|
||||
|
||||
[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[DispId(8)]
|
||||
void Viseme([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In] int Duration, [In] SpeechVisemeType NextVisemeId, [In] SpeechVisemeFeature Feature, [In] SpeechVisemeType CurrentVisemeId);
|
||||
|
||||
[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[DispId(9)]
|
||||
void AudioLevel([In] int StreamNumber, [In][MarshalAs(UnmanagedType.Struct)] object StreamPosition, [In] int AudioLevel);
|
||||
|
||||
[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
|
||||
[DispId(10)]
|
||||
void EnginePrivate([In] int StreamNumber, [In] int StreamPosition, [In][MarshalAs(UnmanagedType.Struct)] object EngineData);
|
||||
}
|
||||
|
||||
[ComEventInterface(typeof(_ISpeechVoiceEvents), typeof(_ISpeechVoiceEvents_EventProvider))]
|
||||
[TypeLibType(16)]
|
||||
[ComVisible(false)]
|
||||
public interface _ISpeechVoiceEvents_Event {
|
||||
event _ISpeechVoiceEvents_StartStreamEventHandler StartStream;
|
||||
|
||||
event _ISpeechVoiceEvents_EndStreamEventHandler EndStream;
|
||||
|
||||
event _ISpeechVoiceEvents_VoiceChangeEventHandler VoiceChange;
|
||||
|
||||
event _ISpeechVoiceEvents_BookmarkEventHandler Bookmark;
|
||||
|
||||
event _ISpeechVoiceEvents_WordEventHandler Word;
|
||||
|
||||
event _ISpeechVoiceEvents_SentenceEventHandler Sentence;
|
||||
|
||||
event _ISpeechVoiceEvents_PhonemeEventHandler Phoneme;
|
||||
|
||||
event _ISpeechVoiceEvents_VisemeEventHandler Viseme;
|
||||
|
||||
event _ISpeechVoiceEvents_AudioLevelEventHandler AudioLevel;
|
||||
|
||||
event _ISpeechVoiceEvents_EnginePrivateEventHandler EnginePrivate;
|
||||
}
|
||||
|
||||
internal sealed class _ISpeechVoiceEvents_EventProvider : _ISpeechVoiceEvents_Event, IDisposable {
|
||||
private readonly IConnectionPointContainer m_ConnectionPointContainer;
|
||||
|
||||
private ArrayList m_aEventSinkHelpers;
|
||||
|
||||
private IConnectionPoint m_ConnectionPoint;
|
||||
|
||||
private void Init() {
|
||||
Guid riid = new(new byte[16]
|
||||
{
|
||||
209, 172, 114, 163, 239, 59, 189, 75, 143, 251,
|
||||
203, 62, 43, 65, 106, 248
|
||||
});
|
||||
m_ConnectionPointContainer.FindConnectionPoint(ref riid, out IConnectionPoint ppCP);
|
||||
m_ConnectionPoint = ppCP;
|
||||
m_aEventSinkHelpers = new ArrayList();
|
||||
}
|
||||
|
||||
public event _ISpeechVoiceEvents_StartStreamEventHandler StartStream {
|
||||
add {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
Init();
|
||||
}
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = new();
|
||||
m_ConnectionPoint.Advise(iSpeechVoiceEvents_SinkHelper, out int pdwCookie);
|
||||
iSpeechVoiceEvents_SinkHelper.m_dwCookie = pdwCookie;
|
||||
iSpeechVoiceEvents_SinkHelper.m_StartStreamDelegate = value;
|
||||
m_aEventSinkHelpers.Add(iSpeechVoiceEvents_SinkHelper);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_aEventSinkHelpers == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 >= count) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
if (iSpeechVoiceEvents_SinkHelper.m_StartStreamDelegate != null && ((iSpeechVoiceEvents_SinkHelper.m_StartStreamDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0) {
|
||||
m_aEventSinkHelpers.RemoveAt(num);
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
if (count <= 1) {
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
m_ConnectionPoint = null;
|
||||
m_aEventSinkHelpers = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event _ISpeechVoiceEvents_EndStreamEventHandler EndStream {
|
||||
add {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
Init();
|
||||
}
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = new();
|
||||
m_ConnectionPoint.Advise(iSpeechVoiceEvents_SinkHelper, out int pdwCookie);
|
||||
iSpeechVoiceEvents_SinkHelper.m_dwCookie = pdwCookie;
|
||||
iSpeechVoiceEvents_SinkHelper.m_EndStreamDelegate = value;
|
||||
m_aEventSinkHelpers.Add(iSpeechVoiceEvents_SinkHelper);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_aEventSinkHelpers == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 >= count) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
if (iSpeechVoiceEvents_SinkHelper.m_EndStreamDelegate != null && ((iSpeechVoiceEvents_SinkHelper.m_EndStreamDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0) {
|
||||
m_aEventSinkHelpers.RemoveAt(num);
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
if (count <= 1) {
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
m_ConnectionPoint = null;
|
||||
m_aEventSinkHelpers = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event _ISpeechVoiceEvents_VoiceChangeEventHandler VoiceChange {
|
||||
add {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
Init();
|
||||
}
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = new();
|
||||
m_ConnectionPoint.Advise(iSpeechVoiceEvents_SinkHelper, out int pdwCookie);
|
||||
iSpeechVoiceEvents_SinkHelper.m_dwCookie = pdwCookie;
|
||||
iSpeechVoiceEvents_SinkHelper.m_VoiceChangeDelegate = value;
|
||||
m_aEventSinkHelpers.Add(iSpeechVoiceEvents_SinkHelper);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_aEventSinkHelpers == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 >= count) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
if (iSpeechVoiceEvents_SinkHelper.m_VoiceChangeDelegate != null && ((iSpeechVoiceEvents_SinkHelper.m_VoiceChangeDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0) {
|
||||
m_aEventSinkHelpers.RemoveAt(num);
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
if (count <= 1) {
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
m_ConnectionPoint = null;
|
||||
m_aEventSinkHelpers = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event _ISpeechVoiceEvents_BookmarkEventHandler Bookmark {
|
||||
add {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
Init();
|
||||
}
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = new();
|
||||
m_ConnectionPoint.Advise(iSpeechVoiceEvents_SinkHelper, out int pdwCookie);
|
||||
iSpeechVoiceEvents_SinkHelper.m_dwCookie = pdwCookie;
|
||||
iSpeechVoiceEvents_SinkHelper.m_BookmarkDelegate = value;
|
||||
m_aEventSinkHelpers.Add(iSpeechVoiceEvents_SinkHelper);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_aEventSinkHelpers == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 >= count) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
if (iSpeechVoiceEvents_SinkHelper.m_BookmarkDelegate != null && ((iSpeechVoiceEvents_SinkHelper.m_BookmarkDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0) {
|
||||
m_aEventSinkHelpers.RemoveAt(num);
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
if (count <= 1) {
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
m_ConnectionPoint = null;
|
||||
m_aEventSinkHelpers = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event _ISpeechVoiceEvents_WordEventHandler Word {
|
||||
add {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
Init();
|
||||
}
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = new();
|
||||
m_ConnectionPoint.Advise(iSpeechVoiceEvents_SinkHelper, out int pdwCookie);
|
||||
iSpeechVoiceEvents_SinkHelper.m_dwCookie = pdwCookie;
|
||||
iSpeechVoiceEvents_SinkHelper.m_WordDelegate = value;
|
||||
m_aEventSinkHelpers.Add(iSpeechVoiceEvents_SinkHelper);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_aEventSinkHelpers == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 >= count) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
if (iSpeechVoiceEvents_SinkHelper.m_WordDelegate != null && ((iSpeechVoiceEvents_SinkHelper.m_WordDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0) {
|
||||
m_aEventSinkHelpers.RemoveAt(num);
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
if (count <= 1) {
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
m_ConnectionPoint = null;
|
||||
m_aEventSinkHelpers = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event _ISpeechVoiceEvents_SentenceEventHandler Sentence {
|
||||
add {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
Init();
|
||||
}
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = new();
|
||||
m_ConnectionPoint.Advise(iSpeechVoiceEvents_SinkHelper, out int pdwCookie);
|
||||
iSpeechVoiceEvents_SinkHelper.m_dwCookie = pdwCookie;
|
||||
iSpeechVoiceEvents_SinkHelper.m_SentenceDelegate = value;
|
||||
m_aEventSinkHelpers.Add(iSpeechVoiceEvents_SinkHelper);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_aEventSinkHelpers == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 >= count) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
if (iSpeechVoiceEvents_SinkHelper.m_SentenceDelegate != null && ((iSpeechVoiceEvents_SinkHelper.m_SentenceDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0) {
|
||||
m_aEventSinkHelpers.RemoveAt(num);
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
if (count <= 1) {
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
m_ConnectionPoint = null;
|
||||
m_aEventSinkHelpers = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event _ISpeechVoiceEvents_PhonemeEventHandler Phoneme {
|
||||
add {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
Init();
|
||||
}
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = new();
|
||||
m_ConnectionPoint.Advise(iSpeechVoiceEvents_SinkHelper, out int pdwCookie);
|
||||
iSpeechVoiceEvents_SinkHelper.m_dwCookie = pdwCookie;
|
||||
iSpeechVoiceEvents_SinkHelper.m_PhonemeDelegate = value;
|
||||
m_aEventSinkHelpers.Add(iSpeechVoiceEvents_SinkHelper);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_aEventSinkHelpers == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 >= count) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
if (iSpeechVoiceEvents_SinkHelper.m_PhonemeDelegate != null && ((iSpeechVoiceEvents_SinkHelper.m_PhonemeDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0) {
|
||||
m_aEventSinkHelpers.RemoveAt(num);
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
if (count <= 1) {
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
m_ConnectionPoint = null;
|
||||
m_aEventSinkHelpers = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event _ISpeechVoiceEvents_VisemeEventHandler Viseme {
|
||||
add {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
Init();
|
||||
}
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = new();
|
||||
m_ConnectionPoint.Advise(iSpeechVoiceEvents_SinkHelper, out int pdwCookie);
|
||||
iSpeechVoiceEvents_SinkHelper.m_dwCookie = pdwCookie;
|
||||
iSpeechVoiceEvents_SinkHelper.m_VisemeDelegate = value;
|
||||
m_aEventSinkHelpers.Add(iSpeechVoiceEvents_SinkHelper);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_aEventSinkHelpers == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 >= count) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
if (iSpeechVoiceEvents_SinkHelper.m_VisemeDelegate != null && ((iSpeechVoiceEvents_SinkHelper.m_VisemeDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0) {
|
||||
m_aEventSinkHelpers.RemoveAt(num);
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
if (count <= 1) {
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
m_ConnectionPoint = null;
|
||||
m_aEventSinkHelpers = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event _ISpeechVoiceEvents_AudioLevelEventHandler AudioLevel {
|
||||
add {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
Init();
|
||||
}
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = new();
|
||||
m_ConnectionPoint.Advise(iSpeechVoiceEvents_SinkHelper, out int pdwCookie);
|
||||
iSpeechVoiceEvents_SinkHelper.m_dwCookie = pdwCookie;
|
||||
iSpeechVoiceEvents_SinkHelper.m_AudioLevelDelegate = value;
|
||||
m_aEventSinkHelpers.Add(iSpeechVoiceEvents_SinkHelper);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_aEventSinkHelpers == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 >= count) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
if (iSpeechVoiceEvents_SinkHelper.m_AudioLevelDelegate != null && ((iSpeechVoiceEvents_SinkHelper.m_AudioLevelDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0) {
|
||||
m_aEventSinkHelpers.RemoveAt(num);
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
if (count <= 1) {
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
m_ConnectionPoint = null;
|
||||
m_aEventSinkHelpers = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event _ISpeechVoiceEvents_EnginePrivateEventHandler EnginePrivate {
|
||||
add {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
Init();
|
||||
}
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = new();
|
||||
m_ConnectionPoint.Advise(iSpeechVoiceEvents_SinkHelper, out int pdwCookie);
|
||||
iSpeechVoiceEvents_SinkHelper.m_dwCookie = pdwCookie;
|
||||
iSpeechVoiceEvents_SinkHelper.m_EnginePrivateDelegate = value;
|
||||
m_aEventSinkHelpers.Add(iSpeechVoiceEvents_SinkHelper);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
remove {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_aEventSinkHelpers == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 >= count) {
|
||||
return;
|
||||
}
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
if (iSpeechVoiceEvents_SinkHelper.m_EnginePrivateDelegate != null && ((iSpeechVoiceEvents_SinkHelper.m_EnginePrivateDelegate.Equals(value) ? 1u : 0u) & 0xFFu) != 0) {
|
||||
m_aEventSinkHelpers.RemoveAt(num);
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
if (count <= 1) {
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
m_ConnectionPoint = null;
|
||||
m_aEventSinkHelpers = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public _ISpeechVoiceEvents_EventProvider(object P_0) {
|
||||
m_ConnectionPointContainer = (IConnectionPointContainer)P_0;
|
||||
}
|
||||
|
||||
public void Finalize() {
|
||||
bool lockTaken = default;
|
||||
try {
|
||||
Monitor.Enter(this, ref lockTaken);
|
||||
if (m_ConnectionPoint == null) {
|
||||
return;
|
||||
}
|
||||
int count = m_aEventSinkHelpers.Count;
|
||||
int num = 0;
|
||||
if (0 < count) {
|
||||
do {
|
||||
_ISpeechVoiceEvents_SinkHelper iSpeechVoiceEvents_SinkHelper = (_ISpeechVoiceEvents_SinkHelper)m_aEventSinkHelpers[num];
|
||||
m_ConnectionPoint.Unadvise(iSpeechVoiceEvents_SinkHelper.m_dwCookie);
|
||||
num++;
|
||||
}
|
||||
while (num < count);
|
||||
}
|
||||
Marshal.ReleaseComObject(m_ConnectionPoint);
|
||||
}
|
||||
catch (Exception) {
|
||||
}
|
||||
finally {
|
||||
if (lockTaken) {
|
||||
Monitor.Exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
Finalize();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
[TypeLibType(TypeLibTypeFlags.FHidden)]
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
public sealed class _ISpeechVoiceEvents_SinkHelper : _ISpeechVoiceEvents {
|
||||
public _ISpeechVoiceEvents_StartStreamEventHandler m_StartStreamDelegate;
|
||||
|
||||
public _ISpeechVoiceEvents_EndStreamEventHandler m_EndStreamDelegate;
|
||||
|
||||
public _ISpeechVoiceEvents_VoiceChangeEventHandler m_VoiceChangeDelegate;
|
||||
|
||||
public _ISpeechVoiceEvents_BookmarkEventHandler m_BookmarkDelegate;
|
||||
|
||||
public _ISpeechVoiceEvents_WordEventHandler m_WordDelegate;
|
||||
|
||||
public _ISpeechVoiceEvents_SentenceEventHandler m_SentenceDelegate;
|
||||
|
||||
public _ISpeechVoiceEvents_PhonemeEventHandler m_PhonemeDelegate;
|
||||
|
||||
public _ISpeechVoiceEvents_VisemeEventHandler m_VisemeDelegate;
|
||||
|
||||
public _ISpeechVoiceEvents_AudioLevelEventHandler m_AudioLevelDelegate;
|
||||
|
||||
public _ISpeechVoiceEvents_EnginePrivateEventHandler m_EnginePrivateDelegate;
|
||||
|
||||
public int m_dwCookie;
|
||||
|
||||
public void StartStream(int P_0, object P_1) {
|
||||
m_StartStreamDelegate?.Invoke(P_0, P_1);
|
||||
}
|
||||
|
||||
public void EndStream(int P_0, object P_1) {
|
||||
m_EndStreamDelegate?.Invoke(P_0, P_1);
|
||||
}
|
||||
|
||||
public void VoiceChange(int P_0, object P_1, SpObjectToken P_2) {
|
||||
m_VoiceChangeDelegate?.Invoke(P_0, P_1, P_2);
|
||||
}
|
||||
|
||||
public void Bookmark(int P_0, object P_1, string P_2, int P_3) {
|
||||
m_BookmarkDelegate?.Invoke(P_0, P_1, P_2, P_3);
|
||||
}
|
||||
|
||||
public void Word(int P_0, object P_1, int P_2, int P_3) {
|
||||
m_WordDelegate?.Invoke(P_0, P_1, P_2, P_3);
|
||||
}
|
||||
|
||||
public void Sentence(int P_0, object P_1, int P_2, int P_3) {
|
||||
m_SentenceDelegate?.Invoke(P_0, P_1, P_2, P_3);
|
||||
}
|
||||
|
||||
public void Phoneme(int P_0, object P_1, int P_2, short P_3, SpeechVisemeFeature P_4, short P_5) {
|
||||
m_PhonemeDelegate?.Invoke(P_0, P_1, P_2, P_3, P_4, P_5);
|
||||
}
|
||||
|
||||
public void Viseme(int P_0, object P_1, int P_2, SpeechVisemeType P_3, SpeechVisemeFeature P_4, SpeechVisemeType P_5) {
|
||||
m_VisemeDelegate?.Invoke(P_0, P_1, P_2, P_3, P_4, P_5);
|
||||
}
|
||||
|
||||
public void AudioLevel(int P_0, object P_1, int P_2) {
|
||||
m_AudioLevelDelegate?.Invoke(P_0, P_1, P_2);
|
||||
}
|
||||
|
||||
public void EnginePrivate(int P_0, int P_1, object P_2) {
|
||||
m_EnginePrivateDelegate?.Invoke(P_0, P_1, P_2);
|
||||
}
|
||||
|
||||
internal _ISpeechVoiceEvents_SinkHelper() {
|
||||
m_dwCookie = 0;
|
||||
m_StartStreamDelegate = null;
|
||||
m_EndStreamDelegate = null;
|
||||
m_VoiceChangeDelegate = null;
|
||||
m_BookmarkDelegate = null;
|
||||
m_WordDelegate = null;
|
||||
m_SentenceDelegate = null;
|
||||
m_PhonemeDelegate = null;
|
||||
m_VisemeDelegate = null;
|
||||
m_AudioLevelDelegate = null;
|
||||
m_EnginePrivateDelegate = null;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user