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

MCI_WAVE_SET_PARMS

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

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

フィールド

フィールドサイズx64x86説明
dwCallbackUINT_PTR8/4+0+0完了通知用のコールバック情報。下位ワードに通知先ウィンドウハンドルを格納する。
dwTimeFormatDWORD4+8+4設定する時間形式。サンプルやミリ秒などを指定する。
dwAudioDWORD4+12+8設定対象のオーディオチャンネル。左右やすべてなどを指定する。
wInputDWORD4+16+12入力チャンネル番号。録音元のチャンネルを示す。
wOutputDWORD4+20+16出力チャンネル番号。再生先のチャンネルを示す。
wFormatTagWORD2+24+20波形フォーマットタグ。PCMなど形式の種別を示す。
wReserved2WORD2+26+22予約済みフィールド。アライメント用で通常はゼロ。
nChannelsWORD2+28+24チャンネル数。モノラルは1、ステレオは2。
wReserved3WORD2+30+26予約済みフィールド。アライメント用で通常はゼロ。
nSamplesPerSecDWORD4+32+28サンプリング周波数。1秒あたりのサンプル数(Hz)を示す。
nAvgBytesPerSecDWORD4+36+32平均データレート。1秒あたりのバイト数を示す。
nBlockAlignWORD2+40+36ブロックアライメント。1サンプルフレームのバイト数を示す。
wReserved4WORD2+42+38予約済みフィールド。アライメント用で通常はゼロ。
wBitsPerSampleWORD2+44+40サンプルあたりのビット数。量子化精度を示す。
wReserved5WORD2+46+42予約済みフィールド。アライメント用で通常はゼロ。

各言語での定義

#include <windows.h>

