ホーム › Media.Speech › SPRECOCONTEXTSTATUS
SPRECOCONTEXTSTATUS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| eInterference | SPINTERFERENCE | 4 | +0 | +0 | 音声入力の干渉状態(雑音・大きすぎ等。SPINTERFERENCE)。 |
| szRequestTypeOfUI | WCHAR | 510 | +4 | +4 | エンジンが要求するUIの種類を示す文字列。 |
| dwReserved1 | DWORD | 4 | +516 | +516 | 予約領域。使用しない。 |
| dwReserved2 | DWORD | 4 | +520 | +520 | 予約領域。使用しない。 |
各言語での定義
#include <windows.h>
// SPRECOCONTEXTSTATUS (x64 524 / x86 524 バイト)
typedef struct SPRECOCONTEXTSTATUS {
SPINTERFERENCE eInterference;
WCHAR szRequestTypeOfUI[255];
DWORD dwReserved1;
DWORD dwReserved2;
} SPRECOCONTEXTSTATUS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SPRECOCONTEXTSTATUS
{
public int eInterference;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)] public string szRequestTypeOfUI;
public uint dwReserved1;
public uint dwReserved2;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SPRECOCONTEXTSTATUS
Public eInterference As Integer
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=255)> Public szRequestTypeOfUI As String
Public dwReserved1 As UInteger
Public dwReserved2 As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SPRECOCONTEXTSTATUS(ctypes.Structure):
_fields_ = [
("eInterference", ctypes.c_int),
("szRequestTypeOfUI", ctypes.c_wchar * 255),
("dwReserved1", wintypes.DWORD),
("dwReserved2", wintypes.DWORD),
]#[repr(C)]
pub struct SPRECOCONTEXTSTATUS {
pub eInterference: i32,
pub szRequestTypeOfUI: [u16; 255],
pub dwReserved1: u32,
pub dwReserved2: u32,
}import "golang.org/x/sys/windows"
type SPRECOCONTEXTSTATUS struct {
eInterference int32
szRequestTypeOfUI [255]uint16
dwReserved1 uint32
dwReserved2 uint32
}type
SPRECOCONTEXTSTATUS = record
eInterference: Integer;
szRequestTypeOfUI: array[0..254] of WideChar;
dwReserved1: DWORD;
dwReserved2: DWORD;
end;const SPRECOCONTEXTSTATUS = extern struct {
eInterference: i32,
szRequestTypeOfUI: [255]u16,
dwReserved1: u32,
dwReserved2: u32,
};type
SPRECOCONTEXTSTATUS {.bycopy.} = object
eInterference: int32
szRequestTypeOfUI: array[255, uint16]
dwReserved1: uint32
dwReserved2: uint32struct SPRECOCONTEXTSTATUS
{
int eInterference;
wchar[255] szRequestTypeOfUI;
uint dwReserved1;
uint dwReserved2;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SPRECOCONTEXTSTATUS サイズ: 524 バイト(x64)
dim st, 131 ; 4byte整数×131(構造体サイズ 524 / 4 切り上げ)
; eInterference : SPINTERFERENCE (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; szRequestTypeOfUI : WCHAR (+4, 510byte) varptr(st)+4 を基点に操作(510byte:入れ子/配列)
; dwReserved1 : DWORD (+516, 4byte) st.129 = 値 / 値 = st.129 (lpoke/lpeek も可)
; dwReserved2 : DWORD (+520, 4byte) st.130 = 値 / 値 = st.130 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SPRECOCONTEXTSTATUS
#field int eInterference
#field wchar szRequestTypeOfUI 255
#field int dwReserved1
#field int dwReserved2
#endstruct
stdim st, SPRECOCONTEXTSTATUS ; NSTRUCT 変数を確保
st->eInterference = 100
mes "eInterference=" + st->eInterference