Win32 API 日本語リファレンス
ホームMedia.Speech › SPRECORESULTINFOEX

SPRECORESULTINFOEX

構造体
サイズx64: 96 バイト / x86: 72 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
BaseSPRECORESULTINFO80/56+0+0基本となる認識結果情報(SPRECORESULTINFO)。
ullStreamTimeStartULONGLONG8+80+56結果の開始位置を時間オフセット(100ナノ秒単位)で示す。
ullStreamTimeEndULONGLONG8+88+64結果の終了位置を時間オフセット(100ナノ秒単位)で示す。

各言語での定義

#include <windows.h>

// SPRECORESULTINFO  (x64 80 / x86 56 バイト)
typedef struct SPRECORESULTINFO {
    DWORD cbSize;
    SPRESULTTYPE eResultType;
    BOOL fHypothesis;
    BOOL fProprietaryAutoPause;
    ULONGLONG ullStreamPosStart;
    ULONGLONG ullStreamPosEnd;
    SPGRAMMARHANDLE hGrammar;
    DWORD ulSizeEngineData;
    void* pvEngineData;
    ISpPhraseBuilder* pPhrase;
    SPPHRASEALT* aPhraseAlts;
    DWORD ulNumAlts;
} SPRECORESULTINFO;

// SPRECORESULTINFOEX  (x64 96 / x86 72 バイト)
typedef struct SPRECORESULTINFOEX {
    SPRECORESULTINFO Base;
    ULONGLONG ullStreamTimeStart;
    ULONGLONG ullStreamTimeEnd;
} SPRECORESULTINFOEX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SPRECORESULTINFO
{
    public uint cbSize;
    public int eResultType;
    [MarshalAs(UnmanagedType.Bool)] public bool fHypothesis;
    [MarshalAs(UnmanagedType.Bool)] public bool fProprietaryAutoPause;
    public ulong ullStreamPosStart;
    public ulong ullStreamPosEnd;
    public IntPtr hGrammar;
    public uint ulSizeEngineData;
    public IntPtr pvEngineData;
    public IntPtr pPhrase;
    public IntPtr aPhraseAlts;
    public uint ulNumAlts;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SPRECORESULTINFOEX
{
    public SPRECORESULTINFO Base;
    public ulong ullStreamTimeStart;
    public ulong ullStreamTimeEnd;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SPRECORESULTINFO
    Public cbSize As UInteger
    Public eResultType As Integer
    <MarshalAs(UnmanagedType.Bool)> Public fHypothesis As Boolean
    <MarshalAs(UnmanagedType.Bool)> Public fProprietaryAutoPause As Boolean
    Public ullStreamPosStart As ULong
    Public ullStreamPosEnd As ULong
    Public hGrammar As IntPtr
    Public ulSizeEngineData As UInteger
    Public pvEngineData As IntPtr
    Public pPhrase As IntPtr
    Public aPhraseAlts As IntPtr
    Public ulNumAlts As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SPRECORESULTINFOEX
    Public Base As SPRECORESULTINFO
    Public ullStreamTimeStart As ULong
    Public ullStreamTimeEnd As ULong
End Structure
import ctypes
from ctypes import wintypes

class SPRECORESULTINFO(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("eResultType", ctypes.c_int),
        ("fHypothesis", wintypes.BOOL),
        ("fProprietaryAutoPause", wintypes.BOOL),
        ("ullStreamPosStart", ctypes.c_ulonglong),
        ("ullStreamPosEnd", ctypes.c_ulonglong),
        ("hGrammar", ctypes.c_void_p),
        ("ulSizeEngineData", wintypes.DWORD),
        ("pvEngineData", ctypes.c_void_p),
        ("pPhrase", ctypes.c_void_p),
        ("aPhraseAlts", ctypes.c_void_p),
        ("ulNumAlts", wintypes.DWORD),
    ]

class SPRECORESULTINFOEX(ctypes.Structure):
    _fields_ = [
        ("Base", SPRECORESULTINFO),
        ("ullStreamTimeStart", ctypes.c_ulonglong),
        ("ullStreamTimeEnd", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct SPRECORESULTINFO {
    pub cbSize: u32,
    pub eResultType: i32,
    pub fHypothesis: i32,
    pub fProprietaryAutoPause: i32,
    pub ullStreamPosStart: u64,
    pub ullStreamPosEnd: u64,
    pub hGrammar: *mut core::ffi::c_void,
    pub ulSizeEngineData: u32,
    pub pvEngineData: *mut core::ffi::c_void,
    pub pPhrase: *mut core::ffi::c_void,
    pub aPhraseAlts: *mut core::ffi::c_void,
    pub ulNumAlts: u32,
}

#[repr(C)]
pub struct SPRECORESULTINFOEX {
    pub Base: SPRECORESULTINFO,
    pub ullStreamTimeStart: u64,
    pub ullStreamTimeEnd: u64,
}
import "golang.org/x/sys/windows"

type SPRECORESULTINFO struct {
	cbSize uint32
	eResultType int32
	fHypothesis int32
	fProprietaryAutoPause int32
	ullStreamPosStart uint64
	ullStreamPosEnd uint64
	hGrammar uintptr
	ulSizeEngineData uint32
	pvEngineData uintptr
	pPhrase uintptr
	aPhraseAlts uintptr
	ulNumAlts uint32
}

type SPRECORESULTINFOEX struct {
	Base SPRECORESULTINFO
	ullStreamTimeStart uint64
	ullStreamTimeEnd uint64
}
type
  SPRECORESULTINFO = record
    cbSize: DWORD;
    eResultType: Integer;
    fHypothesis: BOOL;
    fProprietaryAutoPause: BOOL;
    ullStreamPosStart: UInt64;
    ullStreamPosEnd: UInt64;
    hGrammar: Pointer;
    ulSizeEngineData: DWORD;
    pvEngineData: Pointer;
    pPhrase: Pointer;
    aPhraseAlts: Pointer;
    ulNumAlts: DWORD;
  end;

  SPRECORESULTINFOEX = record
    Base: SPRECORESULTINFO;
    ullStreamTimeStart: UInt64;
    ullStreamTimeEnd: UInt64;
  end;
const SPRECORESULTINFO = extern struct {
    cbSize: u32,
    eResultType: i32,
    fHypothesis: i32,
    fProprietaryAutoPause: i32,
    ullStreamPosStart: u64,
    ullStreamPosEnd: u64,
    hGrammar: ?*anyopaque,
    ulSizeEngineData: u32,
    pvEngineData: ?*anyopaque,
    pPhrase: ?*anyopaque,
    aPhraseAlts: ?*anyopaque,
    ulNumAlts: u32,
};

const SPRECORESULTINFOEX = extern struct {
    Base: SPRECORESULTINFO,
    ullStreamTimeStart: u64,
    ullStreamTimeEnd: u64,
};
type
  SPRECORESULTINFO {.bycopy.} = object
    cbSize: uint32
    eResultType: int32
    fHypothesis: int32
    fProprietaryAutoPause: int32
    ullStreamPosStart: uint64
    ullStreamPosEnd: uint64
    hGrammar: pointer
    ulSizeEngineData: uint32
    pvEngineData: pointer
    pPhrase: pointer
    aPhraseAlts: pointer
    ulNumAlts: uint32

  SPRECORESULTINFOEX {.bycopy.} = object
    Base: SPRECORESULTINFO
    ullStreamTimeStart: uint64
    ullStreamTimeEnd: uint64
struct SPRECORESULTINFO
{
    uint cbSize;
    int eResultType;
    int fHypothesis;
    int fProprietaryAutoPause;
    ulong ullStreamPosStart;
    ulong ullStreamPosEnd;
    void* hGrammar;
    uint ulSizeEngineData;
    void* pvEngineData;
    void* pPhrase;
    void* aPhraseAlts;
    uint ulNumAlts;
}

struct SPRECORESULTINFOEX
{
    SPRECORESULTINFO Base;
    ulong ullStreamTimeStart;
    ulong ullStreamTimeEnd;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SPRECORESULTINFOEX サイズ: 72 バイト(x86)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; Base : SPRECORESULTINFO (+0, 56byte)  varptr(st)+0 を基点に操作(56byte:入れ子/配列)
; ullStreamTimeStart : ULONGLONG (+56, 8byte)  qpoke st,56,値 / qpeek(st,56)  ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; ullStreamTimeEnd : ULONGLONG (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SPRECORESULTINFOEX サイズ: 96 バイト(x64)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; Base : SPRECORESULTINFO (+0, 80byte)  varptr(st)+0 を基点に操作(80byte:入れ子/配列)
; ullStreamTimeStart : ULONGLONG (+80, 8byte)  qpoke st,80,値 / qpeek(st,80)  ※IronHSPのみ。3.7/3.8は lpoke st,80,下位 : lpoke st,84,上位
; ullStreamTimeEnd : ULONGLONG (+88, 8byte)  qpoke st,88,値 / qpeek(st,88)  ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SPRECORESULTINFO
    #field int cbSize
    #field int eResultType
    #field bool fHypothesis
    #field bool fProprietaryAutoPause
    #field int64 ullStreamPosStart
    #field int64 ullStreamPosEnd
    #field intptr hGrammar
    #field int ulSizeEngineData
    #field intptr pvEngineData
    #field intptr pPhrase
    #field intptr aPhraseAlts
    #field int ulNumAlts
#endstruct

#defstruct global SPRECORESULTINFOEX
    #field SPRECORESULTINFO Base
    #field int64 ullStreamTimeStart
    #field int64 ullStreamTimeEnd
#endstruct

stdim st, SPRECORESULTINFOEX        ; NSTRUCT 変数を確保
st->ullStreamTimeStart = 100
mes "ullStreamTimeStart=" + st->ullStreamTimeStart