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

DMUS_ARTICPARAMS

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

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

フィールド

フィールドサイズx64x86説明
LFODMUS_LFOPARAMS24+0+0低周波発振器(LFO)のパラメータを保持する。DLSアーティキュレーションのモジュレーション設定。
VolEGDMUS_VEGPARAMS24+24+24音量エンベロープジェネレータ(EG)のパラメータ。アタック・ディケイなどの音量変化を定義する。
PitchEGDMUS_PEGPARAMS28+48+48ピッチエンベロープジェネレータのパラメータ。時間経過に伴う音程変化を定義する。
MiscDMUS_MSCPARAMS4+76+76その他のアーティキュレーション設定をまとめたパラメータ。ピッチベンド範囲などを含む。

各言語での定義

#include <windows.h>

// DMUS_LFOPARAMS  (x64 24 / x86 24 バイト)
typedef struct DMUS_LFOPARAMS {
    INT pcFrequency;
    INT tcDelay;
    INT gcVolumeScale;
    INT pcPitchScale;
    INT gcMWToVolume;
    INT pcMWToPitch;
} DMUS_LFOPARAMS;

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

// 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;

// DMUS_MSCPARAMS  (x64 4 / x86 4 バイト)
typedef struct DMUS_MSCPARAMS {
    INT ptDefaultPan;
} DMUS_MSCPARAMS;

// DMUS_ARTICPARAMS  (x64 80 / x86 80 バイト)
typedef struct DMUS_ARTICPARAMS {
    DMUS_LFOPARAMS LFO;
    DMUS_VEGPARAMS VolEG;
    DMUS_PEGPARAMS PitchEG;
    DMUS_MSCPARAMS Misc;
} DMUS_ARTICPARAMS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DMUS_LFOPARAMS
{
    public int pcFrequency;
    public int tcDelay;
    public int gcVolumeScale;
    public int pcPitchScale;
    public int gcMWToVolume;
    public int pcMWToPitch;
}

[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;
}

[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;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DMUS_MSCPARAMS
{
    public int ptDefaultPan;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DMUS_ARTICPARAMS
{
    public DMUS_LFOPARAMS LFO;
    public DMUS_VEGPARAMS VolEG;
    public DMUS_PEGPARAMS PitchEG;
    public DMUS_MSCPARAMS Misc;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DMUS_LFOPARAMS
    Public pcFrequency As Integer
    Public tcDelay As Integer
    Public gcVolumeScale As Integer
    Public pcPitchScale As Integer
    Public gcMWToVolume As Integer
    Public pcMWToPitch As Integer
End Structure

<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

<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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DMUS_MSCPARAMS
    Public ptDefaultPan As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DMUS_ARTICPARAMS
    Public LFO As DMUS_LFOPARAMS
    Public VolEG As DMUS_VEGPARAMS
    Public PitchEG As DMUS_PEGPARAMS
    Public Misc As DMUS_MSCPARAMS
End Structure
import ctypes
from ctypes import wintypes

class DMUS_LFOPARAMS(ctypes.Structure):
    _fields_ = [
        ("pcFrequency", ctypes.c_int),
        ("tcDelay", ctypes.c_int),
        ("gcVolumeScale", ctypes.c_int),
        ("pcPitchScale", ctypes.c_int),
        ("gcMWToVolume", ctypes.c_int),
        ("pcMWToPitch", ctypes.c_int),
    ]

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),
    ]

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),
    ]

class DMUS_MSCPARAMS(ctypes.Structure):
    _fields_ = [
        ("ptDefaultPan", ctypes.c_int),
    ]

class DMUS_ARTICPARAMS(ctypes.Structure):
    _fields_ = [
        ("LFO", DMUS_LFOPARAMS),
        ("VolEG", DMUS_VEGPARAMS),
        ("PitchEG", DMUS_PEGPARAMS),
        ("Misc", DMUS_MSCPARAMS),
    ]
