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

APOInitSystemEffects2

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

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

フィールド

フィールドサイズx64x86説明
APOInitAPOInitBaseStruct20+0+0基本の初期化情報を保持するAPOInitBaseStruct。
pAPOEndpointPropertiesIPropertyStore*8/4+24+20エンドポイントプロパティストアへのポインター(IPropertyStore)。
pAPOSystemEffectsPropertiesIPropertyStore*8/4+32+24システムエフェクトプロパティストアへのポインター。
pReservedvoid*8/4+40+28予約フィールド。NULLを設定する。
pDeviceCollectionIMMDeviceCollection*8/4+48+32対象デバイスコレクションへのポインター(IMMDeviceCollection)。
nSoftwareIoDeviceInCollectionDWORD4+56+36コレクション内のソフトウェアI/Oデバイスのインデックス。
nSoftwareIoConnectorIndexDWORD4+60+40ソフトウェアI/Oコネクターのインデックス。
AudioProcessingModeGUID16+64+44オーディオ処理モードを示すGUID(既定・通信・ゲーム等)。
InitializeForDiscoveryOnlyBOOL4+80+60検出目的のみの初期化かを示すBOOL。

各言語での定義

#include <windows.h>

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

// APOInitSystemEffects2  (x64 88 / x86 64 バイト)
typedef struct APOInitSystemEffects2 {
    APOInitBaseStruct APOInit;
    IPropertyStore* pAPOEndpointProperties;
    IPropertyStore* pAPOSystemEffectsProperties;
    void* pReserved;
    IMMDeviceCollection* pDeviceCollection;
    DWORD nSoftwareIoDeviceInCollection;
    DWORD nSoftwareIoConnectorIndex;
    GUID AudioProcessingMode;
    BOOL InitializeForDiscoveryOnly;
} APOInitSystemEffects2;
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 APOInitSystemEffects2
{
    public APOInitBaseStruct APOInit;
    public IntPtr pAPOEndpointProperties;
    public IntPtr pAPOSystemEffectsProperties;
    public IntPtr pReserved;
    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 APOInitSystemEffects2
    Public APOInit As APOInitBaseStruct
    Public pAPOEndpointProperties As IntPtr
    Public pAPOSystemEffectsProperties As IntPtr
    Public pReserved 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 APOInitSystemEffects2(ctypes.Structure):
    _fields_ = [
        ("APOInit", APOInitBaseStruct),
        ("pAPOEndpointProperties", ctypes.c_void_p),
        ("pAPOSystemEffectsProperties", ctypes.c_void_p),
        ("pReserved", 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 APOInitSystemEffects2 {
    pub APOInit: APOInitBaseStruct,
    pub pAPOEndpointProperties: *mut core::ffi::c_void,
    pub pAPOSystemEffectsProperties: *mut core::ffi::c_void,
    pub pReserved: *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 APOInitSystemEffects2 struct {
	APOInit APOInitBaseStruct
	pAPOEndpointProperties uintptr
	pAPOSystemEffectsProperties uintptr
	pReserved uintptr
	pDeviceCollection uintptr
	nSoftwareIoDeviceInCollection uint32
	nSoftwareIoConnectorIndex uint32
	AudioProcessingMode windows.GUID
	InitializeForDiscoveryOnly int32
}
type
  APOInitBaseStruct = record
    cbSize: DWORD;
    clsid: TGUID;
  end;

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

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

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

struct APOInitSystemEffects2
{
    APOInitBaseStruct APOInit;
    void* pAPOEndpointProperties;
    void* pAPOSystemEffectsProperties;
    void* pReserved;
    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 レイアウト)
; APOInitSystemEffects2 サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; APOInit : APOInitBaseStruct (+0, 20byte)  varptr(st)+0 を基点に操作(20byte:入れ子/配列)
; pAPOEndpointProperties : IPropertyStore* (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; pAPOSystemEffectsProperties : IPropertyStore* (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; pReserved : void* (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; pDeviceCollection : IMMDeviceCollection* (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; nSoftwareIoDeviceInCollection : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; nSoftwareIoConnectorIndex : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; AudioProcessingMode : GUID (+44, 16byte)  varptr(st)+44 を基点に操作(16byte:入れ子/配列)
; InitializeForDiscoveryOnly : BOOL (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; APOInitSystemEffects2 サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 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,上位
; pAPOSystemEffectsProperties : IPropertyStore* (+32, 8byte)  qpoke st,32,値 / qpeek(st,32)  ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; pReserved : void* (+40, 8byte)  qpoke st,40,値 / qpeek(st,40)  ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; pDeviceCollection : IMMDeviceCollection* (+48, 8byte)  qpoke st,48,値 / qpeek(st,48)  ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; nSoftwareIoDeviceInCollection : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; nSoftwareIoConnectorIndex : DWORD (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; AudioProcessingMode : GUID (+64, 16byte)  varptr(st)+64 を基点に操作(16byte:入れ子/配列)
; InitializeForDiscoveryOnly : BOOL (+80, 4byte)  st.20 = 値  /  値 = st.20   (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 APOInitSystemEffects2
    #field APOInitBaseStruct APOInit
    #field intptr pAPOEndpointProperties
    #field intptr pAPOSystemEffectsProperties
    #field intptr pReserved
    #field intptr pDeviceCollection
    #field int nSoftwareIoDeviceInCollection
    #field int nSoftwareIoConnectorIndex
    #field GUID AudioProcessingMode
    #field bool InitializeForDiscoveryOnly
#endstruct

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