// MCI_WAVE_SET_PARMS  (x64 48 / x86 44 バイト)
#pragma pack(push, 1)
typedef struct MCI_WAVE_SET_PARMS {
    UINT_PTR dwCallback;
    DWORD dwTimeFormat;
    DWORD dwAudio;
    DWORD wInput;
    DWORD wOutput;
    WORD wFormatTag;
    WORD wReserved2;
    WORD nChannels;
    WORD wReserved3;
    DWORD nSamplesPerSec;
    DWORD nAvgBytesPerSec;
    WORD nBlockAlign;
    WORD wReserved4;
    WORD wBitsPerSample;
    WORD wReserved5;
} MCI_WAVE_SET_PARMS;
#pragma pack(pop)
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct MCI_WAVE_SET_PARMS
{
    public UIntPtr dwCallback;
    public uint dwTimeFormat;
    public uint dwAudio;
    public uint wInput;
    public uint wOutput;
    public ushort wFormatTag;
    public ushort wReserved2;
    public ushort nChannels;
    public ushort wReserved3;
    public uint nSamplesPerSec;
    public uint nAvgBytesPerSec;
    public ushort nBlockAlign;
    public ushort wReserved4;
    public ushort wBitsPerSample;
    public ushort wReserved5;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure MCI_WAVE_SET_PARMS
    Public dwCallback As UIntPtr
    Public dwTimeFormat As UInteger
    Public dwAudio As UInteger
    Public wInput As UInteger
    Public wOutput As UInteger
    Public wFormatTag As UShort
    Public wReserved2 As UShort
    Public nChannels As UShort
    Public wReserved3 As UShort
    Public nSamplesPerSec As UInteger
    Public nAvgBytesPerSec As UInteger
    Public nBlockAlign As UShort
    Public wReserved4 As UShort
    Public wBitsPerSample As UShort
    Public wReserved5 As UShort
End Structure
import ctypes
from ctypes import wintypes

class MCI_WAVE_SET_PARMS(ctypes.Structure):
    _pack_ = 1
    _fields_ = [
        ("dwCallback", ctypes.c_size_t),
        ("dwTimeFormat", wintypes.DWORD),
        ("dwAudio", wintypes.DWORD),
        ("wInput", wintypes.DWORD),
        ("wOutput", wintypes.DWORD),
        ("wFormatTag", ctypes.c_ushort),
        ("wReserved2", ctypes.c_ushort),
        ("nChannels", ctypes.c_ushort),
        ("wReserved3", ctypes.c_ushort),
        ("nSamplesPerSec", wintypes.DWORD),
        ("nAvgBytesPerSec", wintypes.DWORD),
        ("nBlockAlign", ctypes.c_ushort),
        ("wReserved4", ctypes.c_ushort),
        ("wBitsPerSample", ctypes.c_ushort),
        ("wReserved5", ctypes.c_ushort),
    ]
#[repr(C, packed(1))]
pub struct MCI_WAVE_SET_PARMS {
    pub dwCallback: usize,
    pub dwTimeFormat: u32,
    pub dwAudio: u32,
    pub wInput: u32,
    pub wOutput: u32,
    pub wFormatTag: u16,
    pub wReserved2: u16,
    pub nChannels: u16,
    pub wReserved3: u16,
    pub nSamplesPerSec: u32,
    pub nAvgBytesPerSec: u32,
    pub nBlockAlign: u16,
    pub wReserved4: u16,
    pub wBitsPerSample: u16,
    pub wReserved5: u16,
}
import "golang.org/x/sys/windows"

type MCI_WAVE_SET_PARMS struct {
	dwCallback uintptr
	dwTimeFormat uint32
	dwAudio uint32
	wInput uint32
	wOutput uint32
	wFormatTag uint16
	wReserved2 uint16
	nChannels uint16
	wReserved3 uint16
	nSamplesPerSec uint32
	nAvgBytesPerSec uint32
	nBlockAlign uint16
	wReserved4 uint16
	wBitsPerSample uint16
	wReserved5 uint16
}
type
  MCI_WAVE_SET_PARMS = packed record
    dwCallback: NativeUInt;
    dwTimeFormat: DWORD;
    dwAudio: DWORD;
    wInput: DWORD;
    wOutput: DWORD;
    wFormatTag: Word;
    wReserved2: Word;
    nChannels: Word;
    wReserved3: Word;
    nSamplesPerSec: DWORD;
    nAvgBytesPerSec: DWORD;
    nBlockAlign: Word;
    wReserved4: Word;
    wBitsPerSample: Word;
    wReserved5: Word;
  end;
const MCI_WAVE_SET_PARMS = extern struct {
    dwCallback: usize,
    dwTimeFormat: u32,
    dwAudio: u32,
    wInput: u32,
    wOutput: u32,
    wFormatTag: u16,
    wReserved2: u16,
    nChannels: u16,
    wReserved3: u16,
    nSamplesPerSec: u32,
    nAvgBytesPerSec: u32,
    nBlockAlign: u16,
    wReserved4: u16,
    wBitsPerSample: u16,
    wReserved5: u16,
};
type
  MCI_WAVE_SET_PARMS {.packed.} = object
    dwCallback: uint
    dwTimeFormat: uint32
    dwAudio: uint32
    wInput: uint32
    wOutput: uint32
    wFormatTag: uint16
    wReserved2: uint16
    nChannels: uint16
    wReserved3: uint16
    nSamplesPerSec: uint32
    nAvgBytesPerSec: uint32
    nBlockAlign: uint16
    wReserved4: uint16
    wBitsPerSample: uint16
    wReserved5: uint16
align(1)
struct MCI_WAVE_SET_PARMS
{
    size_t dwCallback;
    uint dwTimeFormat;
    uint dwAudio;
    uint wInput;
    uint wOutput;
    ushort wFormatTag;
    ushort wReserved2;
    ushort nChannels;
    ushort wReserved3;
    uint nSamplesPerSec;
    uint nAvgBytesPerSec;
    ushort nBlockAlign;
    ushort wReserved4;
    ushort wBitsPerSample;
    ushort wReserved5;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MCI_WAVE_SET_PARMS サイズ: 44 バイト(x86)
dim st, 11    ; 4byte整数×11(構造体サイズ 44 / 4 切り上げ)
; dwCallback : UINT_PTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwTimeFormat : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; dwAudio : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; wInput : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; wOutput : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; wFormatTag : WORD (+20, 2byte)  wpoke st,20,値  /  値 = wpeek(st,20)
; wReserved2 : WORD (+22, 2byte)  wpoke st,22,値  /  値 = wpeek(st,22)
; nChannels : WORD (+24, 2byte)  wpoke st,24,値  /  値 = wpeek(st,24)
; wReserved3 : WORD (+26, 2byte)  wpoke st,26,値  /  値 = wpeek(st,26)
; nSamplesPerSec : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; nAvgBytesPerSec : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; nBlockAlign : WORD (+36, 2byte)  wpoke st,36,値  /  値 = wpeek(st,36)
; wReserved4 : WORD (+38, 2byte)  wpoke st,38,値  /  値 = wpeek(st,38)
; wBitsPerSample : WORD (+40, 2byte)  wpoke st,40,値  /  値 = wpeek(st,40)
; wReserved5 : WORD (+42, 2byte)  wpoke st,42,値  /  値 = wpeek(st,42)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MCI_WAVE_SET_PARMS サイズ: 48 バイト(x64)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; dwCallback : UINT_PTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; dwTimeFormat : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; dwAudio : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; wInput : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; wOutput : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; wFormatTag : WORD (+24, 2byte)  wpoke st,24,値  /  値 = wpeek(st,24)
; wReserved2 : WORD (+26, 2byte)  wpoke st,26,値  /  値 = wpeek(st,26)
; nChannels : WORD (+28, 2byte)  wpoke st,28,値  /  値 = wpeek(st,28)
; wReserved3 : WORD (+30, 2byte)  wpoke st,30,値  /  値 = wpeek(st,30)
; nSamplesPerSec : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; nAvgBytesPerSec : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; nBlockAlign : WORD (+40, 2byte)  wpoke st,40,値  /  値 = wpeek(st,40)
; wReserved4 : WORD (+42, 2byte)  wpoke st,42,値  /  値 = wpeek(st,42)
; wBitsPerSample : WORD (+44, 2byte)  wpoke st,44,値  /  値 = wpeek(st,44)
; wReserved5 : WORD (+46, 2byte)  wpoke st,46,値  /  値 = wpeek(st,46)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MCI_WAVE_SET_PARMS, pack=1
    #field intptr dwCallback
    #field int dwTimeFormat
    #field int dwAudio
    #field int wInput
    #field int wOutput
    #field short wFormatTag
    #field short wReserved2
    #field short nChannels
    #field short wReserved3
    #field int nSamplesPerSec
    #field int nAvgBytesPerSec
    #field short nBlockAlign
    #field short wReserved4
    #field short wBitsPerSample
    #field short wReserved5
#endstruct

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