#[repr(C)]
pub struct DMUS_LFOPARAMS {
    pub pcFrequency: i32,
    pub tcDelay: i32,
    pub gcVolumeScale: i32,
    pub pcPitchScale: i32,
    pub gcMWToVolume: i32,
    pub pcMWToPitch: i32,
}

#[repr(C)]
pub struct DMUS_VEGPARAMS {
    pub tcAttack: i32,
    pub tcDecay: i32,
    pub ptSustain: i32,
    pub tcRelease: i32,
    pub tcVel2Attack: i32,
    pub tcKey2Decay: i32,
}

#[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,
}

#[repr(C)]
pub struct DMUS_MSCPARAMS {
    pub ptDefaultPan: i32,
}

#[repr(C)]
pub struct DMUS_ARTICPARAMS {
    pub LFO: DMUS_LFOPARAMS,
    pub VolEG: DMUS_VEGPARAMS,
    pub PitchEG: DMUS_PEGPARAMS,
    pub Misc: DMUS_MSCPARAMS,
}
import "golang.org/x/sys/windows"

type DMUS_LFOPARAMS struct {
	pcFrequency int32
	tcDelay int32
	gcVolumeScale int32
	pcPitchScale int32
	gcMWToVolume int32
	pcMWToPitch int32
}

type DMUS_VEGPARAMS struct {
	tcAttack int32
	tcDecay int32
	ptSustain int32
	tcRelease int32
	tcVel2Attack int32
	tcKey2Decay int32
}

type DMUS_PEGPARAMS struct {
	tcAttack int32
	tcDecay int32
	ptSustain int32
	tcRelease int32
	tcVel2Attack int32
	tcKey2Decay int32
	pcRange int32
}

type DMUS_MSCPARAMS struct {
	ptDefaultPan int32
}

type DMUS_ARTICPARAMS struct {
	LFO DMUS_LFOPARAMS
	VolEG DMUS_VEGPARAMS
	PitchEG DMUS_PEGPARAMS
	Misc DMUS_MSCPARAMS
}
type
  DMUS_LFOPARAMS = record
    pcFrequency: Integer;
    tcDelay: Integer;
    gcVolumeScale: Integer;
    pcPitchScale: Integer;
    gcMWToVolume: Integer;
    pcMWToPitch: Integer;
  end;

  DMUS_VEGPARAMS = record
    tcAttack: Integer;
    tcDecay: Integer;
    ptSustain: Integer;
    tcRelease: Integer;
    tcVel2Attack: Integer;
    tcKey2Decay: Integer;
  end;

  DMUS_PEGPARAMS = record
    tcAttack: Integer;
    tcDecay: Integer;
    ptSustain: Integer;
    tcRelease: Integer;
    tcVel2Attack: Integer;
    tcKey2Decay: Integer;
    pcRange: Integer;
  end;

  DMUS_MSCPARAMS = record
    ptDefaultPan: Integer;
  end;

  DMUS_ARTICPARAMS = record
    LFO: DMUS_LFOPARAMS;
    VolEG: DMUS_VEGPARAMS;
    PitchEG: DMUS_PEGPARAMS;
    Misc: DMUS_MSCPARAMS;
  end;
const DMUS_LFOPARAMS = extern struct {
    pcFrequency: i32,
    tcDelay: i32,
    gcVolumeScale: i32,
    pcPitchScale: i32,
    gcMWToVolume: i32,
    pcMWToPitch: i32,
};

const DMUS_VEGPARAMS = extern struct {
    tcAttack: i32,
    tcDecay: i32,
    ptSustain: i32,
    tcRelease: i32,
    tcVel2Attack: i32,
    tcKey2Decay: i32,
};

const DMUS_PEGPARAMS = extern struct {
    tcAttack: i32,
    tcDecay: i32,
    ptSustain: i32,
    tcRelease: i32,
    tcVel2Attack: i32,
    tcKey2Decay: i32,
    pcRange: i32,
};

