/////////////////////////////////////////

typedef enum SpeechInterference
{
    SINone      = SPINTERFERENCE_NONE,
    SINoise     = SPINTERFERENCE_NOISE,
    SINoSignal  = SPINTERFERENCE_NOSIGNAL,
    SITooLoud   = SPINTERFERENCE_TOOLOUD,
    SITooQuiet  = SPINTERFERENCE_TOOQUIET,
    SITooFast   = SPINTERFERENCE_TOOFAST,
    SITooSlow   = SPINTERFERENCE_TOOSLOW
} SpeechInterference;

/////////////////////////////////////////////////
//
// SpeechRecoEvents Enum
//  SAPI C++ Only Interface Equivalent: 
//
/////////////////////////////////////////////////

typedef enum SpeechRecoEvents
{
    SREStreamEnd             = (1L << 0),  // SR engine has reached the end of an input stream 
    SRESoundStart            = (1L << 1),  // SR engine has detected the start of non-trivial audio data
    SRESoundEnd              = (1L << 2),  // SR engine has detected the end of non-trivial audio data
    SREPhraseStart           = (1L << 3),  // SR engine has detected the start of a recognizable phrase
    SRERecognition           = (1L << 4),  // SR engine's best hypothesis for the audio data
    SREHypothesis            = (1L << 5),  // SR engine's interim hypothesis for the result of the audio data
    SREBookmark              = (1L << 6),  // SR engine has reached the specified point in the audio stream 
    SREPropertyNumChange     = (1L << 7),  // LPARAM points to a string, WPARAM is the attrib value
    SREPropertyStringChange = (1L << 8),  // LPARAM pointer to buffer.  Two concatinated null terminated strings.
    SREFalseRecognition      = (1L << 9),  // apparent speech with no valid recognition
    SREInterference          = (1L << 10),  // LPARAM is any combination of SPINTERFERENCE flags
    SRERequestUI             = (1L << 11),  // LPARAM is string.  
    SREStateChange           = (1L << 12),  // wParam contains new reco state
    SREAdaptation            = (1L << 13),  // the adaptation buffer is now ready to be accepted
    SREStreamStart           = (1L << 14),  // SR engine has reached the start of an input stream
    SRERecoOtherContext      = (1L << 15),  // Phrase finished and recognized, but for other context
    SREAudioLevel            = (1L << 16),  // input audio volume level  
    SREPrivate               = (1L << 18),  // private engine specific event 
    SREAllEvents             = 0x5FFFF      // All Reco events on.
} SpeechRecoEvents;

/////////////////////////////////////////////////
//
// SpeechRecoContextState Enum
//  SAPI C++ Only Interface Equivalent: 
//
/////////////////////////////////////////////////

typedef enum SpeechRecoContextState
{
    SRCS_Disabled   = SPCS_DISABLED,
    SRCS_Enabled    = SPCS_ENABLED
} SpeechRecoContextState;


[
    object,
    uuid(580AA49D-7E1E-4809-B8E2-57DA806104B8),
    dual,
    helpstring("ISpeechRecoContext Interface"),
    pointer_default(unique)
]
interface ISpeechRecoContext : IDispatch
{
    //  Properties
    
    // Recognizer 
    //  SAPI C++ Only Interface Equivalent: 
    //  Default: 
    //
    [propget, helpstring("Recognizer"), id(DISPID_SRCRecognizer)] 
        HRESULT Recognizer( [out,retval]ISpeechRecognizer** Recognizer );
    
    // AudioInInterferenceStatus 
    //  SAPI C++ Only Interface Equivalent: 
    //  Default: 
    //
    [propget, helpstring("AudioInInterferenceStatus"), id(DISPID_SRCAudioInInterferenceStatus)] 
        HRESULT AudioInputInterferenceStatus( [out,retval]SpeechInterference* Interference );
    
    // RequestedUIType 
    //  SAPI C++ Only Interface Equivalent: 
    //  Default: 
    //
    [propget, helpstring("RequestedUIType"), id(DISPID_SRCRequestedUIType)] 
        HRESULT RequestedUIType( [out,retval]BSTR* UIType );
    
    // Voice 
    //  SAPI C++ Only Interface Equivalent: 
    //  Default: 
    //
    [propputref, helpstring("Voice"), id(DISPID_SRCVoice)] 
        HRESULT Voice([in]ISpeechVoice *Voice );
    [propget, helpstring("Voice"), id(DISPID_SRCVoice)] 
        HRESULT Voice([out,retval]ISpeechVoice **Voice );
    
