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

KSRTAUDIO_HWREGISTER32

構造体
サイズx64: 32 バイト / x86: 32 バイト

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

フィールド

フィールドサイズx64x86説明
RegisterDWORD4+0+0ハードウェア位置レジスタのアドレスを32ビット値で示す。
WidthDWORD4+4+4レジスタの幅(8/16/32ビット)を示す。
NumeratorULONGLONG8+8+8レジスタ値をバイト数へ換算する分子である。
DenominatorULONGLONG8+16+16レジスタ値をバイト数へ換算する分母である。
AccuracyDWORD4+24+24レジスタ位置の精度をバイト単位で示す。

各言語での定義

#include <windows.h>

// KSRTAUDIO_HWREGISTER32  (x64 32 / x86 32 バイト)
typedef struct KSRTAUDIO_HWREGISTER32 {
    DWORD Register;
    DWORD Width;
    ULONGLONG Numerator;
    ULONGLONG Denominator;
    DWORD Accuracy;
} KSRTAUDIO_HWREGISTER32;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSRTAUDIO_HWREGISTER32
{
    public uint Register;
    public uint Width;
    public ulong Numerator;
    public ulong Denominator;
    public uint Accuracy;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSRTAUDIO_HWREGISTER32
    Public Register As UInteger
    Public Width As UInteger
    Public Numerator As ULong
    Public Denominator As ULong
    Public Accuracy As UInteger
End Structure
import ctypes
from ctypes import wintypes

class KSRTAUDIO_HWREGISTER32(ctypes.Structure):
    _fields_ = [
        ("Register", wintypes.DWORD),
        ("Width", wintypes.DWORD),
        ("Numerator", ctypes.c_ulonglong),
        ("Denominator", ctypes.c_ulonglong),
        ("Accuracy", wintypes.DWORD),
    ]
#[repr(C)]
pub struct KSRTAUDIO_HWREGISTER32 {
    pub Register: u32,
    pub Width: u32,
    pub Numerator: u64,
    pub Denominator: u64,
    pub Accuracy: u32,
}
import "golang.org/x/sys/windows"

type KSRTAUDIO_HWREGISTER32 struct {
	Register uint32
	Width uint32
	Numerator uint64
	Denominator uint64
	Accuracy uint32
}
type
  KSRTAUDIO_HWREGISTER32 = record
    Register: DWORD;
    Width: DWORD;
    Numerator: UInt64;
    Denominator: UInt64;
    Accuracy: DWORD;
  end;
const KSRTAUDIO_HWREGISTER32 = extern struct {
    Register: u32,
    Width: u32,
    Numerator: u64,
    Denominator: u64,
    Accuracy: u32,
};
type
  KSRTAUDIO_HWREGISTER32 {.bycopy.} = object
    Register: uint32
    Width: uint32
    Numerator: uint64
    Denominator: uint64
    Accuracy: uint32
struct KSRTAUDIO_HWREGISTER32
{
    uint Register;
    uint Width;
    ulong Numerator;
    ulong Denominator;
    uint Accuracy;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KSRTAUDIO_HWREGISTER32 サイズ: 32 バイト(x64)
dim st, 8    ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; Register : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Width : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Numerator : ULONGLONG (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; Denominator : ULONGLONG (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; Accuracy : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global KSRTAUDIO_HWREGISTER32
    #field int Register
    #field int Width
    #field int64 Numerator
    #field int64 Denominator
    #field int Accuracy
#endstruct

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