const DMUS_MSCPARAMS = extern struct {
    ptDefaultPan: i32,
};

const DMUS_ARTICPARAMS = extern struct {
    LFO: DMUS_LFOPARAMS,
    VolEG: DMUS_VEGPARAMS,
    PitchEG: DMUS_PEGPARAMS,
    Misc: DMUS_MSCPARAMS,
};
type
  DMUS_LFOPARAMS {.bycopy.} = object
    pcFrequency: int32
    tcDelay: int32
    gcVolumeScale: int32
    pcPitchScale: int32
    gcMWToVolume: int32
    pcMWToPitch: int32

  DMUS_VEGPARAMS {.bycopy.} = object
    tcAttack: int32
    tcDecay: int32
    ptSustain: int32
    tcRelease: int32
    tcVel2Attack: int32
    tcKey2Decay: int32

  DMUS_PEGPARAMS {.bycopy.} = object
    tcAttack: int32
    tcDecay: int32
    ptSustain: int32
    tcRelease: int32
    tcVel2Attack: int32
    tcKey2Decay: int32
    pcRange: int32

  DMUS_MSCPARAMS {.bycopy.} = object
    ptDefaultPan: int32

  DMUS_ARTICPARAMS {.bycopy.} = object
    LFO: DMUS_LFOPARAMS
    VolEG: DMUS_VEGPARAMS
    PitchEG: DMUS_PEGPARAMS
    Misc: DMUS_MSCPARAMS
struct DMUS_LFOPARAMS
{
    int pcFrequency;
    int tcDelay;
    int gcVolumeScale;
    int pcPitchScale;
    int gcMWToVolume;
    int pcMWToPitch;
}

struct DMUS_VEGPARAMS
{
    int tcAttack;
    int tcDecay;
    int ptSustain;
    int tcRelease;
    int tcVel2Attack;
    int tcKey2Decay;
}

struct DMUS_PEGPARAMS
{
    int tcAttack;
    int tcDecay;
    int ptSustain;
    int tcRelease;
    int tcVel2Attack;
    int tcKey2Decay;
    int pcRange;
}

struct DMUS_MSCPARAMS
{
    int ptDefaultPan;
}

struct DMUS_ARTICPARAMS
{
    DMUS_LFOPARAMS LFO;
    DMUS_VEGPARAMS VolEG;
    DMUS_PEGPARAMS PitchEG;
    DMUS_MSCPARAMS Misc;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DMUS_ARTICPARAMS サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; LFO : DMUS_LFOPARAMS (+0, 24byte)  varptr(st)+0 を基点に操作(24byte:入れ子/配列)
; VolEG : DMUS_VEGPARAMS (+24, 24byte)  varptr(st)+24 を基点に操作(24byte:入れ子/配列)
; PitchEG : DMUS_PEGPARAMS (+48, 28byte)  varptr(st)+48 を基点に操作(28byte:入れ子/配列)
; Misc : DMUS_MSCPARAMS (+76, 4byte)  varptr(st)+76 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DMUS_LFOPARAMS
    #field int pcFrequency
    #field int tcDelay
    #field int gcVolumeScale
    #field int pcPitchScale
    #field int gcMWToVolume
    #field int pcMWToPitch
#endstruct

#defstruct global DMUS_VEGPARAMS
    #field int tcAttack
    #field int tcDecay
    #field int ptSustain
    #field int tcRelease
    #field int tcVel2Attack
    #field int tcKey2Decay
#endstruct

#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

#defstruct global DMUS_MSCPARAMS
    #field int ptDefaultPan
#endstruct

#defstruct global DMUS_ARTICPARAMS
    #field DMUS_LFOPARAMS LFO
    #field DMUS_VEGPARAMS VolEG
    #field DMUS_PEGPARAMS PitchEG
    #field DMUS_MSCPARAMS Misc
#endstruct

stdim st, DMUS_ARTICPARAMS        ; NSTRUCT 変数を確保