ホーム › Media.Audio.DirectSound › DSFXCompressor
DSFXCompressor
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| fGain | FLOAT | 4 | +0 | +0 | 出力ゲイン(-60〜60dB)。 |
| fAttack | FLOAT | 4 | +4 | +4 | アタック時間(0.01〜500ミリ秒)。圧縮開始までの応答時間。 |
| fRelease | FLOAT | 4 | +8 | +8 | リリース時間(50〜3000ミリ秒)。圧縮解除までの時間。 |
| fThreshold | FLOAT | 4 | +12 | +12 | 圧縮が始まる閾値レベル(-60〜0dB)。 |
| fRatio | FLOAT | 4 | +16 | +16 | 圧縮比(1〜100)。閾値超過分の圧縮率。 |
| fPredelay | FLOAT | 4 | +20 | +20 | プリディレイ時間(0〜4ミリ秒)。圧縮判定の先読み時間。 |
各言語での定義
#include <windows.h>
// DSFXCompressor (x64 24 / x86 24 バイト)
typedef struct DSFXCompressor {
FLOAT fGain;
FLOAT fAttack;
FLOAT fRelease;
FLOAT fThreshold;
FLOAT fRatio;
FLOAT fPredelay;
} DSFXCompressor;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DSFXCompressor
{
public float fGain;
public float fAttack;
public float fRelease;
public float fThreshold;
public float fRatio;
public float fPredelay;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DSFXCompressor
Public fGain As Single
Public fAttack As Single
Public fRelease As Single
Public fThreshold As Single
Public fRatio As Single
Public fPredelay As Single
End Structureimport ctypes
from ctypes import wintypes
class DSFXCompressor(ctypes.Structure):
_fields_ = [
("fGain", ctypes.c_float),
("fAttack", ctypes.c_float),
("fRelease", ctypes.c_float),
("fThreshold", ctypes.c_float),
("fRatio", ctypes.c_float),
("fPredelay", ctypes.c_float),
]#[repr(C)]
pub struct DSFXCompressor {
pub fGain: f32,
pub fAttack: f32,
pub fRelease: f32,
pub fThreshold: f32,
pub fRatio: f32,
pub fPredelay: f32,
}import "golang.org/x/sys/windows"
type DSFXCompressor struct {
fGain float32
fAttack float32
fRelease float32
fThreshold float32
fRatio float32
fPredelay float32
}type
DSFXCompressor = record
fGain: Single;
fAttack: Single;
fRelease: Single;
fThreshold: Single;
fRatio: Single;
fPredelay: Single;
end;const DSFXCompressor = extern struct {
fGain: f32,
fAttack: f32,
fRelease: f32,
fThreshold: f32,
fRatio: f32,
fPredelay: f32,
};type
DSFXCompressor {.bycopy.} = object
fGain: float32
fAttack: float32
fRelease: float32
fThreshold: float32
fRatio: float32
fPredelay: float32struct DSFXCompressor
{
float fGain;
float fAttack;
float fRelease;
float fThreshold;
float fRatio;
float fPredelay;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DSFXCompressor サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; fGain : FLOAT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; fAttack : FLOAT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; fRelease : FLOAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; fThreshold : FLOAT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; fRatio : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; fPredelay : FLOAT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DSFXCompressor
#field float fGain
#field float fAttack
#field float fRelease
#field float fThreshold
#field float fRatio
#field float fPredelay
#endstruct
stdim st, DSFXCompressor ; NSTRUCT 変数を確保
st->fGain = 100
mes "fGain=" + st->fGain