    // AllowVoiceFormatMatchingOnNextSet
    //
    [propput, hidden, helpstring("AllowVoiceFormatMatchingOnNextSet"), id(DISPID_SRAllowVoiceFormatMatchingOnNextSet)] 
        HRESULT AllowVoiceFormatMatchingOnNextSet([in] VARIANT_BOOL Allow );
    [propget, hidden, helpstring("AllowAudioInputFormatChangesOnNextSet"), id(DISPID_SRAllowVoiceFormatMatchingOnNextSet)]
        HRESULT AllowVoiceFormatMatchingOnNextSet([out,retval] VARIANT_BOOL* pAllow );
    
    // VoicePurgeEvent 
    //  SAPI C++ Only Interface Equivalent: 
    //  Default: 
    //
    [propput, helpstring("VoicePurgeEvent"), id(DISPID_SRCVoicePurgeEvent)] 
        HRESULT VoicePurgeEvent( [in]SpeechRecoEvents EventInterest );
    [propget, helpstring("VoicePurgeEvent"), id(DISPID_SRCVoicePurgeEvent)] 
        HRESULT VoicePurgeEvent( [out,retval]SpeechRecoEvents* EventInterest );
    
    // EventInterests 
    //  SAPI C++ Only Interface Equivalent: 
    //  Default: 
    //
    [propput, helpstring("EventInterests"), id(DISPID_SRCEventInterests)] 
        HRESULT EventInterests( [in]SpeechRecoEvents EventInterest );
    [propget, helpstring("EventInterests"), id(DISPID_SRCEventInterests)] 
        HRESULT EventInterests( [out,retval]SpeechRecoEvents* EventInterest );
    
    // CmdMaxAlternates 
    //  SAPI C++ Only Interface Equivalent: 
    //  Default: 
    //
    [propput, helpstring("CmdMaxAlternates"), id(DISPID_SRCCmdMaxAlternates)] 
        HRESULT CmdMaxAlternates([in] long MaxAlternates );
    [propget, helpstring("CmdMaxAlternates"), id(DISPID_SRCCmdMaxAlternates)] 
        HRESULT CmdMaxAlternates([out,retval] long* MaxAlternates );
    
    // State 
    //  SAPI C++ Only Interface Equivalent: 
    //  Default: 
    //
    [propput, helpstring("State"), id(DISPID_SRCState)]
        HRESULT State([in] SpeechRecoContextState State );
    [propget, helpstring("State"), id(DISPID_SRCState)] 
        HRESULT State([out,retval] SpeechRecoContextState* State );
    
    // RetainedAudio 
    //  SAPI C++ Only Interface Equivalent: 
    //  Default: 
    //
    [propput, helpstring("RetainedAudio"), id(DISPID_SRCRetainedAudio)]
        HRESULT RetainedAudio([in]SpeechRetainedAudioOptions Option);
    [propget, helpstring("RetainedAudio"), id(DISPID_SRCRetainedAudio)]
        HRESULT RetainedAudio([out,retval]SpeechRetainedAudioOptions* Option);
    
    // RetainedAudioFormat 
    //  SAPI C++ Only Interface Equivalent: 
    //  Default: 
    //
    [propputref, helpstring("RetainedAudioFormat"), id(DISPID_SRCRetainedAudioFormat)]
        HRESULT RetainedAudioFormat([in] ISpeechAudioFormat* Format );
    [propget, helpstring("RetainedAudioFormat"), id(DISPID_SRCRetainedAudioFormat)]
        HRESULT RetainedAudioFormat([out,retval] ISpeechAudioFormat** Format );

    //  Methods
    
    // Pause 
    //  SAPI C++ Only Interface Equivalent: 
    //
    [helpstring("Pause"), id(DISPID_SRCPause)]
        HRESULT Pause(void);
    
    // Resume 
    //  SAPI C++ Only Interface Equivalent: 
    //
    [helpstring("Resume"), id(DISPID_SRCResume)]
        HRESULT Resume(void);
    
    // CreateGrammar 
    //  SAPI C++ Only Interface Equivalent: 
    //
    [helpstring("CreateGrammar"), id(DISPID_SRCCreateGrammar)]
        HRESULT CreateGrammar( [in, defaultvalue(0)]VARIANT GrammarId, [out,retval]ISpeechRecoGrammar** Grammar );
    
    // CreateResultFromMemory 
    //  SAPI C++ Only Interface Equivalent: 
    //
    [helpstring("CreateResultFromMemory"), id(DISPID_SRCCreateResultFromMemory)]
        HRESULT CreateResultFromMemory( [in]VARIANT* ResultBlock, [out,retval]ISpeechRecoResult **Result );
    
    // Bookmark 
    //  SAPI C++ Only Interface Equivalent: 
    //
    [helpstring("Bookmark"), id(DISPID_SRCBookmark)]
        HRESULT Bookmark( [in]SpeechBookmarkOptions Options, [in]VARIANT StreamPos, [in]VARIANT BookmarkId );
    
    // SetAdaptationData 
    //  SAPI C++ Only Interface Equivalent: 
    //
    [helpstring("SetAdaptati