ホーム › Media.Audio › acmMetrics
acmMetrics
関数ACMオブジェクトに関する各種メトリック情報を取得する。
シグネチャ
// MSACM32.dll
#include <windows.h>
DWORD acmMetrics(
HACMOBJ hao,
DWORD uMetric,
void* pMetric
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| hao | HACMOBJ | in | uMetric で指定したメトリックを問い合わせる対象の ACM オブジェクトへのハンドル。一部の問い合わせでは、このパラメーターを NULL にできます。 | ||||||||||||||||||||||||||||||||||||
| uMetric | DWORD | in | pMetric に返されるメトリックのインデックス。
| ||||||||||||||||||||||||||||||||||||
| pMetric | void* | inout | メトリックの詳細を受け取るバッファーへのポインター。正確な定義は uMetric インデックスによって異なります。 |
戻り値の型: DWORD
公式ドキュメント
acmMetrics 関数は、ACM または関連する ACM オブジェクトに関するさまざまなメトリックを返します。
戻り値
成功した場合は 0 を返し、それ以外の場合はエラーを返します。返される可能性のあるエラー値には、次のものがあります。
| 戻り値 | 説明 |
|---|---|
| uMetric で指定したインデックスは、指定した hao に対して返すことができません。 | |
| 指定したハンドルが無効です。 | |
| 少なくとも 1 つのパラメーターが無効です。 | |
| uMetric で指定したインデックスはサポートされていません。 |
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// MSACM32.dll
#include <windows.h>
DWORD acmMetrics(
HACMOBJ hao,
DWORD uMetric,
void* pMetric
);[DllImport("MSACM32.dll", ExactSpelling = true)]
static extern uint acmMetrics(
IntPtr hao, // HACMOBJ
uint uMetric, // DWORD
IntPtr pMetric // void* in/out
);<DllImport("MSACM32.dll", ExactSpelling:=True)>
Public Shared Function acmMetrics(
hao As IntPtr, ' HACMOBJ
uMetric As UInteger, ' DWORD
pMetric As IntPtr ' void* in/out
) As UInteger
End Function' hao : HACMOBJ
' uMetric : DWORD
' pMetric : void* in/out
Declare PtrSafe Function acmMetrics Lib "msacm32" ( _
ByVal hao As LongPtr, _
ByVal uMetric As Long, _
ByVal pMetric As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
acmMetrics = ctypes.windll.msacm32.acmMetrics
acmMetrics.restype = wintypes.DWORD
acmMetrics.argtypes = [
wintypes.HANDLE, # hao : HACMOBJ
wintypes.DWORD, # uMetric : DWORD
ctypes.POINTER(None), # pMetric : void* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSACM32.dll')
acmMetrics = Fiddle::Function.new(
lib['acmMetrics'],
[
Fiddle::TYPE_VOIDP, # hao : HACMOBJ
-Fiddle::TYPE_INT, # uMetric : DWORD
Fiddle::TYPE_VOIDP, # pMetric : void* in/out
],
-Fiddle::TYPE_INT)#[link(name = "msacm32")]
extern "system" {
fn acmMetrics(
hao: *mut core::ffi::c_void, // HACMOBJ
uMetric: u32, // DWORD
pMetric: *mut () // void* in/out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSACM32.dll")]
public static extern uint acmMetrics(IntPtr hao, uint uMetric, IntPtr pMetric);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSACM32_acmMetrics' -Namespace Win32 -PassThru
# $api::acmMetrics(hao, uMetric, pMetric)#uselib "MSACM32.dll"
#func global acmMetrics "acmMetrics" sptr, sptr, sptr
; acmMetrics hao, uMetric, pMetric ; 戻り値は stat
; hao : HACMOBJ -> "sptr"
; uMetric : DWORD -> "sptr"
; pMetric : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "MSACM32.dll"
#cfunc global acmMetrics "acmMetrics" sptr, int, sptr
; res = acmMetrics(hao, uMetric, pMetric)
; hao : HACMOBJ -> "sptr"
; uMetric : DWORD -> "int"
; pMetric : void* in/out -> "sptr"; DWORD acmMetrics(HACMOBJ hao, DWORD uMetric, void* pMetric)
#uselib "MSACM32.dll"
#cfunc global acmMetrics "acmMetrics" intptr, int, intptr
; res = acmMetrics(hao, uMetric, pMetric)
; hao : HACMOBJ -> "intptr"
; uMetric : DWORD -> "int"
; pMetric : void* in/out -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msacm32 = windows.NewLazySystemDLL("MSACM32.dll")
procacmMetrics = msacm32.NewProc("acmMetrics")
)
// hao (HACMOBJ), uMetric (DWORD), pMetric (void* in/out)
r1, _, err := procacmMetrics.Call(
uintptr(hao),
uintptr(uMetric),
uintptr(pMetric),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction acmMetrics(
hao: THandle; // HACMOBJ
uMetric: DWORD; // DWORD
pMetric: Pointer // void* in/out
): DWORD; stdcall;
external 'MSACM32.dll' name 'acmMetrics';result := DllCall("MSACM32\acmMetrics"
, "Ptr", hao ; HACMOBJ
, "UInt", uMetric ; DWORD
, "Ptr", pMetric ; void* in/out
, "UInt") ; return: DWORD●acmMetrics(hao, uMetric, pMetric) = DLL("MSACM32.dll", "dword acmMetrics(void*, dword, void*)")
# 呼び出し: acmMetrics(hao, uMetric, pMetric)
# hao : HACMOBJ -> "void*"
# uMetric : DWORD -> "dword"
# pMetric : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msacm32" fn acmMetrics(
hao: ?*anyopaque, // HACMOBJ
uMetric: u32, // DWORD
pMetric: ?*anyopaque // void* in/out
) callconv(std.os.windows.WINAPI) u32;proc acmMetrics(
hao: pointer, # HACMOBJ
uMetric: uint32, # DWORD
pMetric: pointer # void* in/out
): uint32 {.importc: "acmMetrics", stdcall, dynlib: "MSACM32.dll".}pragma(lib, "msacm32");
extern(Windows)
uint acmMetrics(
void* hao, // HACMOBJ
uint uMetric, // DWORD
void* pMetric // void* in/out
);ccall((:acmMetrics, "MSACM32.dll"), stdcall, UInt32,
(Ptr{Cvoid}, UInt32, Ptr{Cvoid}),
hao, uMetric, pMetric)
# hao : HACMOBJ -> Ptr{Cvoid}
# uMetric : DWORD -> UInt32
# pMetric : void* in/out -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t acmMetrics(
void* hao,
uint32_t uMetric,
void* pMetric);
]]
local msacm32 = ffi.load("msacm32")
-- msacm32.acmMetrics(hao, uMetric, pMetric)
-- hao : HACMOBJ
-- uMetric : DWORD
-- pMetric : void* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MSACM32.dll');
const acmMetrics = lib.func('__stdcall', 'acmMetrics', 'uint32_t', ['void *', 'uint32_t', 'void *']);
// acmMetrics(hao, uMetric, pMetric)
// hao : HACMOBJ -> 'void *'
// uMetric : DWORD -> 'uint32_t'
// pMetric : void* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MSACM32.dll", {
acmMetrics: { parameters: ["pointer", "u32", "pointer"], result: "u32" },
});
// lib.symbols.acmMetrics(hao, uMetric, pMetric)
// hao : HACMOBJ -> "pointer"
// uMetric : DWORD -> "u32"
// pMetric : void* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t acmMetrics(
void* hao,
uint32_t uMetric,
void* pMetric);
C, "MSACM32.dll");
// $ffi->acmMetrics(hao, uMetric, pMetric);
// hao : HACMOBJ
// uMetric : DWORD
// pMetric : void* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Msacm32 extends StdCallLibrary {
Msacm32 INSTANCE = Native.load("msacm32", Msacm32.class);
int acmMetrics(
Pointer hao, // HACMOBJ
int uMetric, // DWORD
Pointer pMetric // void* in/out
);
}@[Link("msacm32")]
lib LibMSACM32
fun acmMetrics = acmMetrics(
hao : Void*, # HACMOBJ
uMetric : UInt32, # DWORD
pMetric : Void* # void* in/out
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef acmMetricsNative = Uint32 Function(Pointer<Void>, Uint32, Pointer<Void>);
typedef acmMetricsDart = int Function(Pointer<Void>, int, Pointer<Void>);
final acmMetrics = DynamicLibrary.open('MSACM32.dll')
.lookupFunction<acmMetricsNative, acmMetricsDart>('acmMetrics');
// hao : HACMOBJ -> Pointer<Void>
// uMetric : DWORD -> Uint32
// pMetric : void* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function acmMetrics(
hao: THandle; // HACMOBJ
uMetric: DWORD; // DWORD
pMetric: Pointer // void* in/out
): DWORD; stdcall;
external 'MSACM32.dll' name 'acmMetrics';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "acmMetrics"
c_acmMetrics :: Ptr () -> Word32 -> Ptr () -> IO Word32
-- hao : HACMOBJ -> Ptr ()
-- uMetric : DWORD -> Word32
-- pMetric : void* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let acmmetrics =
foreign "acmMetrics"
((ptr void) @-> uint32_t @-> (ptr void) @-> returning uint32_t)
(* hao : HACMOBJ -> (ptr void) *)
(* uMetric : DWORD -> uint32_t *)
(* pMetric : void* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msacm32 (t "MSACM32.dll"))
(cffi:use-foreign-library msacm32)
(cffi:defcfun ("acmMetrics" acm-metrics :convention :stdcall) :uint32
(hao :pointer) ; HACMOBJ
(u-metric :uint32) ; DWORD
(p-metric :pointer)) ; void* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $acmMetrics = Win32::API::More->new('MSACM32',
'DWORD acmMetrics(HANDLE hao, DWORD uMetric, LPVOID pMetric)');
# my $ret = $acmMetrics->Call($hao, $uMetric, $pMetric);
# hao : HACMOBJ -> HANDLE
# uMetric : DWORD -> DWORD
# pMetric : void* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。