ホーム › Media.Speech › SPAUDIOSTATUS
SPAUDIOSTATUS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbFreeBuffSpace | INT | 4 | +0 | +0 | 音声バッファの空き容量をバイトで示す。 |
| cbNonBlockingIO | DWORD | 4 | +4 | +4 | ブロックせずに読み書き可能なバイト数。 |
| State | SPAUDIOSTATE | 4 | +8 | +8 | 音声デバイスの現在の状態(SPAUDIOSTATE列挙)。 |
| CurSeekPos | ULONGLONG | 8 | +16 | +16 | 現在のシーク位置をバイトで示す。 |
| CurDevicePos | ULONGLONG | 8 | +24 | +24 | デバイスが現在処理中の位置をバイトで示す。 |
| dwAudioLevel | DWORD | 4 | +32 | +32 | 現在の音声レベル(音量)を示す。 |
| dwReserved2 | DWORD | 4 | +36 | +36 | 予約領域。使用しない。 |
各言語での定義
#include <windows.h>
// SPAUDIOSTATUS (x64 40 / x86 40 バイト)
typedef struct SPAUDIOSTATUS {
INT cbFreeBuffSpace;
DWORD cbNonBlockingIO;
SPAUDIOSTATE State;
ULONGLONG CurSeekPos;
ULONGLONG CurDevicePos;
DWORD dwAudioLevel;
DWORD dwReserved2;
} SPAUDIOSTATUS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SPAUDIOSTATUS
{
public int cbFreeBuffSpace;
public uint cbNonBlockingIO;
public int State;
public ulong CurSeekPos;
public ulong CurDevicePos;
public uint dwAudioLevel;
public uint dwReserved2;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SPAUDIOSTATUS
Public cbFreeBuffSpace As Integer
Public cbNonBlockingIO As UInteger
Public State As Integer
Public CurSeekPos As ULong
Public CurDevicePos As ULong
Public dwAudioLevel As UInteger
Public dwReserved2 As UInteger
End Structureimport ctypes
from ctypes import wintypes
class SPAUDIOSTATUS(ctypes.Structure):
_fields_ = [
("cbFreeBuffSpace", ctypes.c_int),
("cbNonBlockingIO", wintypes.DWORD),
("State", ctypes.c_int),
("CurSeekPos", ctypes.c_ulonglong),
("CurDevicePos", ctypes.c_ulonglong),
("dwAudioLevel", wintypes.DWORD),
("dwReserved2", wintypes.DWORD),
]#[repr(C)]
pub struct SPAUDIOSTATUS {
pub cbFreeBuffSpace: i32,
pub cbNonBlockingIO: u32,
pub State: i32,
pub CurSeekPos: u64,
pub CurDevicePos: u64,
pub dwAudioLevel: u32,
pub dwReserved2: u32,
}import "golang.org/x/sys/windows"
type SPAUDIOSTATUS struct {
cbFreeBuffSpace int32
cbNonBlockingIO uint32
State int32
CurSeekPos uint64
CurDevicePos uint64
dwAudioLevel uint32
dwReserved2 uint32
}type
SPAUDIOSTATUS = record
cbFreeBuffSpace: Integer;
cbNonBlockingIO: DWORD;
State: Integer;
CurSeekPos: UInt64;
CurDevicePos: UInt64;
dwAudioLevel: DWORD;
dwReserved2: DWORD;
end;const SPAUDIOSTATUS = extern struct {
cbFreeBuffSpace: i32,
cbNonBlockingIO: u32,
State: i32,
CurSeekPos: u64,
CurDevicePos: u64,
dwAudioLevel: u32,
dwReserved2: u32,
};type
SPAUDIOSTATUS {.bycopy.} = object
cbFreeBuffSpace: int32
cbNonBlockingIO: uint32
State: int32
CurSeekPos: uint64
CurDevicePos: uint64
dwAudioLevel: uint32
dwReserved2: uint32struct SPAUDIOSTATUS
{
int cbFreeBuffSpace;
uint cbNonBlockingIO;
int State;
ulong CurSeekPos;
ulong CurDevicePos;
uint dwAudioLevel;
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 レイアウト)
; SPAUDIOSTATUS サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; cbFreeBuffSpace : INT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; cbNonBlockingIO : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; State : SPAUDIOSTATE (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; CurSeekPos : ULONGLONG (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; CurDevicePos : ULONGLONG (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; dwAudioLevel : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwReserved2 : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SPAUDIOSTATUS
#field int cbFreeBuffSpace
#field int cbNonBlockingIO
#field int State
#field int64 CurSeekPos
#field int64 CurDevicePos
#field int dwAudioLevel
#field int dwReserved2
#endstruct
stdim st, SPAUDIOSTATUS ; NSTRUCT 変数を確保
st->cbFreeBuffSpace = 100
mes "cbFreeBuffSpace=" + st->cbFreeBuffSpace