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

DMUS_PEGPARAMS

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

サイズ=各フィールドのバイト数(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キー位置によるディケイ時間の補正量。
pcRangeINT4+24+24ピッチエンベロープの変調範囲(ピッチセント単位)。

各言語での定義

#include <windows.h>

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

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

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

class DMUS_PEGPARAMS(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),
        ("pcRange", ctypes.c_int),
    ]
#[repr(C)]
pub struct DMUS_PEGPARAMS {
    pub tcAttack: i32,
    pub tcDecay: i32,
    pub ptSustain: i32,
    pub tcRelease: i32,
    pub tcVel2Attack: i32,
    pub tcKey2Decay: i32,
    pub pcRange: i32,
}
import "golang.org/x/sys/windows"

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

HSP用 定義

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

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

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