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

MIDIOUTCAPSW

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

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

フィールド

フィールドサイズx64x86説明
wMidWORD2+0+0デバイス製造元(メーカー)ID。
wPidWORD2+2+2デバイス製品ID。
vDriverVersionDWORD4+4+4ドライバのバージョン(上位8bitがメジャー、下位8bitがマイナー)。
szPnameWCHAR64+8+8デバイス製品名(Unicode、固定長配列)。
wTechnologyWORD2+72+72デバイスの種類(MOD_MIDIPORT/FMSYNTH/MAPPER等)。
wVoicesWORD2+74+74同時発音可能なボイス数。内蔵シンセの場合に有効。
wNotesWORD2+76+76同時に発音可能なノート数。
wChannelMaskWORD2+78+78応答するMIDIチャンネルを示すビットマスク(各bitが1チャンネル)。
dwSupportDWORD4+80+80サポートする機能を示すビットフラグ(MIDICAPS_*)。

各言語での定義

#include <windows.h>

// MIDIOUTCAPSW  (x64 84 / x86 84 バイト)
#pragma pack(push, 1)
typedef struct MIDIOUTCAPSW {
    WORD wMid;
    WORD wPid;
    DWORD vDriverVersion;
    WCHAR szPname[32];
    WORD wTechnology;
    WORD wVoices;
    WORD wNotes;
    WORD wChannelMask;
    DWORD dwSupport;
} MIDIOUTCAPSW;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MIDIOUTCAPSW
{
    public ushort wMid;
    public ushort wPid;
    public uint vDriverVersion;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)] public string szPname;
    public ushort wTechnology;
    public ushort wVoices;
    public ushort wNotes;
    public ushort wChannelMask;
    public uint dwSupport;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MIDIOUTCAPSW
    Public wMid As UShort
    Public wPid As UShort
    Public vDriverVersion As UInteger
    <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=32)> Public szPname As String
    Public wTechnology As UShort
    Public wVoices As UShort
    Public wNotes As UShort
    Public wChannelMask As UShort
    Public dwSupport As UInteger
End Structure
import ctypes
from ctypes import wintypes

class MIDIOUTCAPSW(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("wMid", ctypes.c_ushort),
        ("wPid", ctypes.c_ushort),
        ("vDriverVersion", wintypes.DWORD),
        ("szPname", ctypes.c_wchar * 32),
        ("wTechnology", ctypes.c_ushort),
        ("wVoices", ctypes.c_ushort),
        ("wNotes", ctypes.c_ushort),
        ("wChannelMask", ctypes.c_ushort),
        ("dwSupport", wintypes.DWORD),
    ]
#[repr(C, packed(1))]
pub struct MIDIOUTCAPSW {
    pub wMid: u16,
    pub wPid: u16,
    pub vDriverVersion: u32,
    pub szPname: [u16; 32],
    pub wTechnology: u16,
    pub wVoices: u16,
    pub wNotes: u16,
    pub wChannelMask: u16,
    pub dwSupport: u32,
}
import "golang.org/x/sys/windows"

type MIDIOUTCAPSW struct {
	wMid uint16
	wPid uint16
	vDriverVersion uint32
	szPname [32]uint16
	wTechnology uint16
	wVoices uint16
	wNotes uint16
	wChannelMask uint16
	dwSupport uint32
}
type
  MIDIOUTCAPSW = packed record
    wMid: Word;
    wPid: Word;
    vDriverVersion: DWORD;
    szPname: array[0..31] of WideChar;
    wTechnology: Word;
    wVoices: Word;
    wNotes: Word;
    wChannelMask: Word;
    dwSupport: DWORD;
  end;
const MIDIOUTCAPSW = extern struct {
    wMid: u16,
    wPid: u16,
    vDriverVersion: u32,
    szPname: [32]u16,
    wTechnology: u16,
    wVoices: u16,
    wNotes: u16,
    wChannelMask: u16,
    dwSupport: u32,
};
type
  MIDIOUTCAPSW {.packed.} = object
    wMid: uint16
    wPid: uint16
    vDriverVersion: uint32
    szPname: array[32, uint16]
    wTechnology: uint16
    wVoices: uint16
    wNotes: uint16
    wChannelMask: uint16
    dwSupport: uint32
align(1)
struct MIDIOUTCAPSW
{
    ushort wMid;
    ushort wPid;
    uint vDriverVersion;
    wchar[32] szPname;
    ushort wTechnology;
    ushort wVoices;
    ushort wNotes;
    ushort wChannelMask;
    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 レイアウト)
; MIDIOUTCAPSW サイズ: 84 バイト(x64)
dim st, 21    ; 4byte整数×21(構造体サイズ 84 / 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 : WCHAR (+8, 64byte)  varptr(st)+8 を基点に操作(64byte:入れ子/配列)
; wTechnology : WORD (+72, 2byte)  wpoke st,72,値  /  値 = wpeek(st,72)
; wVoices : WORD (+74, 2byte)  wpoke st,74,値  /  値 = wpeek(st,74)
; wNotes : WORD (+76, 2byte)  wpoke st,76,値  /  値 = wpeek(st,76)
; wChannelMask : WORD (+78, 2byte)  wpoke st,78,値  /  値 = wpeek(st,78)
; dwSupport : DWORD (+80, 4byte)  st.20 = 値  /  値 = st.20   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MIDIOUTCAPSW, pack=1
    #field short wMid
    #field short wPid
    #field int vDriverVersion
    #field wchar szPname 32
    #field short wTechnology
    #field short wVoices
    #field short wNotes
    #field short wChannelMask
    #field int dwSupport
#endstruct

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