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

tACMFORMATDETAILSW

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

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

フィールド

フィールドサイズx64x86説明
cbStructDWORD4+0+0この構造体のバイトサイズ。呼び出し前に設定する。
dwFormatIndexDWORD4+4+4列挙時のフォーマットのインデックス。
dwFormatTagDWORD4+8+8波形フォーマットタグ(WAVE_FORMAT_*)。
fdwSupportDWORD4+12+12サポートする機能を示すビットフラグ(ACMDRIVERDETAILS_SUPPORTF_*)。
pwfxWAVEFORMATEX*8/4+16+16詳細を受け取る波形フォーマット(WAVEFORMATEX)へのポインタ。
cbwfxDWORD4+24+20pwfxが指すバッファのバイトサイズ。
szFormatWCHAR256+28+24フォーマットの説明文字列(Unicode、固定長配列)。

各言語での定義

#include <windows.h>

// tACMFORMATDETAILSW  (x64 284 / x86 280 バイト)
#pragma pack(push, 1)
typedef struct tACMFORMATDETAILSW {
    DWORD cbStruct;
    DWORD dwFormatIndex;
    DWORD dwFormatTag;
    DWORD fdwSupport;
    WAVEFORMATEX* pwfx;
    DWORD cbwfx;
    WCHAR szFormat[128];
} tACMFORMATDETAILSW;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct tACMFORMATDETAILSW
{
    public uint cbStruct;
    public uint dwFormatIndex;
    public uint dwFormatTag;
    public uint fdwSupport;
    public IntPtr pwfx;
    public uint cbwfx;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] public string szFormat;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure tACMFORMATDETAILSW
    Public cbStruct As UInteger
    Public dwFormatIndex As UInteger
    Public dwFormatTag As UInteger
    Public fdwSupport As UInteger
    Public pwfx As IntPtr
    Public cbwfx As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=128)> Public szFormat As String
End Structure
import ctypes
from ctypes import wintypes

class tACMFORMATDETAILSW(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("cbStruct", wintypes.DWORD),
        ("dwFormatIndex", wintypes.DWORD),
        ("dwFormatTag", wintypes.DWORD),
        ("fdwSupport", wintypes.DWORD),
        ("pwfx", ctypes.c_void_p),
        ("cbwfx", wintypes.DWORD),
        ("szFormat", ctypes.c_wchar * 128),
    ]
#[repr(C, packed(1))]
pub struct tACMFORMATDETAILSW {
    pub cbStruct: u32,
    pub dwFormatIndex: u32,
    pub dwFormatTag: u32,
    pub fdwSupport: u32,
    pub pwfx: *mut core::ffi::c_void,
    pub cbwfx: u32,
    pub szFormat: [u16; 128],
}
import "golang.org/x/sys/windows"

type tACMFORMATDETAILSW struct {
	cbStruct uint32
	dwFormatIndex uint32
	dwFormatTag uint32
	fdwSupport uint32
	pwfx uintptr
	cbwfx uint32
	szFormat [128]uint16
}
type
  tACMFORMATDETAILSW = packed record
    cbStruct: DWORD;
    dwFormatIndex: DWORD;
    dwFormatTag: DWORD;
    fdwSupport: DWORD;
    pwfx: Pointer;
    cbwfx: DWORD;
    szFormat: array[0..127] of WideChar;
  end;
const tACMFORMATDETAILSW = extern struct {
    cbStruct: u32,
    dwFormatIndex: u32,
    dwFormatTag: u32,
    fdwSupport: u32,
    pwfx: ?*anyopaque,
    cbwfx: u32,
    szFormat: [128]u16,
};
type
  tACMFORMATDETAILSW {.packed.} = object
    cbStruct: uint32
    dwFormatIndex: uint32
    dwFormatTag: uint32
    fdwSupport: uint32
    pwfx: pointer
    cbwfx: uint32
    szFormat: array[128, uint16]
align(1)
struct tACMFORMATDETAILSW
{
    uint cbStruct;
    uint dwFormatIndex;
    uint dwFormatTag;
    uint fdwSupport;
    void* pwfx;
    uint cbwfx;
    wchar[128] szFormat;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; tACMFORMATDETAILSW サイズ: 280 バイト(x86)
dim st, 70    ; 4byte整数×70(構造体サイズ 280 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFormatIndex : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwFormatTag : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; fdwSupport : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pwfx : WAVEFORMATEX* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; cbwfx : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; szFormat : WCHAR (+24, 256byte)  varptr(st)+24 を基点に操作(256byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; tACMFORMATDETAILSW サイズ: 284 バイト(x64)
dim st, 71    ; 4byte整数×71(構造体サイズ 284 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFormatIndex : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwFormatTag : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; fdwSupport : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pwfx : WAVEFORMATEX* (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; cbwfx : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; szFormat : WCHAR (+28, 256byte)  varptr(st)+28 を基点に操作(256byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global tACMFORMATDETAILSW, pack=1
    #field int cbStruct
    #field int dwFormatIndex
    #field int dwFormatTag
    #field int fdwSupport
    #field intptr pwfx
    #field int cbwfx
    #field wchar szFormat 128
#endstruct

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