Win32 API 日本語リファレンス
ホームDevices.HumanInterfaceDevice › DIEFFECT_DX5

DIEFFECT_DX5

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のバイトサイズ。DirectX5世代の版を識別する。
dwFlagsDWORD4+4+4座標系や軸指定方法などを示すフラグ群(DIEFF_*)。
dwDurationDWORD4+8+8エフェクト全体の継続時間をマイクロ秒単位で示す。無限はINFINITE。
dwSamplePeriodDWORD4+12+12再生サンプル周期をマイクロ秒単位で示す。0で既定値。
dwGainDWORD4+16+16エフェクト全体のゲイン(倍率)。0〜10000の範囲。
dwTriggerButtonDWORD4+20+20エフェクトを起動するトリガーボタン番号。なしはDIEB_NOTRIGGER。
dwTriggerRepeatIntervalDWORD4+24+24トリガー押下中の繰り返し間隔をマイクロ秒単位で示す。
cAxesDWORD4+28+28エフェクトが作用する軸の数。
rgdwAxesDWORD*8/4+32+32対象軸のオフセット/種別を並べた配列へのポインター。
rglDirectionINT*8/4+40+36各軸方向の値を並べた配列へのポインター。
lpEnvelopeDIENVELOPE*8/4+48+40適用するエンベロープ構造体へのポインター。不要ならNULL。
cbTypeSpecificParamsDWORD4+56+44エフェクト種別固有パラメーターのバイトサイズ。
lpvTypeSpecificParamsvoid*8/4+64+48エフェクト種別固有パラメーターへのポインター。

各言語での定義

#include <windows.h>

