ホーム › UI.Input.GameInput › GameInputForceFeedbackPeriodicParams
GameInputForceFeedbackPeriodicParams
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| envelope | GameInputForceFeedbackEnvelope | 48 | +0 | +0 | エフェクトの時間包絡を指定するエンベロープである。 |
| magnitude | GameInputForceFeedbackMagnitude | 28 | +48 | +48 | 周期波形の振幅を指定するマグニチュードである。 |
| frequency | FLOAT | 4 | +76 | +76 | 周期波形の周波数を指定する。 |
| phase | FLOAT | 4 | +80 | +80 | 周期波形の初期位相を指定する。 |
| bias | FLOAT | 4 | +84 | +84 | 波形のオフセット(バイアス)を指定する。 |
各言語での定義
#include <windows.h>
// GameInputForceFeedbackEnvelope (x64 48 / x86 48 バイト)
typedef struct GameInputForceFeedbackEnvelope {
ULONGLONG attackDuration;
ULONGLONG sustainDuration;
ULONGLONG releaseDuration;
FLOAT attackGain;
FLOAT sustainGain;
FLOAT releaseGain;
DWORD playCount;
ULONGLONG repeatDelay;
} GameInputForceFeedbackEnvelope;
// GameInputForceFeedbackMagnitude (x64 28 / x86 28 バイト)
typedef struct GameInputForceFeedbackMagnitude {
FLOAT linearX;
FLOAT linearY;
FLOAT linearZ;
FLOAT angularX;
FLOAT angularY;
FLOAT angularZ;
FLOAT normal;
} GameInputForceFeedbackMagnitude;
// GameInputForceFeedbackPeriodicParams (x64 88 / x86 88 バイト)
typedef struct GameInputForceFeedbackPeriodicParams {
GameInputForceFeedbackEnvelope envelope;
GameInputForceFeedbackMagnitude magnitude;
FLOAT frequency;
FLOAT phase;
FLOAT bias;
} GameInputForceFeedbackPeriodicParams;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputForceFeedbackEnvelope
{
public ulong attackDuration;
public ulong sustainDuration;
public ulong releaseDuration;
public float attackGain;
public float sustainGain;
public float releaseGain;
public uint playCount;
public ulong repeatDelay;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputForceFeedbackMagnitude
{
public float linearX;
public float linearY;
public float linearZ;
public float angularX;
public float angularY;
public float angularZ;
public float normal;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GameInputForceFeedbackPeriodicParams
{
public GameInputForceFeedbackEnvelope envelope;
public GameInputForceFeedbackMagnitude magnitude;
public float frequency;
public float phase;
public float bias;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputForceFeedbackEnvelope
Public attackDuration As ULong
Public sustainDuration As ULong
Public releaseDuration As ULong
Public attackGain As Single
Public sustainGain As Single
Public releaseGain As Single
Public playCount As UInteger
Public repeatDelay As ULong
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputForceFeedbackMagnitude
Public linearX As Single
Public linearY As Single
Public linearZ As Single
Public angularX As Single
Public angularY As Single
Public angularZ As Single
Public normal As Single
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GameInputForceFeedbackPeriodicParams
Public envelope As GameInputForceFeedbackEnvelope
Public magnitude As GameInputForceFeedbackMagnitude
Public frequency As Single
Public phase As Single
Public bias As Single
End Structureimport ctypes
from ctypes import wintypes
class GameInputForceFeedbackEnvelope(ctypes.Structure):
_fields_ = [
("attackDuration", ctypes.c_ulonglong),
("sustainDuration", ctypes.c_ulonglong),
("releaseDuration", ctypes.c_ulonglong),
("attackGain", ctypes.c_float),
("sustainGain", ctypes.c_float),
("releaseGain", ctypes.c_float),
("playCount", wintypes.DWORD),
("repeatDelay", ctypes.c_ulonglong),
]
class GameInputForceFeedbackMagnitude(ctypes.Structure):
_fields_ = [
("linearX", ctypes.c_float),
("linearY", ctypes.c_float),
("linearZ", ctypes.c_float),
("angularX", ctypes.c_float),
("angularY", ctypes.c_float),
("angularZ", ctypes.c_float),
("normal", ctypes.c_float),
]
class GameInputForceFeedbackPeriodicParams(ctypes.Structure):
_fields_ = [
("envelope", GameInputForceFeedbackEnvelope),
("magnitude", GameInputForceFeedbackMagnitude),
("frequency", ctypes.c_float),
("phase", ctypes.c_float),
("bias", ctypes.c_float),
]#[repr(C)]
pub struct GameInputForceFeedbackEnvelope {
pub attackDuration: u64,
pub sustainDuration: u64,
pub releaseDuration: u64,
pub attackGain: f32,
pub sustainGain: f32,
pub releaseGain: f32,
pub playCount: u32,
pub repeatDelay: u64,
}
#[repr(C)]
pub struct GameInputForceFeedbackMagnitude {
pub linearX: f32,
pub linearY: f32,
pub linearZ: f32,
pub angularX: f32,
pub angularY: f32,
pub angularZ: f32,
pub normal: f32,
}
#[repr(C)]
pub struct GameInputForceFeedbackPeriodicParams {
pub envelope: GameInputForceFeedbackEnvelope,
pub magnitude: GameInputForceFeedbackMagnitude,
pub frequency: f32,
pub phase: f32,
pub bias: f32,
}import "golang.org/x/sys/windows"
type GameInputForceFeedbackEnvelope struct {
attackDuration uint64
sustainDuration uint64
releaseDuration uint64
attackGain float32
sustainGain float32
releaseGain float32
playCount uint32
repeatDelay uint64
}
type GameInputForceFeedbackMagnitude struct {
linearX float32
linearY float32
linearZ float32
angularX float32
angularY float32
angularZ float32
normal float32
}
type GameInputForceFeedbackPeriodicParams struct {
envelope GameInputForceFeedbackEnvelope
magnitude GameInputForceFeedbackMagnitude
frequency float32
phase float32
bias float32
}type
GameInputForceFeedbackEnvelope = record
attackDuration: UInt64;
sustainDuration: UInt64;
releaseDuration: UInt64;
attackGain: Single;
sustainGain: Single;
releaseGain: Single;
playCount: DWORD;
repeatDelay: UInt64;
end;
GameInputForceFeedbackMagnitude = record
linearX: Single;
linearY: Single;
linearZ: Single;
angularX: Single;
angularY: Single;
angularZ: Single;
normal: Single;
end;
GameInputForceFeedbackPeriodicParams = record
envelope: GameInputForceFeedbackEnvelope;
magnitude: GameInputForceFeedbackMagnitude;
frequency: Single;
phase: Single;
bias: Single;
end;const GameInputForceFeedbackEnvelope = extern struct {
attackDuration: u64,
sustainDuration: u64,
releaseDuration: u64,
attackGain: f32,
sustainGain: f32,
releaseGain: f32,
playCount: u32,
repeatDelay: u64,
};
const GameInputForceFeedbackMagnitude = extern struct {
linearX: f32,
linearY: f32,
linearZ: f32,
angularX: f32,
angularY: f32,
angularZ: f32,
normal: f32,
};
const GameInputForceFeedbackPeriodicParams = extern struct {
envelope: GameInputForceFeedbackEnvelope,
magnitude: GameInputForceFeedbackMagnitude,
frequency: f32,
phase: f32,
bias: f32,
};type
GameInputForceFeedbackEnvelope {.bycopy.} = object
attackDuration: uint64
sustainDuration: uint64
releaseDuration: uint64
attackGain: float32
sustainGain: float32
releaseGain: float32
playCount: uint32
repeatDelay: uint64
GameInputForceFeedbackMagnitude {.bycopy.} = object
linearX: float32
linearY: float32
linearZ: float32
angularX: float32
angularY: float32
angularZ: float32
normal: float32
GameInputForceFeedbackPeriodicParams {.bycopy.} = object
envelope: GameInputForceFeedbackEnvelope
magnitude: GameInputForceFeedbackMagnitude
frequency: float32
phase: float32
bias: float32struct GameInputForceFeedbackEnvelope
{
ulong attackDuration;
ulong sustainDuration;
ulong releaseDuration;
float attackGain;
float sustainGain;
float releaseGain;
uint playCount;
ulong repeatDelay;
}
struct GameInputForceFeedbackMagnitude
{
float linearX;
float linearY;
float linearZ;
float angularX;
float angularY;
float angularZ;
float normal;
}
struct GameInputForceFeedbackPeriodicParams
{
GameInputForceFeedbackEnvelope envelope;
GameInputForceFeedbackMagnitude magnitude;
float frequency;
float phase;
float bias;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GameInputForceFeedbackPeriodicParams サイズ: 88 バイト(x64)
dim st, 22 ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; envelope : GameInputForceFeedbackEnvelope (+0, 48byte) varptr(st)+0 を基点に操作(48byte:入れ子/配列)
; magnitude : GameInputForceFeedbackMagnitude (+48, 28byte) varptr(st)+48 を基点に操作(28byte:入れ子/配列)
; frequency : FLOAT (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; phase : FLOAT (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; bias : FLOAT (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GameInputForceFeedbackEnvelope
#field int64 attackDuration
#field int64 sustainDuration
#field int64 releaseDuration
#field float attackGain
#field float sustainGain
#field float releaseGain
#field int playCount
#field int64 repeatDelay
#endstruct
#defstruct global GameInputForceFeedbackMagnitude
#field float linearX
#field float linearY
#field float linearZ
#field float angularX
#field float angularY
#field float angularZ
#field float normal
#endstruct
#defstruct global GameInputForceFeedbackPeriodicParams
#field GameInputForceFeedbackEnvelope envelope
#field GameInputForceFeedbackMagnitude magnitude
#field float frequency
#field float phase
#field float bias
#endstruct
stdim st, GameInputForceFeedbackPeriodicParams ; NSTRUCT 変数を確保
st->frequency = 100
mes "frequency=" + st->frequency