ホーム › Media.Audio.Endpoints › AUDIO_ENDPOINT_SHARED_CREATE_PARAMS
AUDIO_ENDPOINT_SHARED_CREATE_PARAMS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| u32Size | DWORD | 4 | +0 | +0 | この構造体のバイトサイズ。 |
| u32TSSessionId | DWORD | 4 | +4 | +4 | ターミナルサービス(リモートデスクトップ)のセッションID。 |
| targetEndpointConnectorType | EndpointConnectorType | 4 | +8 | +8 | 対象とするエンドポイントコネクタの種類(EndpointConnectorType)。 |
| wfxDeviceFormat | WAVEFORMATEX | 18 | +12 | +12 | デバイスの波形フォーマット(WAVEFORMATEX、可変長)。 |
各言語での定義
#include <windows.h>
// WAVEFORMATEX (x64 18 / x86 18 バイト)
#pragma pack(push, 1)
typedef struct WAVEFORMATEX {
WORD wFormatTag;
WORD nChannels;
DWORD nSamplesPerSec;
DWORD nAvgBytesPerSec;
WORD nBlockAlign;
WORD wBitsPerSample;
WORD cbSize;
} WAVEFORMATEX;
#pragma pack(pop)
// AUDIO_ENDPOINT_SHARED_CREATE_PARAMS (x64 32 / x86 32 バイト)
typedef struct AUDIO_ENDPOINT_SHARED_CREATE_PARAMS {
DWORD u32Size;
DWORD u32TSSessionId;
EndpointConnectorType targetEndpointConnectorType;
WAVEFORMATEX wfxDeviceFormat;
} AUDIO_ENDPOINT_SHARED_CREATE_PARAMS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
public struct WAVEFORMATEX
{
public ushort wFormatTag;
public ushort nChannels;
public uint nSamplesPerSec;
public uint nAvgBytesPerSec;
public ushort nBlockAlign;
public ushort wBitsPerSample;
public ushort cbSize;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct AUDIO_ENDPOINT_SHARED_CREATE_PARAMS
{
public uint u32Size;
public uint u32TSSessionId;
public int targetEndpointConnectorType;
public WAVEFORMATEX wfxDeviceFormat;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=1, CharSet:=CharSet.Unicode)>
Public Structure WAVEFORMATEX
Public wFormatTag As UShort
Public nChannels As UShort
Public nSamplesPerSec As UInteger
Public nAvgBytesPerSec As UInteger
Public nBlockAlign As UShort
Public wBitsPerSample As UShort
Public cbSize As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure AUDIO_ENDPOINT_SHARED_CREATE_PARAMS
Public u32Size As UInteger
Public u32TSSessionId As UInteger
Public targetEndpointConnectorType As Integer
Public wfxDeviceFormat As WAVEFORMATEX
End Structureimport ctypes
from ctypes import wintypes
class WAVEFORMATEX(ctypes.Structure):
_pack_ = 1
_fields_ = [
("wFormatTag", ctypes.c_ushort),
("nChannels", ctypes.c_ushort),
("nSamplesPerSec", wintypes.DWORD),
("nAvgBytesPerSec", wintypes.DWORD),
("nBlockAlign", ctypes.c_ushort),
("wBitsPerSample", ctypes.c_ushort),
("cbSize", ctypes.c_ushort),
]
class AUDIO_ENDPOINT_SHARED_CREATE_PARAMS(ctypes.Structure):
_fields_ = [
("u32Size", wintypes.DWORD),
("u32TSSessionId", wintypes.DWORD),
("targetEndpointConnectorType", ctypes.c_int),
("wfxDeviceFormat", WAVEFORMATEX),
]#[repr(C, packed(1))]
pub struct WAVEFORMATEX {
pub wFormatTag: u16,
pub nChannels: u16,
pub nSamplesPerSec: u32,
pub nAvgBytesPerSec: u32,
pub nBlockAlign: u16,
pub wBitsPerSample: u16,
pub cbSize: u16,
}
#[repr(C)]
pub struct AUDIO_ENDPOINT_SHARED_CREATE_PARAMS {
pub u32Size: u32,
pub u32TSSessionId: u32,
pub targetEndpointConnectorType: i32,
pub wfxDeviceFormat: WAVEFORMATEX,
}import "golang.org/x/sys/windows"
type WAVEFORMATEX struct {
wFormatTag uint16
nChannels uint16
nSamplesPerSec uint32
nAvgBytesPerSec uint32
nBlockAlign uint16
wBitsPerSample uint16
cbSize uint16
}
type AUDIO_ENDPOINT_SHARED_CREATE_PARAMS struct {
u32Size uint32
u32TSSessionId uint32
targetEndpointConnectorType int32
wfxDeviceFormat WAVEFORMATEX
}type
WAVEFORMATEX = packed record
wFormatTag: Word;
nChannels: Word;
nSamplesPerSec: DWORD;
nAvgBytesPerSec: DWORD;
nBlockAlign: Word;
wBitsPerSample: Word;
cbSize: Word;
end;
AUDIO_ENDPOINT_SHARED_CREATE_PARAMS = record
u32Size: DWORD;
u32TSSessionId: DWORD;
targetEndpointConnectorType: Integer;
wfxDeviceFormat: WAVEFORMATEX;
end;const WAVEFORMATEX = extern struct {
wFormatTag: u16,
nChannels: u16,
nSamplesPerSec: u32,
nAvgBytesPerSec: u32,
nBlockAlign: u16,
wBitsPerSample: u16,
cbSize: u16,
};
const AUDIO_ENDPOINT_SHARED_CREATE_PARAMS = extern struct {
u32Size: u32,
u32TSSessionId: u32,
targetEndpointConnectorType: i32,
wfxDeviceFormat: WAVEFORMATEX,
};type
WAVEFORMATEX {.packed.} = object
wFormatTag: uint16
nChannels: uint16
nSamplesPerSec: uint32
nAvgBytesPerSec: uint32
nBlockAlign: uint16
wBitsPerSample: uint16
cbSize: uint16
AUDIO_ENDPOINT_SHARED_CREATE_PARAMS {.bycopy.} = object
u32Size: uint32
u32TSSessionId: uint32
targetEndpointConnectorType: int32
wfxDeviceFormat: WAVEFORMATEXalign(1)
struct WAVEFORMATEX
{
ushort wFormatTag;
ushort nChannels;
uint nSamplesPerSec;
uint nAvgBytesPerSec;
ushort nBlockAlign;
ushort wBitsPerSample;
ushort cbSize;
}
struct AUDIO_ENDPOINT_SHARED_CREATE_PARAMS
{
uint u32Size;
uint u32TSSessionId;
int targetEndpointConnectorType;
WAVEFORMATEX wfxDeviceFormat;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; AUDIO_ENDPOINT_SHARED_CREATE_PARAMS サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; u32Size : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; u32TSSessionId : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; targetEndpointConnectorType : EndpointConnectorType (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; wfxDeviceFormat : WAVEFORMATEX (+12, 18byte) varptr(st)+12 を基点に操作(18byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global WAVEFORMATEX, pack=1
#field short wFormatTag
#field short nChannels
#field int nSamplesPerSec
#field int nAvgBytesPerSec
#field short nBlockAlign
#field short wBitsPerSample
#field short cbSize
#endstruct
#defstruct global AUDIO_ENDPOINT_SHARED_CREATE_PARAMS
#field int u32Size
#field int u32TSSessionId
#field int targetEndpointConnectorType
#field WAVEFORMATEX wfxDeviceFormat
#endstruct
stdim st, AUDIO_ENDPOINT_SHARED_CREATE_PARAMS ; NSTRUCT 変数を確保
st->u32Size = 100
mes "u32Size=" + st->u32Size