ホーム › Media.Audio.XAudio2 › HrtfDistanceDecay
HrtfDistanceDecay
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| type | HrtfDistanceDecayType | 4 | +0 | +0 | 減衰動作の種類です (自然またはカスタム)。 |
| maxGain | FLOAT | 4 | +4 | +4 | 任意の距離で適用されるゲインの上限です。自然減衰とカスタム減衰の両方に適用されます。この値は dB 単位で指定し、範囲は -96 から 12 まで (両端を含む) です。既定値は 12 dB です。 |
| minGain | FLOAT | 4 | +8 | +8 | 任意の距離で適用されるゲインの下限です。自然減衰とカスタム減衰の両方に適用されます。この値は dB 単位で指定し、範囲は -96 から 12 まで (両端を含む) です。既定値は -96 dB です。 |
| unityGainDistance | FLOAT | 4 | +12 | +12 | ゲインが 0dB になる距離です。自然減衰にのみ適用されます。この値はメートル単位で指定し、範囲は 0.05 から無限大 (FLT_MAX) までです。既定値は 1 メートルです。 |
| cutoffDistance | FLOAT | 4 | +16 | +16 | 出力が無音になる距離です。自然減衰にのみ適用されます。この値はメートル単位で指定し、範囲は 0 (0 は含まない) から無限大 (FLT_MAX) までです。既定値は無限大です。 |
公式ドキュメント
距離に基づく減衰の動作を記述します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// HrtfDistanceDecay (x64 20 / x86 20 バイト)
typedef struct HrtfDistanceDecay {
HrtfDistanceDecayType type;
FLOAT maxGain;
FLOAT minGain;
FLOAT unityGainDistance;
FLOAT cutoffDistance;
} HrtfDistanceDecay;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HrtfDistanceDecay
{
public int type;
public float maxGain;
public float minGain;
public float unityGainDistance;
public float cutoffDistance;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HrtfDistanceDecay
Public type As Integer
Public maxGain As Single
Public minGain As Single
Public unityGainDistance As Single
Public cutoffDistance As Single
End Structureimport ctypes
from ctypes import wintypes
class HrtfDistanceDecay(ctypes.Structure):
_fields_ = [
("type", ctypes.c_int),
("maxGain", ctypes.c_float),
("minGain", ctypes.c_float),
("unityGainDistance", ctypes.c_float),
("cutoffDistance", ctypes.c_float),
]#[repr(C)]
pub struct HrtfDistanceDecay {
pub type: i32,
pub maxGain: f32,
pub minGain: f32,
pub unityGainDistance: f32,
pub cutoffDistance: f32,
}import "golang.org/x/sys/windows"
type HrtfDistanceDecay struct {
type int32
maxGain float32
minGain float32
unityGainDistance float32
cutoffDistance float32
}type
HrtfDistanceDecay = record
type: Integer;
maxGain: Single;
minGain: Single;
unityGainDistance: Single;
cutoffDistance: Single;
end;const HrtfDistanceDecay = extern struct {
type: i32,
maxGain: f32,
minGain: f32,
unityGainDistance: f32,
cutoffDistance: f32,
};type
HrtfDistanceDecay {.bycopy.} = object
type: int32
maxGain: float32
minGain: float32
unityGainDistance: float32
cutoffDistance: float32struct HrtfDistanceDecay
{
int type;
float maxGain;
float minGain;
float unityGainDistance;
float cutoffDistance;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; HrtfDistanceDecay サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; type : HrtfDistanceDecayType (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; maxGain : FLOAT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; minGain : FLOAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; unityGainDistance : FLOAT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; cutoffDistance : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global HrtfDistanceDecay
#field int type
#field float maxGain
#field float minGain
#field float unityGainDistance
#field float cutoffDistance
#endstruct
stdim st, HrtfDistanceDecay ; NSTRUCT 変数を確保
st->type = 100
mes "type=" + st->type