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

XAUDIO2_PERFORMANCE_DATA

構造体
サイズx64: 64 バイト / x86: 64 バイトパッキング1

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

フィールド

フィールドサイズx64x86説明
AudioCyclesSinceLastQueryULONGLONG8+0+0前回問い合わせ以降にオーディオ処理に使ったCPUサイクル数を示す。
TotalCyclesSinceLastQueryULONGLONG8+8+8前回問い合わせ以降の総CPUサイクル数を示す。
MinimumCyclesPerQuantumDWORD4+16+161量子あたりの最小CPUサイクル数を示す。
MaximumCyclesPerQuantumDWORD4+20+201量子あたりの最大CPUサイクル数を示す。
MemoryUsageInBytesDWORD4+24+24XAudio2が使用しているメモリ量をバイト単位で示す。
CurrentLatencyInSamplesDWORD4+28+28現在の処理レイテンシーをサンプル数で示す。
GlitchesSinceEngineStartedDWORD4+32+32エンジン開始以降に発生したオーディオグリッチの回数を示す。
ActiveSourceVoiceCountDWORD4+36+36現在アクティブなソースボイスの数を示す。
TotalSourceVoiceCountDWORD4+40+40作成された全ソースボイスの数を示す。
ActiveSubmixVoiceCountDWORD4+44+44現在アクティブなサブミックスボイスの数を示す。
ActiveResamplerCountDWORD4+48+48現在アクティブなリサンプラーの数を示す。
ActiveMatrixMixCountDWORD4+52+52現在アクティブなマトリックスミックスの数を示す。
ActiveXmaSourceVoicesDWORD4+56+56現在アクティブなXMAソースボイスの数を示す。
ActiveXmaStreamsDWORD4+60+60現在アクティブなXMAストリームの数を示す。

各言語での定義

#include <windows.h>

