ホーム › Media.Speech › SPVOICESTATUS
SPVOICESTATUS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ulCurrentStream | DWORD | 4 | +0 | +0 | 現在再生中のストリーム番号。 |
| ulLastStreamQueued | DWORD | 4 | +4 | +4 | 最後にキューへ投入されたストリーム番号。 |
| hrLastResult | HRESULT | 4 | +8 | +8 | 直近の処理結果を示すHRESULT。 |
| dwRunningState | DWORD | 4 | +12 | +12 | 音声合成エンジンの動作状態フラグ(SPRS_DONE/IS_SPEAKING)。 |
| ulInputWordPos | DWORD | 4 | +16 | +16 | 入力テキスト内で発話中の単語の開始文字位置。 |
| ulInputWordLen | DWORD | 4 | +20 | +20 | 発話中の単語の文字数。 |
| ulInputSentPos | DWORD | 4 | +24 | +24 | 入力テキスト内で発話中の文の開始文字位置。 |
| ulInputSentLen | DWORD | 4 | +28 | +28 | 発話中の文の文字数。 |
| lBookmarkId | INT | 4 | +32 | +32 | 直近に到達したブックマークのID。 |
| PhonemeId | WORD | 2 | +36 | +36 | 現在発話中の音素ID。 |
| VisemeId | SPVISEMES | 4 | +40 | +40 | 現在の口形素(ビゼーム)ID(SPVISEMES)。 |
| dwReserved1 | DWORD | 4 | +44 | +44 | 予約領域。使用しない。 |
| dwReserved2 | DWORD | 4 | +48 | +48 | 予約領域。使用しない。 |
各言語での定義
#include <windows.h>
// SPVOICESTATUS (x64 52 / x86 52 バイト)
typedef struct SPVOICESTATUS {
DWORD ulCurrentStream;
DWORD ulLastStreamQueued;
HRESULT hrLastResult;
DWORD dwRunningState;
DWORD ulInputWordPos;
DWORD ulInputWordLen;
DWORD ulInputSentPos;
DWORD ulInputSentLen;
INT lBookmarkId;
WORD PhonemeId;
SPVISEMES VisemeId;
DWORD dwReserved1;
DWORD dwReserved2;
} SPVOICESTATUS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SPVOICESTATUS
{
public uint ulCurrentStream;
public uint ulLastStreamQueued;
public int hrLastResult;
public uint dwRunningState;
public uint ulInputWordPos;
public uint ulInputWordLen;
public uint ulInputSentPos;
public uint ulInputSentLen;
public int lBookmarkId;
public ushort PhonemeId;
public int VisemeId;
public uint dwReserved1;
public uint dwReserved2;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SPVOICESTATUS
Public ulCurrentStream As UInteger
Public ulLastStreamQueued As UInteger
Public hrLastResult As Integer
Public dwRunningState As UInteger
Public ulInputWordPos As UInteger
Public ulInputWordLen As UInteger
Public ulInputSentPos As UInteger
Public ulInputSentLen As UInteger
Public lBookmarkId As Integer
Public PhonemeId As UShort
Public VisemeId As Integer
Public dwReserved1 As UInteger
Public dwReserved2 As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SPVOICESTATUS(ctypes.Structure):
_fields_ = [
("ulCurrentStream", wintypes.DWORD),
("ulLastStreamQueued", wintypes.DWORD),
("hrLastResult", ctypes.c_int),
("dwRunningState", wintypes.DWORD),
("ulInputWordPos", wintypes.DWORD),
("ulInputWordLen", wintypes.DWORD),
("ulInputSentPos", wintypes.DWORD),
("ulInputSentLen", wintypes.DWORD),
("lBookmarkId", ctypes.c_int),
("PhonemeId", ctypes.c_ushort),
("VisemeId", ctypes.c_int),
("dwReserved1", wintypes.DWORD),
("dwReserved2", wintypes.DWORD),
]#[repr(C)]
pub struct SPVOICESTATUS {
pub ulCurrentStream: u32,
pub ulLastStreamQueued: u32,
pub hrLastResult: i32,
pub dwRunningState: u32,
pub ulInputWordPos: u32,
pub ulInputWordLen: u32,
pub ulInputSentPos: u32,
pub ulInputSentLen: u32,
pub lBookmarkId: i32,
pub PhonemeId: u16,
pub VisemeId: i32,
pub dwReserved1: u32,
pub dwReserved2: u32,
}import "golang.org/x/sys/windows"
type SPVOICESTATUS struct {
ulCurrentStream uint32
ulLastStreamQueued uint32
hrLastResult int32
dwRunningState uint32
ulInputWordPos uint32
ulInputWordLen uint32
ulInputSentPos uint32
ulInputSentLen uint32
lBookmarkId int32
PhonemeId uint16
VisemeId int32
dwReserved1 uint32
dwReserved2 uint32
}type
SPVOICESTATUS = record
ulCurrentStream: DWORD;
ulLastStreamQueued: DWORD;
hrLastResult: Integer;
dwRunningState: DWORD;
ulInputWordPos: DWORD;
ulInputWordLen: DWORD;
ulInputSentPos: DWORD;
ulInputSentLen: DWORD;
lBookmarkId: Integer;
PhonemeId: Word;
VisemeId: Integer;
dwReserved1: DWORD;
dwReserved2: DWORD;
end;const SPVOICESTATUS = extern struct {
ulCurrentStream: u32,
ulLastStreamQueued: u32,
hrLastResult: i32,
dwRunningState: u32,
ulInputWordPos: u32,
ulInputWordLen: u32,
ulInputSentPos: u32,
ulInputSentLen: u32,
lBookmarkId: i32,
PhonemeId: u16,
VisemeId: i32,
dwReserved1: u32,
dwReserved2: u32,
};type
SPVOICESTATUS {.bycopy.} = object
ulCurrentStream: uint32
ulLastStreamQueued: uint32
hrLastResult: int32
dwRunningState: uint32
ulInputWordPos: uint32
ulInputWordLen: uint32
ulInputSentPos: uint32
ulInputSentLen: uint32
lBookmarkId: int32
PhonemeId: uint16
VisemeId: int32
dwReserved1: uint32
dwReserved2: uint32struct SPVOICESTATUS
{
uint ulCurrentStream;
uint ulLastStreamQueued;
int hrLastResult;
uint dwRunningState;
uint ulInputWordPos;
uint ulInputWordLen;
uint ulInputSentPos;
uint ulInputSentLen;
int lBookmarkId;
ushort PhonemeId;
int VisemeId;
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 レイアウト)
; SPVOICESTATUS サイズ: 52 バイト(x64)
dim st, 13 ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; ulCurrentStream : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; ulLastStreamQueued : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; hrLastResult : HRESULT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwRunningState : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ulInputWordPos : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ulInputWordLen : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ulInputSentPos : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ulInputSentLen : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; lBookmarkId : INT (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; PhonemeId : WORD (+36, 2byte) wpoke st,36,値 / 値 = wpeek(st,36)
; VisemeId : SPVISEMES (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwReserved1 : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; dwReserved2 : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SPVOICESTATUS
#field int ulCurrentStream
#field int ulLastStreamQueued
#field int hrLastResult
#field int dwRunningState
#field int ulInputWordPos
#field int ulInputWordLen
#field int ulInputSentPos
#field int ulInputSentLen
#field int lBookmarkId
#field short PhonemeId
#field int VisemeId
#field int dwReserved1
#field int dwReserved2
#endstruct
stdim st, SPVOICESTATUS ; NSTRUCT 変数を確保
st->ulCurrentStream = 100
mes "ulCurrentStream=" + st->ulCurrentStream