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

SPVOICESTATUS

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

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

フィールド

フィールドサイズx64x86説明
ulCurrentStreamDWORD4+0+0現在再生中のストリーム番号。
ulLastStreamQueuedDWORD4+4+4最後にキューへ投入されたストリーム番号。
hrLastResultHRESULT4+8+8直近の処理結果を示すHRESULT。
dwRunningStateDWORD4+12+12音声合成エンジンの動作状態フラグ(SPRS_DONE/IS_SPEAKING)。
ulInputWordPosDWORD4+16+16入力テキスト内で発話中の単語の開始文字位置。
ulInputWordLenDWORD4+20+20発話中の単語の文字数。
ulInputSentPosDWORD4+24+24入力テキスト内で発話中の文の開始文字位置。
ulInputSentLenDWORD4+28+28発話中の文の文字数。
lBookmarkIdINT4+32+32直近に到達したブックマークのID。
PhonemeIdWORD2+36+36現在発話中の音素ID。
VisemeIdSPVISEMES4+40+40現在の口形素(ビゼーム)ID(SPVISEMES)。
dwReserved1DWORD4+44+44予約領域。使用しない。
dwReserved2DWORD4+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 Structure
import 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: uint32
struct 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