// DIEFFECT_DX5  (x64 72 / x86 52 バイト)
typedef struct DIEFFECT_DX5 {
    DWORD dwSize;
    DWORD dwFlags;
    DWORD dwDuration;
    DWORD dwSamplePeriod;
    DWORD dwGain;
    DWORD dwTriggerButton;
    DWORD dwTriggerRepeatInterval;
    DWORD cAxes;
    DWORD* rgdwAxes;
    INT* rglDirection;
    DIENVELOPE* lpEnvelope;
    DWORD cbTypeSpecificParams;
    void* lpvTypeSpecificParams;
} DIEFFECT_DX5;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DIEFFECT_DX5
{
    public uint dwSize;
    public uint dwFlags;
    public uint dwDuration;
    public uint dwSamplePeriod;
    public uint dwGain;
    public uint dwTriggerButton;
    public uint dwTriggerRepeatInterval;
    public uint cAxes;
    public IntPtr rgdwAxes;
    public IntPtr rglDirection;
    public IntPtr lpEnvelope;
    public uint cbTypeSpecificParams;
    public IntPtr lpvTypeSpecificParams;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DIEFFECT_DX5
    Public dwSize As UInteger
    Public dwFlags As UInteger
    Public dwDuration As UInteger
    Public dwSamplePeriod As UInteger
    Public dwGain As UInteger
    Public dwTriggerButton As UInteger
    Public dwTriggerRepeatInterval As UInteger
    Public cAxes As UInteger
    Public rgdwAxes As IntPtr
    Public rglDirection As IntPtr
    Public lpEnvelope As IntPtr
    Public cbTypeSpecificParams As UInteger
    Public lpvTypeSpecificParams As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DIEFFECT_DX5(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("dwDuration", wintypes.DWORD),
        ("dwSamplePeriod", wintypes.DWORD),
        ("dwGain", wintypes.DWORD),
        ("dwTriggerButton", wintypes.DWORD),
        ("dwTriggerRepeatInterval", wintypes.DWORD),
        ("cAxes", wintypes.DWORD),
        ("rgdwAxes", ctypes.c_void_p),
        ("rglDirection", ctypes.c_void_p),
        ("lpEnvelope", ctypes.c_void_p),
        ("cbTypeSpecificParams", wintypes.DWORD),
        ("lpvTypeSpecificParams", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DIEFFECT_DX5 {
    pub dwSize: u32,
    pub dwFlags: u32,
    pub dwDuration: u32,
    pub dwSamplePeriod: u32,
    pub dwGain: u32,
    pub dwTriggerButton: u32,
    pub dwTriggerRepeatInterval: u32,
    pub cAxes: u32,
    pub rgdwAxes: *mut core::ffi::c_void,
    pub rglDirection: *mut core::ffi::c_void,
    pub lpEnvelope: *mut core::ffi::c_void,
    pub cbTypeSpecificParams: u32,
    pub lpvTypeSpecificParams: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DIEFFECT_DX5 struct {
	dwSize uint32
	dwFlags uint32
	dwDuration uint32
	dwSamplePeriod uint32
	dwGain uint32
	dwTriggerButton uint32
	dwTriggerRepeatInterval uint32
	cAxes uint32
	rgdwAxes uintptr
	rglDirection uintptr
	lpEnvelope uintptr
	cbTypeSpecificParams uint32
	lpvTypeSpecificParams uintptr
}
type
  DIEFFECT_DX5 = record
    dwSize: DWORD;
    dwFlags: DWORD;
    dwDuration: DWORD;
    dwSamplePeriod: DWORD;
    dwGain: DWORD;
    dwTriggerButton: DWORD;
    dwTriggerRepeatInterval: DWORD;
    cAxes: DWORD;
    rgdwAxes: Pointer;
    rglDirection: Pointer;
    lpEnvelope: Pointer;
    cbTypeSpecificParams: DWORD;
    lpvTypeSpecificParams: Pointer;
  end;
const DIEFFECT_DX5 = extern struct {
    dwSize: u32,
    dwFlags: u32,
    dwDuration: u32,
    dwSamplePeriod: u32,
    dwGain: u32,
    dwTriggerButton: u32,
    dwTriggerRepeatInterval: u32,
    cAxes: u32,
    rgdwAxes: ?*anyopaque,
    rglDirection: ?*anyopaque,
    lpEnvelope: ?*anyopaque,
    cbTypeSpecificParams: u32,
    lpvTypeSpecificParams: ?*anyopaque,
};
type
  DIEFFECT_DX5 {.bycopy.} = object
    dwSize: uint32
    dwFlags: uint32
    dwDuration: uint32
    dwSamplePeriod: uint32
    dwGain: uint32
    dwTriggerButton: uint32
    dwTriggerRepeatInterval: uint32
    cAxes: uint32
    rgdwAxes: pointer
    rglDirection: pointer
    lpEnvelope: pointer
    cbTypeSpecificParams: uint32
    lpvTypeSpecificParams: pointer
struct DIEFFECT_DX5
{
    uint dwSize;
    uint dwFlags;
    uint dwDuration;
    uint dwSamplePeriod;
    uint dwGain;
    uint dwTriggerButton;
    uint dwTriggerRepeatInterval;
    uint cAxes;
    void* rgdwAxes;
    void* rglDirection;
    void* lpEnvelope;
    uint cbTypeSpecificParams;
    void* lpvTypeSpecificParams;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DIEFFECT_DX5 サイズ: 52 バイト(x86)
dim st, 13    ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwDuration : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwSamplePeriod : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwGain : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwTriggerButton : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwTriggerRepeatInterval : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; cAxes : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; rgdwAxes : DWORD* (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; rglDirection : INT* (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; lpEnvelope : DIENVELOPE* (+40, 4byte)  varptr(st)+40 を基点に操作(4byte:入れ子/配列)
; cbTypeSpecificParams : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; lpvTypeSpecificParams : void* (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DIEFFECT_DX5 サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwDuration : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwSamplePeriod : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwGain : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwTriggerButton : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwTriggerRepeatInterval : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; cAxes : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; rgdwAxes : DWORD* (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; rglDirection : INT* (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; lpEnvelope : DIENVELOPE* (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; cbTypeSpecificParams : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; lpvTypeSpecificParams : void* (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DIEFFECT_DX5
    #field int dwSize
    #field int dwFlags
    #field int dwDuration
    #field int dwSamplePeriod
    #field int dwGain
    #field int dwTriggerButton
    #field int dwTriggerRepeatInterval
    #field int cAxes
    #field intptr rgdwAxes
    #field intptr rglDirection
    #field intptr lpEnvelope
    #field int cbTypeSpecificParams
    #field intptr lpvTypeSpecificParams
#endstruct

stdim st, DIEFFECT_DX5        ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize