ホーム › Media.MediaPlayer › TimedLevel
TimedLevel
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| frequency | BYTE | 2048 | +0 | +0 | 各周波数帯のレベルを格納する周波数スペクトルデータのバイト配列。 |
| waveform | BYTE | 2048 | +2048 | +2048 | 各チャンネルの波形振幅を格納するバイト配列。 |
| state | INT | 4 | +4096 | +4096 | 再生状態を示す値。 |
| timeStamp | LONGLONG | 8 | +4104 | +4104 | このデータのタイムスタンプを100ナノ秒単位で示す。 |
各言語での定義
#include <windows.h>
// TimedLevel (x64 4112 / x86 4112 バイト)
typedef struct TimedLevel {
BYTE frequency[2048];
BYTE waveform[2048];
INT state;
LONGLONG timeStamp;
} TimedLevel;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TimedLevel
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2048)] public byte[] frequency;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2048)] public byte[] waveform;
public int state;
public long timeStamp;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TimedLevel
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2048)> Public frequency() As Byte
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2048)> Public waveform() As Byte
Public state As Integer
Public timeStamp As Long
End Structureimport ctypes
from ctypes import wintypes
class TimedLevel(ctypes.Structure):
_fields_ = [
("frequency", ctypes.c_ubyte * 2048),
("waveform", ctypes.c_ubyte * 2048),
("state", ctypes.c_int),
("timeStamp", ctypes.c_longlong),
]#[repr(C)]
pub struct TimedLevel {
pub frequency: [u8; 2048],
pub waveform: [u8; 2048],
pub state: i32,
pub timeStamp: i64,
}import "golang.org/x/sys/windows"
type TimedLevel struct {
frequency [2048]byte
waveform [2048]byte
state int32
timeStamp int64
}type
TimedLevel = record
frequency: array[0..2047] of Byte;
waveform: array[0..2047] of Byte;
state: Integer;
timeStamp: Int64;
end;const TimedLevel = extern struct {
frequency: [2048]u8,
waveform: [2048]u8,
state: i32,
timeStamp: i64,
};type
TimedLevel {.bycopy.} = object
frequency: array[2048, uint8]
waveform: array[2048, uint8]
state: int32
timeStamp: int64struct TimedLevel
{
ubyte[2048] frequency;
ubyte[2048] waveform;
int state;
long timeStamp;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TimedLevel サイズ: 4112 バイト(x64)
dim st, 1028 ; 4byte整数×1028(構造体サイズ 4112 / 4 切り上げ)
; frequency : BYTE (+0, 2048byte) varptr(st)+0 を基点に操作(2048byte:入れ子/配列)
; waveform : BYTE (+2048, 2048byte) varptr(st)+2048 を基点に操作(2048byte:入れ子/配列)
; state : INT (+4096, 4byte) st.1024 = 値 / 値 = st.1024 (lpoke/lpeek も可)
; timeStamp : LONGLONG (+4104, 8byte) qpoke st,4104,値 / qpeek(st,4104) ※IronHSPのみ。3.7/3.8は lpoke st,4104,下位 : lpoke st,4108,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global TimedLevel
#field byte frequency 2048
#field byte waveform 2048
#field int state
#field int64 timeStamp
#endstruct
stdim st, TimedLevel ; NSTRUCT 変数を確保
st->state = 100
mes "state=" + st->state