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

MIXERCONTROLA

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

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

フィールド

フィールドサイズx64x86説明
cbStructDWORD4+0+0この構造体のバイトサイズ。
dwControlIDDWORD4+4+4コントロールを一意に識別するID。
dwControlTypeDWORD4+8+8コントロールの種類(音量/ミュート/フェーダー等、MIXERCONTROL_CONTROLTYPE_*)。
fdwControlDWORD4+12+12コントロールの状態を示すビットフラグ(MIXERCONTROL_CONTROLF_*)。
cMultipleItemsDWORD4+16+16複数項目コントロールの項目数。単一値なら0。
szShortNameCHAR16+20+20コントロールの短い名前(ANSI、固定長配列)。
szNameCHAR64+36+36コントロールの完全名(ANSI、固定長配列)。
Bounds_Bounds_e__Union24+100+100コントロール値の最小・最大範囲を保持する共用体。
Metrics_Metrics_e__Union24+124+124コントロールの刻み幅などの計量情報を保持する共用体。

共用体: _Bounds_e__Union x64 24B / x86 24B

フィールドサイズx64x86
Anonymous1_Anonymous1_e__Struct8/4+0+0
Anonymous2_Anonymous2_e__Struct8/4+0+0
dwReservedDWORD24+0+0

共用体: _Metrics_e__Union x64 24B / x86 24B

フィールドサイズx64x86
cStepsDWORD4+0+0
cbCustomDataDWORD4+0+0
dwReservedDWORD24+0+0

各言語での定義

#include <windows.h>

// MIXERCONTROLA  (x64 148 / x86 148 バイト)
#pragma pack(push, 1)
typedef struct MIXERCONTROLA {
    DWORD cbStruct;
    DWORD dwControlID;
    DWORD dwControlType;
    DWORD fdwControl;
    DWORD cMultipleItems;
    CHAR szShortName[16];
    CHAR szName[64];
    _Bounds_e__Union Bounds;
    _Metrics_e__Union Metrics;
} MIXERCONTROLA;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MIXERCONTROLA
{
    public uint cbStruct;
    public uint dwControlID;
    public uint dwControlType;
    public uint fdwControl;
    public uint cMultipleItems;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public sbyte[] szShortName;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public sbyte[] szName;
    public _Bounds_e__Union Bounds;
    public _Metrics_e__Union Metrics;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MIXERCONTROLA
    Public cbStruct As UInteger
    Public dwControlID As UInteger
    Public dwControlType As UInteger
    Public fdwControl As UInteger
    Public cMultipleItems As UInteger
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)> Public szShortName() As SByte
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=64)> Public szName() As SByte
    Public Bounds As _Bounds_e__Union
    Public Metrics As _Metrics_e__Union
End Structure
import ctypes
from ctypes import wintypes

class MIXERCONTROLA(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("cbStruct", wintypes.DWORD),
        ("dwControlID", wintypes.DWORD),
        ("dwControlType", wintypes.DWORD),
        ("fdwControl", wintypes.DWORD),
        ("cMultipleItems", wintypes.DWORD),
        ("szShortName", ctypes.c_byte * 16),
        ("szName", ctypes.c_byte * 64),
        ("Bounds", _Bounds_e__Union),
        ("Metrics", _Metrics_e__Union),
    ]
#[repr(C, packed(1))]
pub struct MIXERCONTROLA {
    pub cbStruct: u32,
    pub dwControlID: u32,
    pub dwControlType: u32,
    pub fdwControl: u32,
    pub cMultipleItems: u32,
    pub szShortName: [i8; 16],
    pub szName: [i8; 64],
    pub Bounds: _Bounds_e__Union,
    pub Metrics: _Metrics_e__Union,
}
import "golang.org/x/sys/windows"

type MIXERCONTROLA struct {
	cbStruct uint32
	dwControlID uint32
	dwControlType uint32
	fdwControl uint32
	cMultipleItems uint32
	szShortName [16]int8
	szName [64]int8
	Bounds _Bounds_e__Union
	Metrics _Metrics_e__Union
}
type
  MIXERCONTROLA = packed record
    cbStruct: DWORD;
    dwControlID: DWORD;
    dwControlType: DWORD;
    fdwControl: DWORD;
    cMultipleItems: DWORD;
    szShortName: array[0..15] of Shortint;
    szName: array[0..63] of Shortint;
    Bounds: _Bounds_e__Union;
    Metrics: _Metrics_e__Union;
  end;
const MIXERCONTROLA = extern struct {
    cbStruct: u32,
    dwControlID: u32,
    dwControlType: u32,
    fdwControl: u32,
    cMultipleItems: u32,
    szShortName: [16]i8,
    szName: [64]i8,
    Bounds: _Bounds_e__Union,
    Metrics: _Metrics_e__Union,
};
type
  MIXERCONTROLA {.packed.} = object
    cbStruct: uint32
    dwControlID: uint32
    dwControlType: uint32
    fdwControl: uint32
    cMultipleItems: uint32
    szShortName: array[16, int8]
    szName: array[64, int8]
    Bounds: _Bounds_e__Union
    Metrics: _Metrics_e__Union
align(1)
struct MIXERCONTROLA
{
    uint cbStruct;
    uint dwControlID;
    uint dwControlType;
    uint fdwControl;
    uint cMultipleItems;
    byte[16] szShortName;
    byte[64] szName;
    _Bounds_e__Union Bounds;
    _Metrics_e__Union Metrics;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MIXERCONTROLA サイズ: 148 バイト(x64)
dim st, 37    ; 4byte整数×37(構造体サイズ 148 / 4 切り上げ)
; cbStruct : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwControlID : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwControlType : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; fdwControl : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; cMultipleItems : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; szShortName : CHAR (+20, 16byte)  varptr(st)+20 を基点に操作(16byte:入れ子/配列)
; szName : CHAR (+36, 64byte)  varptr(st)+36 を基点に操作(64byte:入れ子/配列)
; Bounds : _Bounds_e__Union (+100, 24byte)  varptr(st)+100 を基点に操作(24byte:入れ子/配列)
; Metrics : _Metrics_e__Union (+124, 24byte)  varptr(st)+124 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MIXERCONTROLA, pack=1
    #field int cbStruct
    #field int dwControlID
    #field int dwControlType
    #field int fdwControl
    #field int cMultipleItems
    #field byte szShortName 16
    #field byte szName 64
    #field byte Bounds 24
    #field byte Metrics 24
#endstruct

stdim st, MIXERCONTROLA        ; NSTRUCT 変数を確保
st->cbStruct = 100
mes "cbStruct=" + st->cbStruct
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。