Win32 API 日本語リファレンス
ホームMedia.KernelStreaming › KSAUDIOENGINE_VOLUMELEVEL

KSAUDIOENGINE_VOLUMELEVEL

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

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

フィールド

フィールドサイズx64x86説明
TargetVolumeINT4+0+0目標とする音量レベルを示す(固定小数のデシベル値など)。
CurveTypeAUDIO_CURVE_TYPE4+4+4音量変化に用いるカーブ種別を示すAUDIO_CURVE_TYPE列挙値。
CurveDurationULONGLONG8+8+8音量変化に要する時間を100ナノ秒単位で示す。

各言語での定義

#include <windows.h>

// KSAUDIOENGINE_VOLUMELEVEL  (x64 16 / x86 16 バイト)
typedef struct KSAUDIOENGINE_VOLUMELEVEL {
    INT TargetVolume;
    AUDIO_CURVE_TYPE CurveType;
    ULONGLONG CurveDuration;
} KSAUDIOENGINE_VOLUMELEVEL;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSAUDIOENGINE_VOLUMELEVEL
{
    public int TargetVolume;
    public int CurveType;
    public ulong CurveDuration;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSAUDIOENGINE_VOLUMELEVEL
    Public TargetVolume As Integer
    Public CurveType As Integer
    Public CurveDuration As ULong
End Structure
import ctypes
from ctypes import wintypes

class KSAUDIOENGINE_VOLUMELEVEL(ctypes.Structure):
    _fields_ = [
        ("TargetVolume", ctypes.c_int),
        ("CurveType", ctypes.c_int),
        ("CurveDuration", ctypes.c_ulonglong),
    ]
#[repr(C)]
pub struct KSAUDIOENGINE_VOLUMELEVEL {
    pub TargetVolume: i32,
    pub CurveType: i32,
    pub CurveDuration: u64,
}
import "golang.org/x/sys/windows"

type KSAUDIOENGINE_VOLUMELEVEL struct {
	TargetVolume int32
	CurveType int32
	CurveDuration uint64
}
type
  KSAUDIOENGINE_VOLUMELEVEL = record
    TargetVolume: Integer;
    CurveType: Integer;
    CurveDuration: UInt64;
  end;
const KSAUDIOENGINE_VOLUMELEVEL = extern struct {
    TargetVolume: i32,
    CurveType: i32,
    CurveDuration: u64,
};
type
  KSAUDIOENGINE_VOLUMELEVEL {.bycopy.} = object
    TargetVolume: int32
    CurveType: int32
    CurveDuration: uint64
struct KSAUDIOENGINE_VOLUMELEVEL
{
    int TargetVolume;
    int CurveType;
    ulong CurveDuration;
}

HSP用 定義

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

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

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