Win32 API 日本語リファレンス
ホームMedia.Audio.DirectMusic › DMUS_VEGPARAMS

DMUS_VEGPARAMS

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

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

フィールド

フィールドサイズx64x86説明
tcAttackINT4+0+0音量エンベロープのアタック時間(タイムセント単位)。
tcDecayINT4+4+4音量エンベロープのディケイ時間(タイムセント単位)。
ptSustainINT4+8+8音量エンベロープのサステインレベル(パーセント)。
tcReleaseINT4+12+12音量エンベロープのリリース時間(タイムセント単位)。
tcVel2AttackINT4+16+16ベロシティによるアタック時間の補正量。
tcKey2DecayINT4+20+20キー位置によるディケイ時間の補正量。

各言語での定義

#include <windows.h>

// DMUS_VEGPARAMS  (x64 24 / x86 24 バイト)
typedef struct DMUS_VEGPARAMS {
    INT tcAttack;
    INT tcDecay;
    INT ptSustain;
    INT tcRelease;
    INT tcVel2Attack;
    INT tcKey2Decay;
} DMUS_VEGPARAMS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DMUS_VEGPARAMS
{
    public int tcAttack;
    public int tcDecay;
    public int ptSustain;
    public int tcRelease;
    public int tcVel2Attack;
    public int tcKey2Decay;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DMUS_VEGPARAMS
    Public tcAttack As Integer
    Public tcDecay As Integer
    Public ptSustain As Integer
    Public tcRelease As Integer
    Public tcVel2Attack As Integer
    Public tcKey2Decay As Integer
End Structure
import ctypes
from ctypes import wintypes

class DMUS_VEGPARAMS(ctypes.Structure):
    _fields_ = [
        ("tcAttack", ctypes.c_int),
        ("tcDecay", ctypes.c_int),
        ("ptSustain", ctypes.c_int),
        ("tcRelease", ctypes.c_int),
        ("tcVel2Attack", ctypes.c_int),
        ("tcKey2Decay", ctypes.c_int),
    ]
#[repr(C)]
pub struct DMUS_VEGPARAMS {
    pub tcAttack: i32,
    pub tcDecay: i32,
    pub ptSustain: i32,
    pub tcRelease: i32,
    pub tcVel2Attack: i32,
    pub tcKey2Decay: i32,
}
import "golang.org/x/sys/windows"

type DMUS_VEGPARAMS struct {
	tcAttack int32
	tcDecay int32
	ptSustain int32
	tcRelease int32
	tcVel2Attack int32
	tcKey2Decay int32
}
type
  DMUS_VEGPARAMS = record
    tcAttack: Integer;
    tcDecay: Integer;
    ptSustain: Integer;
    tcRelease: Integer;
    tcVel2Attack: Integer;
    tcKey2Decay: Integer;
  end;
const DMUS_VEGPARAMS = extern struct {
    tcAttack: i32,
    tcDecay: i32,
    ptSustain: i32,
    tcRelease: i32,
    tcVel2Attack: i32,
    tcKey2Decay: i32,
};
type
  DMUS_VEGPARAMS {.bycopy.} = object
    tcAttack: int32
    tcDecay: int32
    ptSustain: int32
    tcRelease: int32
    tcVel2Attack: int32
    tcKey2Decay: int32
struct DMUS_VEGPARAMS
{
    int tcAttack;
    int tcDecay;
    int ptSustain;
    int tcRelease;
    int tcVel2Attack;
    int tcKey2Decay;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DMUS_VEGPARAMS サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; tcAttack : INT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; tcDecay : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; ptSustain : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; tcRelease : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; tcVel2Attack : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; tcKey2Decay : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DMUS_VEGPARAMS
    #field int tcAttack
    #field int tcDecay
    #field int ptSustain
    #field int tcRelease
    #field int tcVel2Attack
    #field int tcKey2Decay
#endstruct

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