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

AcousticEchoCanceller_Reference_Input

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

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

フィールド

フィールドサイズx64x86説明
apoInitSystemEffectsAPOInitSystemEffects380/60+0+0エコーキャンセラーAPOの初期化情報を保持するAPOInitSystemEffects3。
streamPropertiesAPO_REFERENCE_STREAM_PROPERTIES4+80+60参照入力ストリームのプロパティを保持するAPO_REFERENCE_STREAM_PROPERTIES。

各言語での定義

#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;

// AcousticEchoCanceller_Reference_Input  (x64 88 / x86 64 バイト)
typedef struct AcousticEchoCanceller_Reference_Input {
    APOInitSystemEffects3 apoInitSystemEffects;
    APO_REFERENCE_STREAM_PROPERTIES streamProperties;
} AcousticEchoCanceller_Reference_Input;
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;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AcousticEchoCanceller_Reference_Input
{
    public APOInitSystemEffects3 apoInitSystemEffects;
    public int streamProperties;
}
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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AcousticEchoCanceller_Reference_Input
    Public apoInitSystemEffects As APOInitSystemEffects3
    Public streamProperties As Integer
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),
    ]

class AcousticEchoCanceller_Reference_Input(ctypes.Structure):
    _fields_ = [
        ("apoInitSystemEffects", APOInitSystemEffects3),
        ("streamProperties", ctypes.c_int),
    ]
#[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,
}

#[repr(C)]
pub struct AcousticEchoCanceller_Reference_Input {
    pub apoInitSystemEffects: APOInitSystemEffects3,
    pub streamProperties: 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 AcousticEchoCanceller_Reference_Input struct {
	apoInitSystemEffects APOInitSystemEffects3
	streamProperties 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;

  AcousticEchoCanceller_Reference_Input = record
    apoInitSystemEffects: APOInitSystemEffects3;
    streamProperties: Integer;
  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,
};

const AcousticEchoCanceller_Reference_Input = extern struct {
    apoInitSystemEffects: APOInitSystemEffects3,
    streamProperties: 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

  AcousticEchoCanceller_Reference_Input {.bycopy.} = object
    apoInitSystemEffects: APOInitSystemEffects3
    streamProperties: 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;
}

struct AcousticEchoCanceller_Reference_Input
{
    APOInitSystemEffects3 apoInitSystemEffects;
    int streamProperties;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; AcousticEchoCanceller_Reference_Input サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; apoInitSystemEffects : APOInitSystemEffects3 (+0, 60byte)  varptr(st)+0 を基点に操作(60byte:入れ子/配列)
; streamProperties : APO_REFERENCE_STREAM_PROPERTIES (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; AcousticEchoCanceller_Reference_Input サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; apoInitSystemEffects : APOInitSystemEffects3 (+0, 80byte)  varptr(st)+0 を基点に操作(80byte:入れ子/配列)
; streamProperties : APO_REFERENCE_STREAM_PROPERTIES (+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 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

#defstruct global AcousticEchoCanceller_Reference_Input
    #field APOInitSystemEffects3 apoInitSystemEffects
    #field int streamProperties
#endstruct

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