ホーム › Devices.Cdrom › SUB_Q_HEADER
SUB_Q_HEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Reserved | BYTE | 1 | +0 | +0 | 予約フィールド。0を設定する。 |
| AudioStatus | BYTE | 1 | +1 | +1 | オーディオ再生の状態を示すコード。再生中・一時停止・完了等を表す。 |
| DataLength | BYTE | 2 | +2 | +2 | 後続サブチャネルデータの長さをビッグエンディアン2バイトで示す。 |
各言語での定義
#include <windows.h>
// SUB_Q_HEADER (x64 4 / x86 4 バイト)
typedef struct SUB_Q_HEADER {
BYTE Reserved;
BYTE AudioStatus;
BYTE DataLength[2];
} SUB_Q_HEADER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SUB_Q_HEADER
{
public byte Reserved;
public byte AudioStatus;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] DataLength;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SUB_Q_HEADER
Public Reserved As Byte
Public AudioStatus As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Public DataLength() As Byte
End Structureimport ctypes
from ctypes import wintypes
class SUB_Q_HEADER(ctypes.Structure):
_fields_ = [
("Reserved", ctypes.c_ubyte),
("AudioStatus", ctypes.c_ubyte),
("DataLength", ctypes.c_ubyte * 2),
]#[repr(C)]
pub struct SUB_Q_HEADER {
pub Reserved: u8,
pub AudioStatus: u8,
pub DataLength: [u8; 2],
}import "golang.org/x/sys/windows"
type SUB_Q_HEADER struct {
Reserved byte
AudioStatus byte
DataLength [2]byte
}type
SUB_Q_HEADER = record
Reserved: Byte;
AudioStatus: Byte;
DataLength: array[0..1] of Byte;
end;const SUB_Q_HEADER = extern struct {
Reserved: u8,
AudioStatus: u8,
DataLength: [2]u8,
};type
SUB_Q_HEADER {.bycopy.} = object
Reserved: uint8
AudioStatus: uint8
DataLength: array[2, uint8]struct SUB_Q_HEADER
{
ubyte Reserved;
ubyte AudioStatus;
ubyte[2] DataLength;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SUB_Q_HEADER サイズ: 4 バイト(x64)
dim st, 1 ; 4byte整数×1(構造体サイズ 4 / 4 切り上げ)
; Reserved : BYTE (+0, 1byte) poke st,0,値 / 値 = peek(st,0)
; AudioStatus : BYTE (+1, 1byte) poke st,1,値 / 値 = peek(st,1)
; DataLength : BYTE (+2, 2byte) varptr(st)+2 を基点に操作(2byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global SUB_Q_HEADER
#field byte Reserved
#field byte AudioStatus
#field byte DataLength 2
#endstruct
stdim st, SUB_Q_HEADER ; NSTRUCT 変数を確保
st->Reserved = 100
mes "Reserved=" + st->Reserved