ホーム › Media.Speech › SPPATHENTRY
SPPATHENTRY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| hTransition | SPTRANSITIONID | 8/4 | +0 | +0 | 認識経路上の遷移ID(SPTRANSITIONID)。 |
| elem | SPPHRASEELEMENT | 56/44 | +8 | +4 | この遷移に対応するフレーズ要素(SPPHRASEELEMENT)。 |
各言語での定義
#include <windows.h>
// SPPHRASEELEMENT (x64 56 / x86 44 バイト)
typedef struct SPPHRASEELEMENT {
DWORD ulAudioTimeOffset;
DWORD ulAudioSizeTime;
DWORD ulAudioStreamOffset;
DWORD ulAudioSizeBytes;
DWORD ulRetainedStreamOffset;
DWORD ulRetainedSizeBytes;
LPWSTR pszDisplayText;
LPWSTR pszLexicalForm;
WORD* pszPronunciation;
BYTE bDisplayAttributes;
CHAR RequiredConfidence;
CHAR ActualConfidence;
BYTE Reserved;
FLOAT SREngineConfidence;
} SPPHRASEELEMENT;
// SPPATHENTRY (x64 64 / x86 48 バイト)
typedef struct SPPATHENTRY {
SPTRANSITIONID hTransition;
SPPHRASEELEMENT elem;
} SPPATHENTRY;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SPPHRASEELEMENT
{
public uint ulAudioTimeOffset;
public uint ulAudioSizeTime;
public uint ulAudioStreamOffset;
public uint ulAudioSizeBytes;
public uint ulRetainedStreamOffset;
public uint ulRetainedSizeBytes;
public IntPtr pszDisplayText;
public IntPtr pszLexicalForm;
public IntPtr pszPronunciation;
public byte bDisplayAttributes;
public sbyte RequiredConfidence;
public sbyte ActualConfidence;
public byte Reserved;
public float SREngineConfidence;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SPPATHENTRY
{
public IntPtr hTransition;
public SPPHRASEELEMENT elem;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SPPHRASEELEMENT
Public ulAudioTimeOffset As UInteger
Public ulAudioSizeTime As UInteger
Public ulAudioStreamOffset As UInteger
Public ulAudioSizeBytes As UInteger
Public ulRetainedStreamOffset As UInteger
Public ulRetainedSizeBytes As UInteger
Public pszDisplayText As IntPtr
Public pszLexicalForm As IntPtr
Public pszPronunciation As IntPtr
Public bDisplayAttributes As Byte
Public RequiredConfidence As SByte
Public ActualConfidence As SByte
Public Reserved As Byte
Public SREngineConfidence As Single
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SPPATHENTRY
Public hTransition As IntPtr
Public elem As SPPHRASEELEMENT
End Structureimport ctypes
from ctypes import wintypes
class SPPHRASEELEMENT(ctypes.Structure):
_fields_ = [
("ulAudioTimeOffset", wintypes.DWORD),
("ulAudioSizeTime", wintypes.DWORD),
("ulAudioStreamOffset", wintypes.DWORD),
("ulAudioSizeBytes", wintypes.DWORD),
("ulRetainedStreamOffset", wintypes.DWORD),
("ulRetainedSizeBytes", wintypes.DWORD),
("pszDisplayText", ctypes.c_void_p),
("pszLexicalForm", ctypes.c_void_p),
("pszPronunciation", ctypes.c_void_p),
("bDisplayAttributes", ctypes.c_ubyte),
("RequiredConfidence", ctypes.c_byte),
("ActualConfidence", ctypes.c_byte),
("Reserved", ctypes.c_ubyte),
("SREngineConfidence", ctypes.c_float),
]
class SPPATHENTRY(ctypes.Structure):
_fields_ = [
("hTransition", ctypes.c_void_p),
("elem", SPPHRASEELEMENT),
]#[repr(C)]
pub struct SPPHRASEELEMENT {
pub ulAudioTimeOffset: u32,
pub ulAudioSizeTime: u32,
pub ulAudioStreamOffset: u32,
pub ulAudioSizeBytes: u32,
pub ulRetainedStreamOffset: u32,
pub ulRetainedSizeBytes: u32,
pub pszDisplayText: *mut core::ffi::c_void,
pub pszLexicalForm: *mut core::ffi::c_void,
pub pszPronunciation: *mut core::ffi::c_void,
pub bDisplayAttributes: u8,
pub RequiredConfidence: i8,
pub ActualConfidence: i8,
pub Reserved: u8,
pub SREngineConfidence: f32,
}
#[repr(C)]
pub struct SPPATHENTRY {
pub hTransition: *mut core::ffi::c_void,
pub elem: SPPHRASEELEMENT,
}import "golang.org/x/sys/windows"
type SPPHRASEELEMENT struct {
ulAudioTimeOffset uint32
ulAudioSizeTime uint32
ulAudioStreamOffset uint32
ulAudioSizeBytes uint32
ulRetainedStreamOffset uint32
ulRetainedSizeBytes uint32
pszDisplayText uintptr
pszLexicalForm uintptr
pszPronunciation uintptr
bDisplayAttributes byte
RequiredConfidence int8
ActualConfidence int8
Reserved byte
SREngineConfidence float32
}
type SPPATHENTRY struct {
hTransition uintptr
elem SPPHRASEELEMENT
}type
SPPHRASEELEMENT = record
ulAudioTimeOffset: DWORD;
ulAudioSizeTime: DWORD;
ulAudioStreamOffset: DWORD;
ulAudioSizeBytes: DWORD;
ulRetainedStreamOffset: DWORD;
ulRetainedSizeBytes: DWORD;
pszDisplayText: Pointer;
pszLexicalForm: Pointer;
pszPronunciation: Pointer;
bDisplayAttributes: Byte;
RequiredConfidence: Shortint;
ActualConfidence: Shortint;
Reserved: Byte;
SREngineConfidence: Single;
end;
SPPATHENTRY = record
hTransition: Pointer;
elem: SPPHRASEELEMENT;
end;const SPPHRASEELEMENT = extern struct {
ulAudioTimeOffset: u32,
ulAudioSizeTime: u32,
ulAudioStreamOffset: u32,
ulAudioSizeBytes: u32,
ulRetainedStreamOffset: u32,
ulRetainedSizeBytes: u32,
pszDisplayText: ?*anyopaque,
pszLexicalForm: ?*anyopaque,
pszPronunciation: ?*anyopaque,
bDisplayAttributes: u8,
RequiredConfidence: i8,
ActualConfidence: i8,
Reserved: u8,
SREngineConfidence: f32,
};
const SPPATHENTRY = extern struct {
hTransition: ?*anyopaque,
elem: SPPHRASEELEMENT,
};type
SPPHRASEELEMENT {.bycopy.} = object
ulAudioTimeOffset: uint32
ulAudioSizeTime: uint32
ulAudioStreamOffset: uint32
ulAudioSizeBytes: uint32
ulRetainedStreamOffset: uint32
ulRetainedSizeBytes: uint32
pszDisplayText: pointer
pszLexicalForm: pointer
pszPronunciation: pointer
bDisplayAttributes: uint8
RequiredConfidence: int8
ActualConfidence: int8
Reserved: uint8
SREngineConfidence: float32
SPPATHENTRY {.bycopy.} = object
hTransition: pointer
elem: SPPHRASEELEMENTstruct SPPHRASEELEMENT
{
uint ulAudioTimeOffset;
uint ulAudioSizeTime;
uint ulAudioStreamOffset;
uint ulAudioSizeBytes;
uint ulRetainedStreamOffset;
uint ulRetainedSizeBytes;
void* pszDisplayText;
void* pszLexicalForm;
void* pszPronunciation;
ubyte bDisplayAttributes;
byte RequiredConfidence;
byte ActualConfidence;
ubyte Reserved;
float SREngineConfidence;
}
struct SPPATHENTRY
{
void* hTransition;
SPPHRASEELEMENT elem;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SPPATHENTRY サイズ: 48 バイト(x86)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; hTransition : SPTRANSITIONID (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; elem : SPPHRASEELEMENT (+4, 44byte) varptr(st)+4 を基点に操作(44byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SPPATHENTRY サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; hTransition : SPTRANSITIONID (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; elem : SPPHRASEELEMENT (+8, 56byte) varptr(st)+8 を基点に操作(56byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SPPHRASEELEMENT
#field int ulAudioTimeOffset
#field int ulAudioSizeTime
#field int ulAudioStreamOffset
#field int ulAudioSizeBytes
#field int ulRetainedStreamOffset
#field int ulRetainedSizeBytes
#field intptr pszDisplayText
#field intptr pszLexicalForm
#field intptr pszPronunciation
#field byte bDisplayAttributes
#field byte RequiredConfidence
#field byte ActualConfidence
#field byte Reserved
#field float SREngineConfidence
#endstruct
#defstruct global SPPATHENTRY
#field intptr hTransition
#field SPPHRASEELEMENT elem
#endstruct
stdim st, SPPATHENTRY ; NSTRUCT 変数を確保