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

DMUS_SYNTHSTATS

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0この構造体のバイトサイズ。呼び出し前に設定する。
dwValidStatsDWORD4+4+4有効な統計メンバを示すビットフラグ(DMUS_SYNTHSTATS_*)。
dwVoicesDWORD4+8+8現在発音中のボイス数。
dwTotalCPUDWORD4+12+12シンセが使用しているCPU負荷の総量(パーセント×100)。
dwCPUPerVoiceDWORD4+16+161ボイスあたりのCPU負荷(パーセント×100)。
dwLostNotesDWORD4+20+20発音できず破棄されたノート数。
dwFreeMemoryDWORD4+24+24利用可能なメモリのバイト量。
lPeakVolumeINT4+28+28ピーク音量レベル(符号付き、デシベル相当)。

各言語での定義

#include <windows.h>

// DMUS_SYNTHSTATS  (x64 32 / x86 32 バイト)
typedef struct DMUS_SYNTHSTATS {
    DWORD dwSize;
    DWORD dwValidStats;
    DWORD dwVoices;
    DWORD dwTotalCPU;
    DWORD dwCPUPerVoice;
    DWORD dwLostNotes;
    DWORD dwFreeMemory;
    INT lPeakVolume;
} DMUS_SYNTHSTATS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DMUS_SYNTHSTATS
{
    public uint dwSize;
    public uint dwValidStats;
    public uint dwVoices;
    public uint dwTotalCPU;
    public uint dwCPUPerVoice;
    public uint dwLostNotes;
    public uint dwFreeMemory;
    public int lPeakVolume;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DMUS_SYNTHSTATS
    Public dwSize As UInteger
    Public dwValidStats As UInteger
    Public dwVoices As UInteger
    Public dwTotalCPU As UInteger
    Public dwCPUPerVoice As UInteger
    Public dwLostNotes As UInteger
    Public dwFreeMemory As UInteger
    Public lPeakVolume As Integer
End Structure
import ctypes
from ctypes import wintypes

class DMUS_SYNTHSTATS(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwValidStats", wintypes.DWORD),
        ("dwVoices", wintypes.DWORD),
        ("dwTotalCPU", wintypes.DWORD),
        ("dwCPUPerVoice", wintypes.DWORD),
        ("dwLostNotes", wintypes.DWORD),
        ("dwFreeMemory", wintypes.DWORD),
        ("lPeakVolume", ctypes.c_int),
    ]
#[repr(C)]
pub struct DMUS_SYNTHSTATS {
    pub dwSize: u32,
    pub dwValidStats: u32,
    pub dwVoices: u32,
    pub dwTotalCPU: u32,
    pub dwCPUPerVoice: u32,
    pub dwLostNotes: u32,
    pub dwFreeMemory: u32,
    pub lPeakVolume: i32,
}
import "golang.org/x/sys/windows"

type DMUS_SYNTHSTATS struct {
	dwSize uint32
	dwValidStats uint32
	dwVoices uint32
	dwTotalCPU uint32
	dwCPUPerVoice uint32
	dwLostNotes uint32
	dwFreeMemory uint32
	lPeakVolume int32
}
type
  DMUS_SYNTHSTATS = record
    dwSize: DWORD;
    dwValidStats: DWORD;
    dwVoices: DWORD;
    dwTotalCPU: DWORD;
    dwCPUPerVoice: DWORD;
    dwLostNotes: DWORD;
    dwFreeMemory: DWORD;
    lPeakVolume: Integer;
  end;
const DMUS_SYNTHSTATS = extern struct {
    dwSize: u32,
    dwValidStats: u32,
    dwVoices: u32,
    dwTotalCPU: u32,
    dwCPUPerVoice: u32,
    dwLostNotes: u32,
    dwFreeMemory: u32,
    lPeakVolume: i32,
};
type
  DMUS_SYNTHSTATS {.bycopy.} = object
    dwSize: uint32
    dwValidStats: uint32
    dwVoices: uint32
    dwTotalCPU: uint32
    dwCPUPerVoice: uint32
    dwLostNotes: uint32
    dwFreeMemory: uint32
    lPeakVolume: int32
struct DMUS_SYNTHSTATS
{
    uint dwSize;
    uint dwValidStats;
    uint dwVoices;
    uint dwTotalCPU;
    uint dwCPUPerVoice;
    uint dwLostNotes;
    uint dwFreeMemory;
    int lPeakVolume;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DMUS_SYNTHSTATS サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwValidStats : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwVoices : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwTotalCPU : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; dwCPUPerVoice : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; dwLostNotes : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; dwFreeMemory : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; lPeakVolume : INT (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DMUS_SYNTHSTATS
    #field int dwSize
    #field int dwValidStats
    #field int dwVoices
    #field int dwTotalCPU
    #field int dwCPUPerVoice
    #field int dwLostNotes
    #field int dwFreeMemory
    #field int lPeakVolume
#endstruct

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