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

ACMDRVFORMATSUGGEST

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

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

フィールド

フィールドサイズx64x86説明
cbStructDWORD4+0+0この構造体のサイズをバイト単位で示す。
fdwSuggestDWORD4+4+4提案時に固定する項目を示すフラグ(ACM_FORMATSUGGESTF_*)を示す。
pwfxSrcWAVEFORMATEX*8/4+8+8変換元の波形フォーマットを示すWAVEFORMATEX構造体へのポインター。
cbwfxSrcDWORD4+16+12pwfxSrcバッファのサイズをバイト単位で示す。
pwfxDstWAVEFORMATEX*8/4+20+16提案先の波形フォーマットを格納するWAVEFORMATEX構造体へのポインター。
cbwfxDstDWORD4+28+20pwfxDstバッファのサイズをバイト単位で示す。

各言語での定義

#include <windows.h>

// ACMDRVFORMATSUGGEST  (x64 32 / x86 24 バイト)
#pragma pack(push, 1)
typedef struct ACMDRVFORMATSUGGEST {
    DWORD cbStruct;
    DWORD fdwSuggest;
    WAVEFORMATEX* pwfxSrc;
    DWORD cbwfxSrc;
    WAVEFORMATEX* pwfxDst;
    DWORD cbwfxDst;
} ACMDRVFORMATSUGGEST;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct ACMDRVFORMATSUGGEST
{
    public uint cbStruct;
    public uint fdwSuggest;
    public IntPtr pwfxSrc;
    public uint cbwfxSrc;
    public IntPtr pwfxDst;
    public uint cbwfxDst;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure ACMDRVFORMATSUGGEST
    Public cbStruct As UInteger
    Public fdwSuggest As UInteger
    Public pwfxSrc As IntPtr
    Public cbwfxSrc As UInteger
    Public pwfxDst As IntPtr
    Public cbwfxDst As UInteger
End Structure
import ctypes
from ctypes import wintypes

class ACMDRVFORMATSUGGEST(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("cbStruct", wintypes.DWORD),
        ("fdwSuggest", wintypes.DWORD),
        ("pwfxSrc", ctypes.c_void_p),
        ("cbwfxSrc", wintypes.DWORD),
        ("pwfxDst", ctypes.c_void_p),
        ("cbwfxDst", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct ACMDRVFORMATSUGGEST {
    pub cbStruct: u32,
    pub fdwSuggest: u32,
    pub pwfxSrc: *mut core::ffi::c_void,
    pub cbwfxSrc: u32,
    pub pwfxDst: *mut core::ffi::c_void,
    pub cbwfxDst: u32,
}
import "golang.org/x/sys/windows"

type ACMDRVFORMATSUGGEST struct {
	cbStruct uint32
	fdwSuggest uint32
	pwfxSrc uintptr
	cbwfxSrc uint32
	pwfxDst uintptr
	cbwfxDst uint32
}
type
  ACMDRVFORMATSUGGEST = packed record
    cbStruct: DWORD;
    fdwSuggest: DWORD;
    pwfxSrc: Pointer;
    cbwfxSrc: DWORD;
    pwfxDst: Pointer;
    cbwfxDst: DWORD;
  end;
const ACMDRVFORMATSUGGEST = extern struct {
    cbStruct: u32,
    fdwSuggest: u32,
    pwfxSrc: ?*anyopaque,
    cbwfxSrc: u32,
    pwfxDst: ?*anyopaque,
    cbwfxDst: u32,
};
type
  ACMDRVFORMATSUGGEST {.packed.} = object
    cbStruct: uint32
    fdwSuggest: uint32
    pwfxSrc: pointer
    cbwfxSrc: uint32
    pwfxDst: pointer
    cbwfxDst: uint32
align(1)
struct ACMDRVFORMATSUGGEST
{
    uint cbStruct;
    uint fdwSuggest;
    void* pwfxSrc;
    uint cbwfxSrc;
    void* pwfxDst;
    uint cbwfxDst;
}

HSP用 定義

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

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

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