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

APOInitSystemEffects3

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

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

フィールド

フィールドサイズx64x86説明
APOInitAPOInitBaseStruct20+0+0APOInitBaseStruct 構造体です。
pAPOEndpointPropertiesIPropertyStore*8/4+24+20IPropertyStore オブジェクトへのポインターです。
pServiceProviderIServiceProvider*8/4+32+24IServiceProvider インターフェイスです。
pDeviceCollectionIMMDeviceCollection*8/4+40+28IMMDeviceCollection オブジェクトへのポインターです。pDeviceCollection の最後の項目は、常にオーディオエンドポイントを表す IMMDevice です。
nSoftwareIoDeviceInCollectionDWORD4+48+32APO が初期化の対象としているソフトウェアコネクターを含む DeviceTopology を実装する MMDevice を指定します。この MMDevicepDeviceCollection に含まれています。
nSoftwareIoConnectorIndexDWORD4+52+36DeviceTopology 内の Software_IO コネクターのインデックスを指定します。
AudioProcessingModeGUID16+56+40オーディオグラフの処理モードを指定します。
InitializeForDiscoveryOnlyBOOL4+72+56オーディオシステムが効果の検出のみを目的として APO を初期化するかどうかを示します。

公式ドキュメント

オーディオ処理オブジェクト (APO) の初期化パラメーターを提供します。APOInitSystemEffects2 を拡張し、ログ記録用のサービスプロバイダーを指定できるようにしたものです。

解説(Remarks)

オーディオドライバーに同梱できるオーディオ処理オブジェクト (APO) 用の Windows 11 API の詳細については、Windows 11 APIs for Audio Processing Objects を参照してください。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#include <windows.h>

// APOInitBaseStruct  (x64 20 / x86 20 バイト)
typedef struct APOInitBaseStruct {
    DWORD cbSize;
    GUID clsid;
} APOInitBaseStruct;

