ホーム › Media.Audio.Apo › UNCOMPRESSEDAUDIOFORMAT
UNCOMPRESSEDAUDIOFORMAT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| guidFormatType | GUID | 16 | +0 | +0 | データ形式の種類の GUID を指定します。 |
| dwSamplesPerFrame | DWORD | 4 | +16 | +16 | 1 フレームあたりのサンプル数を指定します。 |
| dwBytesPerSampleContainer | DWORD | 4 | +20 | +20 | サンプルの単位コンテナーを構成するバイト数を指定します。 |
| dwValidBitsPerSample | DWORD | 4 | +24 | +24 | 1 サンプルあたりの有効なビット数を指定します。 |
| fFramesPerSecond | FLOAT | 4 | +28 | +28 | ストリーミング オーディオ データの 1 秒あたりのフレーム数を指定します。 |
| dwChannelMask | DWORD | 4 | +32 | +32 | 非圧縮オーディオ データが使用するチャネル マスクを指定します。 |
公式ドキュメント
UNCOMPRESSEDAUDIOFORMAT 構造体は、非圧縮オーディオ データ形式のフレーム レート、チャネル マスク、およびその他の属性を指定します。
解説(Remarks)
この構造体は、非圧縮 PCM オーディオ形式を記述するパラメーターへのアクセスを提供します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// UNCOMPRESSEDAUDIOFORMAT (x64 36 / x86 36 バイト)
typedef struct UNCOMPRESSEDAUDIOFORMAT {
GUID guidFormatType;
DWORD dwSamplesPerFrame;
DWORD dwBytesPerSampleContainer;
DWORD dwValidBitsPerSample;
FLOAT fFramesPerSecond;
DWORD dwChannelMask;
} UNCOMPRESSEDAUDIOFORMAT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct UNCOMPRESSEDAUDIOFORMAT
{
public Guid guidFormatType;
public uint dwSamplesPerFrame;
public uint dwBytesPerSampleContainer;
public uint dwValidBitsPerSample;
public float fFramesPerSecond;
public uint dwChannelMask;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure UNCOMPRESSEDAUDIOFORMAT
Public guidFormatType As Guid
Public dwSamplesPerFrame As UInteger
Public dwBytesPerSampleContainer As UInteger
Public dwValidBitsPerSample As UInteger
Public fFramesPerSecond As Single
Public dwChannelMask As UInteger
End Structureimport ctypes
from ctypes import wintypes
class UNCOMPRESSEDAUDIOFORMAT(ctypes.Structure):
_fields_ = [
("guidFormatType", GUID),
("dwSamplesPerFrame", wintypes.DWORD),
("dwBytesPerSampleContainer", wintypes.DWORD),
("dwValidBitsPerSample", wintypes.DWORD),
("fFramesPerSecond", ctypes.c_float),
("dwChannelMask", wintypes.DWORD),
]#[repr(C)]
pub struct UNCOMPRESSEDAUDIOFORMAT {
pub guidFormatType: GUID,
pub dwSamplesPerFrame: u32,
pub dwBytesPerSampleContainer: u32,
pub dwValidBitsPerSample: u32,
pub fFramesPerSecond: f32,
pub dwChannelMask: u32,
}import "golang.org/x/sys/windows"
type UNCOMPRESSEDAUDIOFORMAT struct {
guidFormatType windows.GUID
dwSamplesPerFrame uint32
dwBytesPerSampleContainer uint32
dwValidBitsPerSample uint32
fFramesPerSecond float32
dwChannelMask uint32
}type
UNCOMPRESSEDAUDIOFORMAT = record
guidFormatType: TGUID;
dwSamplesPerFrame: DWORD;
dwBytesPerSampleContainer: DWORD;
dwValidBitsPerSample: DWORD;
fFramesPerSecond: Single;
dwChannelMask: DWORD;
end;const UNCOMPRESSEDAUDIOFORMAT = extern struct {
guidFormatType: GUID,
dwSamplesPerFrame: u32,
dwBytesPerSampleContainer: u32,
dwValidBitsPerSample: u32,
fFramesPerSecond: f32,
dwChannelMask: u32,
};type
UNCOMPRESSEDAUDIOFORMAT {.bycopy.} = object
guidFormatType: GUID
dwSamplesPerFrame: uint32
dwBytesPerSampleContainer: uint32
dwValidBitsPerSample: uint32
fFramesPerSecond: float32
dwChannelMask: uint32struct UNCOMPRESSEDAUDIOFORMAT
{
GUID guidFormatType;
uint dwSamplesPerFrame;
uint dwBytesPerSampleContainer;
uint dwValidBitsPerSample;
float fFramesPerSecond;
uint dwChannelMask;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; UNCOMPRESSEDAUDIOFORMAT サイズ: 36 バイト(x64)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; guidFormatType : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; dwSamplesPerFrame : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwBytesPerSampleContainer : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwValidBitsPerSample : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; fFramesPerSecond : FLOAT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwChannelMask : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global UNCOMPRESSEDAUDIOFORMAT
#field GUID guidFormatType
#field int dwSamplesPerFrame
#field int dwBytesPerSampleContainer
#field int dwValidBitsPerSample
#field float fFramesPerSecond
#field int dwChannelMask
#endstruct
stdim st, UNCOMPRESSEDAUDIOFORMAT ; NSTRUCT 変数を確保
st->dwSamplesPerFrame = 100
mes "dwSamplesPerFrame=" + st->dwSamplesPerFrame