ホーム › Media.Audio.DirectSound › DirectSoundCaptureCreate
DirectSoundCaptureCreate
関数DirectSoundキャプチャデバイスオブジェクトを生成する。
シグネチャ
// DSOUND.dll
#include <windows.h>
HRESULT DirectSoundCaptureCreate(
const GUID* pcGuidDevice, // optional
IDirectSoundCapture** ppDSC,
IUnknown* pUnkOuter // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pcGuidDevice | GUID* | inoptional |
| ppDSC | IDirectSoundCapture** | out |
| pUnkOuter | IUnknown* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// DSOUND.dll
#include <windows.h>
HRESULT DirectSoundCaptureCreate(
const GUID* pcGuidDevice, // optional
IDirectSoundCapture** ppDSC,
IUnknown* pUnkOuter // optional
);[DllImport("DSOUND.dll", ExactSpelling = true)]
static extern int DirectSoundCaptureCreate(
IntPtr pcGuidDevice, // GUID* optional
IntPtr ppDSC, // IDirectSoundCapture** out
IntPtr pUnkOuter // IUnknown* optional
);<DllImport("DSOUND.dll", ExactSpelling:=True)>
Public Shared Function DirectSoundCaptureCreate(
pcGuidDevice As IntPtr, ' GUID* optional
ppDSC As IntPtr, ' IDirectSoundCapture** out
pUnkOuter As IntPtr ' IUnknown* optional
) As Integer
End Function' pcGuidDevice : GUID* optional
' ppDSC : IDirectSoundCapture** out
' pUnkOuter : IUnknown* optional
Declare PtrSafe Function DirectSoundCaptureCreate Lib "dsound" ( _
ByVal pcGuidDevice As LongPtr, _
ByVal ppDSC As LongPtr, _
ByVal pUnkOuter As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
DirectSoundCaptureCreate = ctypes.windll.dsound.DirectSoundCaptureCreate
DirectSoundCaptureCreate.restype = ctypes.c_int
DirectSoundCaptureCreate.argtypes = [
ctypes.c_void_p, # pcGuidDevice : GUID* optional
ctypes.c_void_p, # ppDSC : IDirectSoundCapture** out
ctypes.c_void_p, # pUnkOuter : IUnknown* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DSOUND.dll')
DirectSoundCaptureCreate = Fiddle::Function.new(
lib['DirectSoundCaptureCreate'],
[
Fiddle::TYPE_VOIDP, # pcGuidDevice : GUID* optional
Fiddle::TYPE_VOIDP, # ppDSC : IDirectSoundCapture** out
Fiddle::TYPE_VOIDP, # pUnkOuter : IUnknown* optional
],
Fiddle::TYPE_INT)#[link(name = "dsound")]
extern "system" {
fn DirectSoundCaptureCreate(
pcGuidDevice: *const GUID, // GUID* optional
ppDSC: *mut *mut core::ffi::c_void, // IDirectSoundCapture** out
pUnkOuter: *mut core::ffi::c_void // IUnknown* optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("DSOUND.dll")]
public static extern int DirectSoundCaptureCreate(IntPtr pcGuidDevice, IntPtr ppDSC, IntPtr pUnkOuter);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DSOUND_DirectSoundCaptureCreate' -Namespace Win32 -PassThru
# $api::DirectSoundCaptureCreate(pcGuidDevice, ppDSC, pUnkOuter)#uselib "DSOUND.dll"
#func global DirectSoundCaptureCreate "DirectSoundCaptureCreate" sptr, sptr, sptr
; DirectSoundCaptureCreate varptr(pcGuidDevice), ppDSC, pUnkOuter ; 戻り値は stat
; pcGuidDevice : GUID* optional -> "sptr"
; ppDSC : IDirectSoundCapture** out -> "sptr"
; pUnkOuter : IUnknown* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "DSOUND.dll" #cfunc global DirectSoundCaptureCreate "DirectSoundCaptureCreate" var, sptr, sptr ; res = DirectSoundCaptureCreate(pcGuidDevice, ppDSC, pUnkOuter) ; pcGuidDevice : GUID* optional -> "var" ; ppDSC : IDirectSoundCapture** out -> "sptr" ; pUnkOuter : IUnknown* optional -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "DSOUND.dll" #cfunc global DirectSoundCaptureCreate "DirectSoundCaptureCreate" sptr, sptr, sptr ; res = DirectSoundCaptureCreate(varptr(pcGuidDevice), ppDSC, pUnkOuter) ; pcGuidDevice : GUID* optional -> "sptr" ; ppDSC : IDirectSoundCapture** out -> "sptr" ; pUnkOuter : IUnknown* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DirectSoundCaptureCreate(GUID* pcGuidDevice, IDirectSoundCapture** ppDSC, IUnknown* pUnkOuter) #uselib "DSOUND.dll" #cfunc global DirectSoundCaptureCreate "DirectSoundCaptureCreate" var, intptr, intptr ; res = DirectSoundCaptureCreate(pcGuidDevice, ppDSC, pUnkOuter) ; pcGuidDevice : GUID* optional -> "var" ; ppDSC : IDirectSoundCapture** out -> "intptr" ; pUnkOuter : IUnknown* optional -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DirectSoundCaptureCreate(GUID* pcGuidDevice, IDirectSoundCapture** ppDSC, IUnknown* pUnkOuter) #uselib "DSOUND.dll" #cfunc global DirectSoundCaptureCreate "DirectSoundCaptureCreate" intptr, intptr, intptr ; res = DirectSoundCaptureCreate(varptr(pcGuidDevice), ppDSC, pUnkOuter) ; pcGuidDevice : GUID* optional -> "intptr" ; ppDSC : IDirectSoundCapture** out -> "intptr" ; pUnkOuter : IUnknown* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dsound = windows.NewLazySystemDLL("DSOUND.dll")
procDirectSoundCaptureCreate = dsound.NewProc("DirectSoundCaptureCreate")
)
// pcGuidDevice (GUID* optional), ppDSC (IDirectSoundCapture** out), pUnkOuter (IUnknown* optional)
r1, _, err := procDirectSoundCaptureCreate.Call(
uintptr(pcGuidDevice),
uintptr(ppDSC),
uintptr(pUnkOuter),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DirectSoundCaptureCreate(
pcGuidDevice: PGUID; // GUID* optional
ppDSC: Pointer; // IDirectSoundCapture** out
pUnkOuter: Pointer // IUnknown* optional
): Integer; stdcall;
external 'DSOUND.dll' name 'DirectSoundCaptureCreate';result := DllCall("DSOUND\DirectSoundCaptureCreate"
, "Ptr", pcGuidDevice ; GUID* optional
, "Ptr", ppDSC ; IDirectSoundCapture** out
, "Ptr", pUnkOuter ; IUnknown* optional
, "Int") ; return: HRESULT●DirectSoundCaptureCreate(pcGuidDevice, ppDSC, pUnkOuter) = DLL("DSOUND.dll", "int DirectSoundCaptureCreate(void*, void*, void*)")
# 呼び出し: DirectSoundCaptureCreate(pcGuidDevice, ppDSC, pUnkOuter)
# pcGuidDevice : GUID* optional -> "void*"
# ppDSC : IDirectSoundCapture** out -> "void*"
# pUnkOuter : IUnknown* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。