// APOInitSystemEffects3  (x64 80 / x86 60 バイト)
typedef struct APOInitSystemEffects3 {
    APOInitBaseStruct APOInit;
    IPropertyStore* pAPOEndpointProperties;
    IServiceProvider* pServiceProvider;
    IMMDeviceCollection* pDeviceCollection;
    DWORD nSoftwareIoDeviceInCollection;
    DWORD nSoftwareIoConnectorIndex;
    GUID AudioProcessingMode;
    BOOL InitializeForDiscoveryOnly;
} APOInitSystemEffects3;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct APOInitBaseStruct
{
    public uint cbSize;
    public Guid clsid;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct APOInitSystemEffects3
{
    public APOInitBaseStruct APOInit;
    public IntPtr pAPOEndpointProperties;
    public IntPtr pServiceProvider;
    public IntPtr pDeviceCollection;
    public uint nSoftwareIoDeviceInCollection;
    public uint nSoftwareIoConnectorIndex;
    public Guid AudioProcessingMode;
    [MarshalAs(UnmanagedType.Bool)] public bool InitializeForDiscoveryOnly;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure APOInitBaseStruct
    Public cbSize As UInteger
    Public clsid As Guid
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure APOInitSystemEffects3
    Public APOInit As APOInitBaseStruct
    Public pAPOEndpointProperties As IntPtr
    Public pServiceProvider As IntPtr
    Public pDeviceCollection As IntPtr
    Public nSoftwareIoDeviceInCollection As UInteger
    Public nSoftwareIoConnectorIndex As UInteger
    Public AudioProcessingMode As Guid
    <MarshalAs(UnmanagedType.Bool)> Public InitializeForDiscoveryOnly As Boolean
End Structure
import ctypes
from ctypes import wintypes

class APOInitBaseStruct(ctypes.Structure):
    _fields_ = [
        ("cbSize", wintypes.DWORD),
        ("clsid", GUID),
    ]

class APOInitSystemEffects3(ctypes.Structure):
    _fields_ = [
        ("APOInit", APOInitBaseStruct),
        ("pAPOEndpointProperties", ctypes.c_void_p),
        ("pServiceProvider", ctypes.c_void_p),
        ("pDeviceCollection", ctypes.c_void_p),
        ("nSoftwareIoDeviceInCollection", wintypes.DWORD),
        ("nSoftwareIoConnectorIndex", wintypes.DWORD),
        ("AudioProcessingMode", GUID),
        ("InitializeForDiscoveryOnly", wintypes.BOOL),
    ]
#[repr(C)]
pub struct APOInitBaseStruct {
    pub cbSize: u32,
    pub clsid: GUID,
}

#[repr(C)]
pub struct APOInitSystemEffects3 {
    pub APOInit: APOInitBaseStruct,
    pub pAPOEndpointProperties: *mut core::ffi::c_void,
    pub pServiceProvider: *mut core::ffi::c_void,
    pub pDeviceCollection: *mut core::ffi::c_void,
    pub nSoftwareIoDeviceInCollection: u32,
    pub nSoftwareIoConnectorIndex: u32,
    pub AudioProcessingMode: GUID,
    pub InitializeForDiscoveryOnly: i32,
}
import "golang.org/x/sys/windows"

type APOInitBaseStruct struct {
	cbSize uint32
	clsid windows.GUID
}

type APOInitSystemEffects3 struct {
	APOInit APOInitBaseStruct
	pAPOEndpointProperties uintptr
	pServiceProvider uintptr
	pDeviceCollection uintptr
	nSoftwareIoDeviceInCollection uint32
	nSoftwareIoConnectorIndex uint32
	AudioProcessingMode windows.GUID
	InitializeForDiscoveryOnly int32
}
type
  APOInitBaseStruct = record
    cbSize: DWORD;
    clsid: TGUID;
  end;

  APOInitSystemEffects3 = record
    APOInit: APOInitBaseStruct;
    pAPOEndpointProperties: Pointer;
    pServiceProvider: Pointer;
    pDeviceCollection: Pointer;
    nSoftwareIoDeviceInCollection: DWORD;
    nSoftwareIoConnectorIndex: DWORD;
    AudioProcessingMode: TGUID;
    InitializeForDiscoveryOnly: BOOL;
  end;
const APOInitBaseStruct = extern struct {
    cbSize: u32,
    clsid: GUID,
};

const APOInitSystemEffects3 = extern struct {
    APOInit: APOInitBaseStruct,
    pAPOEndpointProperties: ?*anyopaque,
    pServiceProvider: ?*anyopaque,
    pDeviceCollection: ?*anyopaque,
    nSoftwareIoDeviceInCollection: u32,
    nSoftwareIoConnectorIndex: u32,
    AudioProcessingMode: GUID,
    InitializeForDiscoveryOnly: i32,
};
type
  APOInitBaseStruct {.bycopy.} = object
    cbSize: uint32
    clsid: GUID

  APOInitSystemEffects3 {.bycopy.} = object
    APOInit: APOInitBaseStruct
    pAPOEndpointProperties: pointer
    pServiceProvider: pointer
    pDeviceCollection: pointer
    nSoftwareIoDeviceInCollection: uint32
    nSoftwareIoConnectorIndex: uint32
    AudioProcessingMode: GUID
    InitializeForDiscoveryOnly: int32
struct APOInitBaseStruct
{
    uint cbSize;
    GUID clsid;
}

struct APOInitSystemEffects3
{
    APOInitBaseStruct APOInit;
    void* pAPOEndpointProperties;
    void* pServiceProvider;
    void* pDeviceCollection;
    uint nSoftwareIoDeviceInCollection;
    uint nSoftwareIoConnectorIndex;
    GUID AudioProcessingMode;
    int InitializeForDiscoveryOnly;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; APOInitSystemEffects3 サイズ: 60 バイト(x86)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; APOInit : APOInitBaseStruct (+0, 20byte)  varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; pAPOEndpointProperties : IPropertyStore* (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; pServiceProvider : IServiceProvider* (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; pDeviceCollection : IMMDeviceCollection* (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; nSoftwareIoDeviceInCollection : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; nSoftwareIoConnectorIndex : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; AudioProcessingMode : GUID (+40, 16byte)  varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; InitializeForDiscoveryOnly : BOOL (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; APOInitSystemEffects3 サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; APOInit : APOInitBaseStruct (+0, 20byte)  varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; pAPOEndpointProperties : IPropertyStore* (+24, 8byte)  qpoke st,24,値 / qpeek(st,24)  ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; pServiceProvider : IServiceProvider* (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; pDeviceCollection : IMMDeviceCollection* (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; nSoftwareIoDeviceInCollection : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; nSoftwareIoConnectorIndex : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; AudioProcessingMode : GUID (+56, 16byte)  varptr(st)+56 を基点に操作(16byte:入れ子/配列)
; InitializeForDiscoveryOnly : BOOL (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
    #field int Data1
    #field short Data2
    #field short Data3
    #field byte Data4 8
#endstruct

#defstruct global APOInitBaseStruct
    #field int cbSize
    #field GUID clsid
#endstruct

#defstruct global APOInitSystemEffects3
    #field APOInitBaseStruct APOInit
    #field intptr pAPOEndpointProperties
    #field intptr pServiceProvider
    #field intptr pDeviceCollection
    #field int nSoftwareIoDeviceInCollection
    #field int nSoftwareIoConnectorIndex
    #field GUID AudioProcessingMode
    #field bool InitializeForDiscoveryOnly
#endstruct

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