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

CreateCaptureAudioStateMonitorForCategoryAndDeviceRole

関数
カテゴリとデバイスロール指定でキャプチャ状態監視を生成する。
DLLWindows.Media.MediaControl.dll呼出規約winapi

シグネチャ

// Windows.Media.MediaControl.dll
#include <windows.h>

HRESULT CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(
    AUDIO_STREAM_CATEGORY category,
    ERole role,
    IAudioStateMonitor** audioStateMonitor
);

パラメーター

名前方向
categoryAUDIO_STREAM_CATEGORYin
roleERolein
audioStateMonitorIAudioStateMonitor**out

戻り値の型: HRESULT

各言語での呼び出し定義

// Windows.Media.MediaControl.dll
#include <windows.h>

HRESULT CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(
    AUDIO_STREAM_CATEGORY category,
    ERole role,
    IAudioStateMonitor** audioStateMonitor
);
[DllImport("Windows.Media.MediaControl.dll", ExactSpelling = true)]
static extern int CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(
    int category,   // AUDIO_STREAM_CATEGORY
    int role,   // ERole
    IntPtr audioStateMonitor   // IAudioStateMonitor** out
);
<DllImport("Windows.Media.MediaControl.dll", ExactSpelling:=True)>
Public Shared Function CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(
    category As Integer,   ' AUDIO_STREAM_CATEGORY
    role As Integer,   ' ERole
    audioStateMonitor As IntPtr   ' IAudioStateMonitor** out
) As Integer
End Function
' category : AUDIO_STREAM_CATEGORY
' role : ERole
' audioStateMonitor : IAudioStateMonitor** out
Declare PtrSafe Function CreateCaptureAudioStateMonitorForCategoryAndDeviceRole Lib "windows.media.mediacontrol" ( _
    ByVal category As Long, _
    ByVal role As Long, _
    ByVal audioStateMonitor As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

CreateCaptureAudioStateMonitorForCategoryAndDeviceRole = ctypes.windll.LoadLibrary("Windows.Media.MediaControl.dll").CreateCaptureAudioStateMonitorForCategoryAndDeviceRole
CreateCaptureAudioStateMonitorForCategoryAndDeviceRole.restype = ctypes.c_int
CreateCaptureAudioStateMonitorForCategoryAndDeviceRole.argtypes = [
    ctypes.c_int,  # category : AUDIO_STREAM_CATEGORY
    ctypes.c_int,  # role : ERole
    ctypes.c_void_p,  # audioStateMonitor : IAudioStateMonitor** out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('Windows.Media.MediaControl.dll')
CreateCaptureAudioStateMonitorForCategoryAndDeviceRole = Fiddle::Function.new(
  lib['CreateCaptureAudioStateMonitorForCategoryAndDeviceRole'],
  [
    Fiddle::TYPE_INT,  # category : AUDIO_STREAM_CATEGORY
    Fiddle::TYPE_INT,  # role : ERole
    Fiddle::TYPE_VOIDP,  # audioStateMonitor : IAudioStateMonitor** out
  ],
  Fiddle::TYPE_INT)
#[link(name = "windows.media.mediacontrol")]
extern "system" {
    fn CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(
        category: i32,  // AUDIO_STREAM_CATEGORY
        role: i32,  // ERole
        audioStateMonitor: *mut *mut core::ffi::c_void  // IAudioStateMonitor** out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("Windows.Media.MediaControl.dll")]
public static extern int CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(int category, int role, IntPtr audioStateMonitor);
"@
$api = Add-Type -MemberDefinition $sig -Name 'Windows.Media.MediaControl_CreateCaptureAudioStateMonitorForCategoryAndDeviceRole' -Namespace Win32 -PassThru
# $api::CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(category, role, audioStateMonitor)
#uselib "Windows.Media.MediaControl.dll"
#func global CreateCaptureAudioStateMonitorForCategoryAndDeviceRole "CreateCaptureAudioStateMonitorForCategoryAndDeviceRole" sptr, sptr, sptr
; CreateCaptureAudioStateMonitorForCategoryAndDeviceRole category, role, audioStateMonitor   ; 戻り値は stat
; category : AUDIO_STREAM_CATEGORY -> "sptr"
; role : ERole -> "sptr"
; audioStateMonitor : IAudioStateMonitor** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "Windows.Media.MediaControl.dll"
#cfunc global CreateCaptureAudioStateMonitorForCategoryAndDeviceRole "CreateCaptureAudioStateMonitorForCategoryAndDeviceRole" int, int, sptr
; res = CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(category, role, audioStateMonitor)
; category : AUDIO_STREAM_CATEGORY -> "int"
; role : ERole -> "int"
; audioStateMonitor : IAudioStateMonitor** out -> "sptr"
; HRESULT CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(AUDIO_STREAM_CATEGORY category, ERole role, IAudioStateMonitor** audioStateMonitor)
#uselib "Windows.Media.MediaControl.dll"
#cfunc global CreateCaptureAudioStateMonitorForCategoryAndDeviceRole "CreateCaptureAudioStateMonitorForCategoryAndDeviceRole" int, int, intptr
; res = CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(category, role, audioStateMonitor)
; category : AUDIO_STREAM_CATEGORY -> "int"
; role : ERole -> "int"
; audioStateMonitor : IAudioStateMonitor** out -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	windows_media_mediacontrol = windows.NewLazySystemDLL("Windows.Media.MediaControl.dll")
	procCreateCaptureAudioStateMonitorForCategoryAndDeviceRole = windows_media_mediacontrol.NewProc("CreateCaptureAudioStateMonitorForCategoryAndDeviceRole")
)

// category (AUDIO_STREAM_CATEGORY), role (ERole), audioStateMonitor (IAudioStateMonitor** out)
r1, _, err := procCreateCaptureAudioStateMonitorForCategoryAndDeviceRole.Call(
	uintptr(category),
	uintptr(role),
	uintptr(audioStateMonitor),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(
  category: Integer;   // AUDIO_STREAM_CATEGORY
  role: Integer;   // ERole
  audioStateMonitor: Pointer   // IAudioStateMonitor** out
): Integer; stdcall;
  external 'Windows.Media.MediaControl.dll' name 'CreateCaptureAudioStateMonitorForCategoryAndDeviceRole';
result := DllCall("Windows.Media.MediaControl\CreateCaptureAudioStateMonitorForCategoryAndDeviceRole"
    , "Int", category   ; AUDIO_STREAM_CATEGORY
    , "Int", role   ; ERole
    , "Ptr", audioStateMonitor   ; IAudioStateMonitor** out
    , "Int")   ; return: HRESULT
●CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(category, role, audioStateMonitor) = DLL("Windows.Media.MediaControl.dll", "int CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(int, int, void*)")
# 呼び出し: CreateCaptureAudioStateMonitorForCategoryAndDeviceRole(category, role, audioStateMonitor)
# category : AUDIO_STREAM_CATEGORY -> "int"
# role : ERole -> "int"
# audioStateMonitor : IAudioStateMonitor** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。