Share via


EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM コールバック関数 (acxelements.h)

EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM コールバックは、キーワード (keyword) スッターの arm 状態を設定します。

構文

EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM EvtAcxKeywordspotterAssignArm;

NTSTATUS EvtAcxKeywordspotterAssignArm(
  ACXKEYWORDSPOTTER KeywordSpotter,
  GUID *EventId,
  BOOLEAN Arm
)
{...}

パラメーター

KeywordSpotter

既存の初期化された ACXKEYWORDSPOTTER オブジェクト。 ACX オブジェクトの詳細については、「 ACX オブジェクトの概要」を参照してください。 AcxKeywordSpotterCreate 関数も参照してください。

EventId

EventId を表す GUID へのポインター。

Arm

キーワード (keyword)検出が armed かどうかを示すブール値。

戻り値

STATUS_SUCCESS呼び出しが成功した場合は を返します。 それ以外の場合は、適切なエラー コードを返します。 詳細については、「 NTSTATUS 値の使用」を参照してください。

注釈

キーワード (keyword)検出の一般的な情報については、「音声のアクティブ化」と「複数の音声アシスタント」を参照してください。

使用例を次に示します。

EVT_ACX_KEYWORDSPOTTER_ASSIGN_ARM       DspC_EvtAcxKeywordSpotterAssignArm;

PAGED_CODE_SEG
NTSTATUS DspC_EvtAcxKeywordSpotterAssignArm(
    _In_    ACXKEYWORDSPOTTER   KeywordSpotter,
    _In_    GUID *              EventId,
    _In_    BOOLEAN             Arm
)
{
    PAGED_CODE();
    PDSP_KEYWORDSPOTTER_CONTEXT     keywordSpotterCtx;
    CKeywordDetector *              keywordDetector = NULL;

    keywordSpotterCtx = GetDspKeywordSpotterContext(KeywordSpotter);

    keywordDetector = (CKeywordDetector*)keywordSpotterCtx->KeywordDetector;

    RETURN_NTSTATUS_IF_FAILED(keywordDetector->SetArmed(*EventId, Arm));

    // the following code is for example only, after arming the
    // requested keyword we immediately trigger a detection
    // so that the automated tests do not block.
    if (Arm)
    {
        CONTOSO_KEYWORDDETECTIONRESULT detectionResult;

        // notify the keyword detector that we have a notification, to populate
        // timestamp information for this detection.
        keywordDetector->NotifyDetection();

        // fill in the detection specific information
        detectionResult.EventId = *EventId;
        detectionResult.Header.Size = sizeof(CONTOSO_KEYWORDDETECTIONRESULT);
        detectionResult.Header.PatternType = CONTOSO_KEYWORDCONFIGURATION_IDENTIFIER2;
        detectionResult.KeywordStartTimestamp = keywordDetector->GetStartTimestamp();
        detectionResult.KeywordStopTimestamp = keywordDetector->GetStopTimestamp();
        keywordDetector->GetDetectorData(*EventId, &(detectionResult.ContosoDetectorResultData));

        RETURN_NTSTATUS_IF_FAILED(AcxPnpEventGenerateEvent(keywordSpotterCtx->Event, &detectionResult, sizeof(CONTOSO_KEYWORDDETECTIONRESULT)));
    }

    return STATUS_SUCCESS;
}

ACX の要件

最小 ACX バージョン: 1.0

ACX バージョンの詳細については、「 ACX バージョンの概要」を参照してください。

要件

要件
Header acxelements.h
IRQL PASSIVE_LEVEL

こちらもご覧ください