ホーム › Media.Speech › SPPHRASEELEMENT
SPPHRASEELEMENT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ulAudioTimeOffset | DWORD | 4 | +0 | +0 | この要素の音声開始位置を時間オフセット(100ナノ秒単位)で示す。 |
| ulAudioSizeTime | DWORD | 4 | +4 | +4 | この要素の音声継続長を時間(100ナノ秒単位)で示す。 |
| ulAudioStreamOffset | DWORD | 4 | +8 | +8 | この要素の音声開始位置をストリームバイトオフセットで示す。 |
| ulAudioSizeBytes | DWORD | 4 | +12 | +12 | この要素の音声データのバイト数。 |
| ulRetainedStreamOffset | DWORD | 4 | +16 | +16 | 保持された音声ストリーム中のバイトオフセット。 |
| ulRetainedSizeBytes | DWORD | 4 | +20 | +20 | 保持された音声データのバイト数。 |
| pszDisplayText | LPWSTR | 8/4 | +24 | +24 | 画面表示用の単語テキスト(Unicode文字列)。 |
| pszLexicalForm | LPWSTR | 8/4 | +32 | +28 | 辞書見出し形(語彙形)のテキスト(Unicode文字列)。 |
| pszPronunciation | WORD* | 8/4 | +40 | +32 | 発音記号(音素ID)の配列へのポインタ。NULL終端。 |
| bDisplayAttributes | BYTE | 1 | +48 | +36 | 表示属性フラグ。前後の空白付与等(SPAF_*)を示す。 |
| RequiredConfidence | CHAR | 1 | +49 | +37 | アプリが要求した最小信頼度レベル(SP_LOW/NORMAL/HIGH)。 |
| ActualConfidence | CHAR | 1 | +50 | +38 | 認識エンジンが判定した実際の信頼度レベル。 |
| Reserved | BYTE | 1 | +51 | +39 | 予約領域。使用しない。 |
| SREngineConfidence | FLOAT | 4 | +52 | +40 | 認識エンジンによる信頼度スコア(0.0~1.0の浮動小数点)。 |
各言語での定義
#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;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;
}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 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),
]#[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,
}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
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;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,
};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: float32struct 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;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SPPHRASEELEMENT サイズ: 44 バイト(x86)
dim st, 11 ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; ulAudioTimeOffset : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ulAudioSizeTime : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ulAudioStreamOffset : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ulAudioSizeBytes : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ulRetainedStreamOffset : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ulRetainedSizeBytes : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; pszDisplayText : LPWSTR (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; pszLexicalForm : LPWSTR (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; pszPronunciation : WORD* (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; bDisplayAttributes : BYTE (+36, 1byte) poke st,36,値 / 値 = peek(st,36)
; RequiredConfidence : CHAR (+37, 1byte) poke st,37,値 / 値 = peek(st,37)
; ActualConfidence : CHAR (+38, 1byte) poke st,38,値 / 値 = peek(st,38)
; Reserved : BYTE (+39, 1byte) poke st,39,値 / 値 = peek(st,39)
; SREngineConfidence : FLOAT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SPPHRASEELEMENT サイズ: 56 バイト(x64)
dim st, 14 ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; ulAudioTimeOffset : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ulAudioSizeTime : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; ulAudioStreamOffset : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ulAudioSizeBytes : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ulRetainedStreamOffset : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ulRetainedSizeBytes : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; pszDisplayText : LPWSTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pszLexicalForm : LPWSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; pszPronunciation : WORD* (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; bDisplayAttributes : BYTE (+48, 1byte) poke st,48,値 / 値 = peek(st,48)
; RequiredConfidence : CHAR (+49, 1byte) poke st,49,値 / 値 = peek(st,49)
; ActualConfidence : CHAR (+50, 1byte) poke st,50,値 / 値 = peek(st,50)
; Reserved : BYTE (+51, 1byte) poke st,51,値 / 値 = peek(st,51)
; SREngineConfidence : FLOAT (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#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
stdim st, SPPHRASEELEMENT ; NSTRUCT 変数を確保
st->ulAudioTimeOffset = 100
mes "ulAudioTimeOffset=" + st->ulAudioTimeOffset