ホーム › Media.Audio › WAVEOUTCAPSA
WAVEOUTCAPSA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| wMid | WORD | 2 | +0 | +0 | デバイス製造元(メーカー)ID。 |
| wPid | WORD | 2 | +2 | +2 | デバイス製品ID。 |
| vDriverVersion | DWORD | 4 | +4 | +4 | ドライバのバージョン(上位8bitがメジャー、下位8bitがマイナー)。 |
| szPname | CHAR | 32 | +8 | +8 | デバイス製品名(ANSI、固定長配列)。 |
| dwFormats | DWORD | 4 | +40 | +40 | サポートする標準波形フォーマットを示すビットフラグ(WAVE_FORMAT_*)。 |
| wChannels | WORD | 2 | +44 | +44 | サポートするチャンネル数(1=モノラル、2=ステレオ)。 |
| wReserved1 | WORD | 2 | +46 | +46 | アライメント用予約領域。 |
| dwSupport | DWORD | 4 | +48 | +48 | サポートする機能を示すビットフラグ(WAVECAPS_*)。 |
各言語での定義
#include <windows.h>
// WAVEOUTCAPSA (x64 52 / x86 52 バイト)
#pragma pack(push, 1)
typedef struct WAVEOUTCAPSA {
WORD wMid;
WORD wPid;
DWORD vDriverVersion;
CHAR szPname[32];
DWORD dwFormats;
WORD wChannels;
WORD wReserved1;
DWORD dwSupport;
} WAVEOUTCAPSA;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct WAVEOUTCAPSA
{
public ushort wMid;
public ushort wPid;
public uint vDriverVersion;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public sbyte[] szPname;
public uint dwFormats;
public ushort wChannels;
public ushort wReserved1;
public uint dwSupport;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure WAVEOUTCAPSA
Public wMid As UShort
Public wPid As UShort
Public vDriverVersion As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=32)> Public szPname() As SByte
Public dwFormats As UInteger
Public wChannels As UShort
Public wReserved1 As UShort
Public dwSupport As UInteger
End Structureimport ctypes
from ctypes import wintypes
class WAVEOUTCAPSA(ctypes.Structure):
_pack_ = 1
_fields_ = [
("wMid", ctypes.c_ushort),
("wPid", ctypes.c_ushort),
("vDriverVersion", wintypes.DWORD),
("szPname", ctypes.c_byte * 32),
("dwFormats", wintypes.DWORD),
("wChannels", ctypes.c_ushort),
("wReserved1", ctypes.c_ushort),
("dwSupport", wintypes.DWORD),
]#[repr(C, packed(1))]
pub struct WAVEOUTCAPSA {
pub wMid: u16,
pub wPid: u16,
pub vDriverVersion: u32,
pub szPname: [i8; 32],
pub dwFormats: u32,
pub wChannels: u16,
pub wReserved1: u16,
pub dwSupport: u32,
}import "golang.org/x/sys/windows"
type WAVEOUTCAPSA struct {
wMid uint16
wPid uint16
vDriverVersion uint32
szPname [32]int8
dwFormats uint32
wChannels uint16
wReserved1 uint16
dwSupport uint32
}type
WAVEOUTCAPSA = packed record
wMid: Word;
wPid: Word;
vDriverVersion: DWORD;
szPname: array[0..31] of Shortint;
dwFormats: DWORD;
wChannels: Word;
wReserved1: Word;
dwSupport: DWORD;
end;const WAVEOUTCAPSA = extern struct {
wMid: u16,
wPid: u16,
vDriverVersion: u32,
szPname: [32]i8,
dwFormats: u32,
wChannels: u16,
wReserved1: u16,
dwSupport: u32,
};type
WAVEOUTCAPSA {.packed.} = object
wMid: uint16
wPid: uint16
vDriverVersion: uint32
szPname: array[32, int8]
dwFormats: uint32
wChannels: uint16
wReserved1: uint16
dwSupport: uint32align(1)
struct WAVEOUTCAPSA
{
ushort wMid;
ushort wPid;
uint vDriverVersion;
byte[32] szPname;
uint dwFormats;
ushort wChannels;
ushort wReserved1;
uint dwSupport;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; WAVEOUTCAPSA サイズ: 52 バイト(x64)
dim st, 13 ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; wMid : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; wPid : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; vDriverVersion : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; szPname : CHAR (+8, 32byte) varptr(st)+8 を基点に操作(32byte:入れ子/配列)
; dwFormats : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; wChannels : WORD (+44, 2byte) wpoke st,44,値 / 値 = wpeek(st,44)
; wReserved1 : WORD (+46, 2byte) wpoke st,46,値 / 値 = wpeek(st,46)
; dwSupport : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global WAVEOUTCAPSA, pack=1
#field short wMid
#field short wPid
#field int vDriverVersion
#field byte szPname 32
#field int dwFormats
#field short wChannels
#field short wReserved1
#field int dwSupport
#endstruct
stdim st, WAVEOUTCAPSA ; NSTRUCT 変数を確保
st->wMid = 100
mes "wMid=" + st->wMid