// XAUDIO2_PERFORMANCE_DATA  (x64 64 / x86 64 バイト)
#pragma pack(push, 1)
typedef struct XAUDIO2_PERFORMANCE_DATA {
    ULONGLONG AudioCyclesSinceLastQuery;
    ULONGLONG TotalCyclesSinceLastQuery;
    DWORD MinimumCyclesPerQuantum;
    DWORD MaximumCyclesPerQuantum;
    DWORD MemoryUsageInBytes;
    DWORD CurrentLatencyInSamples;
    DWORD GlitchesSinceEngineStarted;
    DWORD ActiveSourceVoiceCount;
    DWORD TotalSourceVoiceCount;
    DWORD ActiveSubmixVoiceCount;
    DWORD ActiveResamplerCount;
    DWORD ActiveMatrixMixCount;
    DWORD ActiveXmaSourceVoices;
    DWORD ActiveXmaStreams;
} XAUDIO2_PERFORMANCE_DATA;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct XAUDIO2_PERFORMANCE_DATA
{
    public ulong AudioCyclesSinceLastQuery;
    public ulong TotalCyclesSinceLastQuery;
    public uint MinimumCyclesPerQuantum;
    public uint MaximumCyclesPerQuantum;
    public uint MemoryUsageInBytes;
    public uint CurrentLatencyInSamples;
    public uint GlitchesSinceEngineStarted;
    public uint ActiveSourceVoiceCount;
    public uint TotalSourceVoiceCount;
    public uint ActiveSubmixVoiceCount;
    public uint ActiveResamplerCount;
    public uint ActiveMatrixMixCount;
    public uint ActiveXmaSourceVoices;
    public uint ActiveXmaStreams;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure XAUDIO2_PERFORMANCE_DATA
    Public AudioCyclesSinceLastQuery As ULong
    Public TotalCyclesSinceLastQuery As ULong
    Public MinimumCyclesPerQuantum As UInteger
    Public MaximumCyclesPerQuantum As UInteger
    Public MemoryUsageInBytes As UInteger
    Public CurrentLatencyInSamples As UInteger
    Public GlitchesSinceEngineStarted As UInteger
    Public ActiveSourceVoiceCount As UInteger
    Public TotalSourceVoiceCount As UInteger
    Public ActiveSubmixVoiceCount As UInteger
    Public ActiveResamplerCount As UInteger
    Public ActiveMatrixMixCount As UInteger
    Public ActiveXmaSourceVoices As UInteger
    Public ActiveXmaStreams As UInteger
End Structure
import ctypes
from ctypes import wintypes

class XAUDIO2_PERFORMANCE_DATA(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("AudioCyclesSinceLastQuery", ctypes.c_ulonglong),
        ("TotalCyclesSinceLastQuery", ctypes.c_ulonglong),
        ("MinimumCyclesPerQuantum", wintypes.DWORD),
        ("MaximumCyclesPerQuantum", wintypes.DWORD),
        ("MemoryUsageInBytes", wintypes.DWORD),
        ("CurrentLatencyInSamples", wintypes.DWORD),
        ("GlitchesSinceEngineStarted", wintypes.DWORD),
        ("ActiveSourceVoiceCount", wintypes.DWORD),
        ("TotalSourceVoiceCount", wintypes.DWORD),
        ("ActiveSubmixVoiceCount", wintypes.DWORD),
        ("ActiveResamplerCount", wintypes.DWORD),
        ("ActiveMatrixMixCount", wintypes.DWORD),
        ("ActiveXmaSourceVoices", wintypes.DWORD),
        ("ActiveXmaStreams", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct XAUDIO2_PERFORMANCE_DATA {
    pub AudioCyclesSinceLastQuery: u64,
    pub TotalCyclesSinceLastQuery: u64,
    pub MinimumCyclesPerQuantum: u32,
    pub MaximumCyclesPerQuantum: u32,
    pub MemoryUsageInBytes: u32,
    pub CurrentLatencyInSamples: u32,
    pub GlitchesSinceEngineStarted: u32,
    pub ActiveSourceVoiceCount: u32,
    pub TotalSourceVoiceCount: u32,
    pub ActiveSubmixVoiceCount: u32,
    pub ActiveResamplerCount: u32,
    pub ActiveMatrixMixCount: u32,
    pub ActiveXmaSourceVoices: u32,
    pub ActiveXmaStreams: u32,
}
import "golang.org/x/sys/windows"

type XAUDIO2_PERFORMANCE_DATA struct {
	AudioCyclesSinceLastQuery uint64
	TotalCyclesSinceLastQuery uint64
	MinimumCyclesPerQuantum uint32
	MaximumCyclesPerQuantum uint32
	MemoryUsageInBytes uint32
	CurrentLatencyInSamples uint32
	GlitchesSinceEngineStarted uint32
	ActiveSourceVoiceCount uint32
	TotalSourceVoiceCount uint32
	ActiveSubmixVoiceCount uint32
	ActiveResamplerCount uint32
	ActiveMatrixMixCount uint32
	ActiveXmaSourceVoices uint32
	ActiveXmaStreams uint32
}
type
  XAUDIO2_PERFORMANCE_DATA = packed record
    AudioCyclesSinceLastQuery: UInt64;
    TotalCyclesSinceLastQuery: UInt64;
    MinimumCyclesPerQuantum: DWORD;
    MaximumCyclesPerQuantum: DWORD;
    MemoryUsageInBytes: DWORD;
    CurrentLatencyInSamples: DWORD;
    GlitchesSinceEngineStarted: DWORD;
    ActiveSourceVoiceCount: DWORD;
    TotalSourceVoiceCount: DWORD;
    ActiveSubmixVoiceCount: DWORD;
    ActiveResamplerCount: DWORD;
    ActiveMatrixMixCount: DWORD;
    ActiveXmaSourceVoices: DWORD;
    ActiveXmaStreams: DWORD;
  end;
const XAUDIO2_PERFORMANCE_DATA = extern struct {
    AudioCyclesSinceLastQuery: u64,
    TotalCyclesSinceLastQuery: u64,
    MinimumCyclesPerQuantum: u32,
    MaximumCyclesPerQuantum: u32,
    MemoryUsageInBytes: u32,
    CurrentLatencyInSamples: u32,
    GlitchesSinceEngineStarted: u32,
    ActiveSourceVoiceCount: u32,
    TotalSourceVoiceCount: u32,
    ActiveSubmixVoiceCount: u32,
    ActiveResamplerCount: u32,
    ActiveMatrixMixCount: u32,
    ActiveXmaSourceVoices: u32,
    ActiveXmaStreams: u32,
};
type
  XAUDIO2_PERFORMANCE_DATA {.packed.} = object
    AudioCyclesSinceLastQuery: uint64
    TotalCyclesSinceLastQuery: uint64
    MinimumCyclesPerQuantum: uint32
    MaximumCyclesPerQuantum: uint32
    MemoryUsageInBytes: uint32
    CurrentLatencyInSamples: uint32
    GlitchesSinceEngineStarted: uint32
    ActiveSourceVoiceCount: uint32
    TotalSourceVoiceCount: uint32
    ActiveSubmixVoiceCount: uint32
    ActiveResamplerCount: uint32
    ActiveMatrixMixCount: uint32
    ActiveXmaSourceVoices: uint32
    ActiveXmaStreams: uint32
align(1)
struct XAUDIO2_PERFORMANCE_DATA
{
    ulong AudioCyclesSinceLastQuery;
    ulong TotalCyclesSinceLastQuery;
    uint MinimumCyclesPerQuantum;
    uint MaximumCyclesPerQuantum;
    uint MemoryUsageInBytes;
    uint CurrentLatencyInSamples;
    uint GlitchesSinceEngineStarted;
    uint ActiveSourceVoiceCount;
    uint TotalSourceVoiceCount;
    uint ActiveSubmixVoiceCount;
    uint ActiveResamplerCount;
    uint ActiveMatrixMixCount;
    uint ActiveXmaSourceVoices;
    uint ActiveXmaStreams;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; XAUDIO2_PERFORMANCE_DATA サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; AudioCyclesSinceLastQuery : ULONGLONG (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; TotalCyclesSinceLastQuery : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; MinimumCyclesPerQuantum : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; MaximumCyclesPerQuantum : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; MemoryUsageInBytes : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; CurrentLatencyInSamples : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; GlitchesSinceEngineStarted : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; ActiveSourceVoiceCount : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; TotalSourceVoiceCount : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; ActiveSubmixVoiceCount : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ActiveResamplerCount : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; ActiveMatrixMixCount : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ActiveXmaSourceVoices : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ActiveXmaStreams : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global XAUDIO2_PERFORMANCE_DATA, pack=1
    #field int64 AudioCyclesSinceLastQuery
    #field int64 TotalCyclesSinceLastQuery
    #field int MinimumCyclesPerQuantum
    #field int MaximumCyclesPerQuantum
    #field int MemoryUsageInBytes
    #field int CurrentLatencyInSamples
    #field int GlitchesSinceEngineStarted
    #field int ActiveSourceVoiceCount
    #field int TotalSourceVoiceCount
    #field int ActiveSubmixVoiceCount
    #field int ActiveResamplerCount
    #field int ActiveMatrixMixCount
    #field int ActiveXmaSourceVoices
    #field int ActiveXmaStreams
#endstruct

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