ホーム › Media.Audio › MIXERCONTROLW
MIXERCONTROLW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cbStruct | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。 |
| dwControlID | DWORD | 4 | +4 | +4 | コントロールを一意に識別するID。 |
| dwControlType | DWORD | 4 | +8 | +8 | コントロールの種類(音量/ミュート/フェーダー等、MIXERCONTROL_CONTROLTYPE_*)。 |
| fdwControl | DWORD | 4 | +12 | +12 | コントロールの状態を示すビットフラグ(MIXERCONTROL_CONTROLF_*)。 |
| cMultipleItems | DWORD | 4 | +16 | +16 | 複数項目コントロールの項目数。単一値なら0。 |
| szShortName | WCHAR | 32 | +20 | +20 | コントロールの短い名前(Unicode、固定長配列)。 |
| szName | WCHAR | 128 | +52 | +52 | コントロールの完全名(Unicode、固定長配列)。 |
| Bounds | _Bounds_e__Union | 24 | +180 | +180 | コントロール値の最小・最大範囲を保持する共用体。 |
| Metrics | _Metrics_e__Union | 24 | +204 | +204 | コントロールの刻み幅などの計量情報を保持する共用体。 |
共用体: _Bounds_e__Union x64 24B / x86 24B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| Anonymous1 | _Anonymous1_e__Struct | 8/4 | +0 | +0 |
| Anonymous2 | _Anonymous2_e__Struct | 8/4 | +0 | +0 |
| dwReserved | DWORD | 24 | +0 | +0 |
共用体: _Metrics_e__Union x64 24B / x86 24B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| cSteps | DWORD | 4 | +0 | +0 |
| cbCustomData | DWORD | 4 | +0 | +0 |
| dwReserved | DWORD | 24 | +0 | +0 |
各言語での定義
#include <windows.h>
// MIXERCONTROLW (x64 228 / x86 228 バイト)
#pragma pack(push, 1)
typedef struct MIXERCONTROLW {
DWORD cbStruct;
DWORD dwControlID;
DWORD dwControlType;
DWORD fdwControl;
DWORD cMultipleItems;
WCHAR szShortName[16];
WCHAR szName[64];
_Bounds_e__Union Bounds;
_Metrics_e__Union Metrics;
} MIXERCONTROLW;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MIXERCONTROLW
{
public uint cbStruct;
public uint dwControlID;
public uint dwControlType;
public uint fdwControl;
public uint cMultipleItems;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] public string szShortName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] public string 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 MIXERCONTROLW
Public cbStruct As UInteger
Public dwControlID As UInteger
Public dwControlType As UInteger
Public fdwControl As UInteger
Public cMultipleItems As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=16)> Public szShortName As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=64)> Public szName As String
Public Bounds As _Bounds_e__Union
Public Metrics As _Metrics_e__Union
End Structureimport ctypes
from ctypes import wintypes
class MIXERCONTROLW(ctypes.Structure):
_pack_ = 1
_fields_ = [
("cbStruct", wintypes.DWORD),
("dwControlID", wintypes.DWORD),
("dwControlType", wintypes.DWORD),
("fdwControl", wintypes.DWORD),
("cMultipleItems", wintypes.DWORD),
("szShortName", ctypes.c_wchar * 16),
("szName", ctypes.c_wchar * 64),
("Bounds", _Bounds_e__Union),
("Metrics", _Metrics_e__Union),
]#[repr(C, packed(1))]
pub struct MIXERCONTROLW {
pub cbStruct: u32,
pub dwControlID: u32,
pub dwControlType: u32,
pub fdwControl: u32,
pub cMultipleItems: u32,
pub szShortName: [u16; 16],
pub szName: [u16; 64],
pub Bounds: _Bounds_e__Union,
pub Metrics: _Metrics_e__Union,
}import "golang.org/x/sys/windows"
type MIXERCONTROLW struct {
cbStruct uint32
dwControlID uint32
dwControlType uint32
fdwControl uint32
cMultipleItems uint32
szShortName [16]uint16
szName [64]uint16
Bounds _Bounds_e__Union
Metrics _Metrics_e__Union
}type
MIXERCONTROLW = packed record
cbStruct: DWORD;
dwControlID: DWORD;
dwControlType: DWORD;
fdwControl: DWORD;
cMultipleItems: DWORD;
szShortName: array[0..15] of WideChar;
szName: array[0..63] of WideChar;
Bounds: _Bounds_e__Union;
Metrics: _Metrics_e__Union;
end;const MIXERCONTROLW = extern struct {
cbStruct: u32,
dwControlID: u32,
dwControlType: u32,
fdwControl: u32,
cMultipleItems: u32,
szShortName: [16]u16,
szName: [64]u16,
Bounds: _Bounds_e__Union,
Metrics: _Metrics_e__Union,
};type
MIXERCONTROLW {.packed.} = object
cbStruct: uint32
dwControlID: uint32
dwControlType: uint32
fdwControl: uint32
cMultipleItems: uint32
szShortName: array[16, uint16]
szName: array[64, uint16]
Bounds: _Bounds_e__Union
Metrics: _Metrics_e__Unionalign(1)
struct MIXERCONTROLW
{
uint cbStruct;
uint dwControlID;
uint dwControlType;
uint fdwControl;
uint cMultipleItems;
wchar[16] szShortName;
wchar[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 レイアウト)
; MIXERCONTROLW サイズ: 228 バイト(x64)
dim st, 57 ; 4byte整数×57(構造体サイズ 228 / 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 : WCHAR (+20, 32byte) varptr(st)+20 を基点に操作(32byte:入れ子/配列)
; szName : WCHAR (+52, 128byte) varptr(st)+52 を基点に操作(128byte:入れ子/配列)
; Bounds : _Bounds_e__Union (+180, 24byte) varptr(st)+180 を基点に操作(24byte:入れ子/配列)
; Metrics : _Metrics_e__Union (+204, 24byte) varptr(st)+204 を基点に操作(24byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MIXERCONTROLW, pack=1
#field int cbStruct
#field int dwControlID
#field int dwControlType
#field int fdwControl
#field int cMultipleItems
#field wchar szShortName 16
#field wchar szName 64
#field byte Bounds 24
#field byte Metrics 24
#endstruct
stdim st, MIXERCONTROLW ; NSTRUCT 変数を確保
st->cbStruct = 100
mes "cbStruct=" + st->cbStruct
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。