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

s_RIFFWAVE_inst

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

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

フィールド

フィールドサイズx64x86説明
bUnshiftedNoteBYTE1+0+0サンプルの基準MIDIノート番号。0〜127でサンプルが収録された音高を示す。
chFineTuneCHAR1+1+1ファインチューン値。セミトーン未満の音程補正をセント相当で示す符号付き値。
chGainCHAR1+2+2ゲイン値。デシベル単位の音量補正を示す符号付き値。
bLowNoteBYTE1+3+3再生対象とする最低MIDIノート番号。0〜127の鍵域下限を示す。
bHighNoteBYTE1+4+4再生対象とする最高MIDIノート番号。0〜127の鍵域上限を示す。
bLowVelocityBYTE1+5+5再生対象とする最低ベロシティ値。1〜127の下限を示す。
bHighVelocityBYTE1+6+6再生対象とする最高ベロシティ値。1〜127の上限を示す。

各言語での定義

#include <windows.h>

// s_RIFFWAVE_inst  (x64 7 / x86 7 バイト)
typedef struct s_RIFFWAVE_inst {
    BYTE bUnshiftedNote;
    CHAR chFineTune;
    CHAR chGain;
    BYTE bLowNote;
    BYTE bHighNote;
    BYTE bLowVelocity;
    BYTE bHighVelocity;
} s_RIFFWAVE_inst;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct s_RIFFWAVE_inst
{
    public byte bUnshiftedNote;
    public sbyte chFineTune;
    public sbyte chGain;
    public byte bLowNote;
    public byte bHighNote;
    public byte bLowVelocity;
    public byte bHighVelocity;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure s_RIFFWAVE_inst
    Public bUnshiftedNote As Byte
    Public chFineTune As SByte
    Public chGain As SByte
    Public bLowNote As Byte
    Public bHighNote As Byte
    Public bLowVelocity As Byte
    Public bHighVelocity As Byte
End Structure
import ctypes
from ctypes import wintypes

class s_RIFFWAVE_inst(ctypes.Structure):
    _fields_ = [
        ("bUnshiftedNote", ctypes.c_ubyte),
        ("chFineTune", ctypes.c_byte),
        ("chGain", ctypes.c_byte),
        ("bLowNote", ctypes.c_ubyte),
        ("bHighNote", ctypes.c_ubyte),
        ("bLowVelocity", ctypes.c_ubyte),
        ("bHighVelocity", ctypes.c_ubyte),
    ]
#[repr(C)]
pub struct s_RIFFWAVE_inst {
    pub bUnshiftedNote: u8,
    pub chFineTune: i8,
    pub chGain: i8,
    pub bLowNote: u8,
    pub bHighNote: u8,
    pub bLowVelocity: u8,
    pub bHighVelocity: u8,
}
import "golang.org/x/sys/windows"

type s_RIFFWAVE_inst struct {
	bUnshiftedNote byte
	chFineTune int8
	chGain int8
	bLowNote byte
	bHighNote byte
	bLowVelocity byte
	bHighVelocity byte
}
type
  s_RIFFWAVE_inst = record
    bUnshiftedNote: Byte;
    chFineTune: Shortint;
    chGain: Shortint;
    bLowNote: Byte;
    bHighNote: Byte;
    bLowVelocity: Byte;
    bHighVelocity: Byte;
  end;
const s_RIFFWAVE_inst = extern struct {
    bUnshiftedNote: u8,
    chFineTune: i8,
    chGain: i8,
    bLowNote: u8,
    bHighNote: u8,
    bLowVelocity: u8,
    bHighVelocity: u8,
};
type
  s_RIFFWAVE_inst {.bycopy.} = object
    bUnshiftedNote: uint8
    chFineTune: int8
    chGain: int8
    bLowNote: uint8
    bHighNote: uint8
    bLowVelocity: uint8
    bHighVelocity: uint8
struct s_RIFFWAVE_inst
{
    ubyte bUnshiftedNote;
    byte chFineTune;
    byte chGain;
    ubyte bLowNote;
    ubyte bHighNote;
    ubyte bLowVelocity;
    ubyte bHighVelocity;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; s_RIFFWAVE_inst サイズ: 7 バイト(x64)
dim st, 2    ; 4byte整数×2(構造体サイズ 7 / 4 切り上げ)
; bUnshiftedNote : BYTE (+0, 1byte)  poke st,0,値  /  値 = peek(st,0)
; chFineTune : CHAR (+1, 1byte)  poke st,1,値  /  値 = peek(st,1)
; chGain : CHAR (+2, 1byte)  poke st,2,値  /  値 = peek(st,2)
; bLowNote : BYTE (+3, 1byte)  poke st,3,値  /  値 = peek(st,3)
; bHighNote : BYTE (+4, 1byte)  poke st,4,値  /  値 = peek(st,4)
; bLowVelocity : BYTE (+5, 1byte)  poke st,5,値  /  値 = peek(st,5)
; bHighVelocity : BYTE (+6, 1byte)  poke st,6,値  /  値 = peek(st,6)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global s_RIFFWAVE_inst
    #field byte bUnshiftedNote
    #field byte chFineTune
    #field byte chGain
    #field byte bLowNote
    #field byte bHighNote
    #field byte bLowVelocity
    #field byte bHighVelocity
#endstruct

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