ホーム › Media.Audio.DirectSound › DirectSoundFullDuplexCreate
DirectSoundFullDuplexCreate
関数再生と録音を同時に行う全二重DirectSoundオブジェクトを生成する。
シグネチャ
// DSOUND.dll
#include <windows.h>
HRESULT DirectSoundFullDuplexCreate(
const GUID* pcGuidCaptureDevice, // optional
const GUID* pcGuidRenderDevice, // optional
DSCBUFFERDESC* pcDSCBufferDesc,
DSBUFFERDESC* pcDSBufferDesc,
HWND hWnd,
DWORD dwLevel,
IDirectSoundFullDuplex** ppDSFD,
IDirectSoundCaptureBuffer8** ppDSCBuffer8,
IDirectSoundBuffer8** ppDSBuffer8,
IUnknown* pUnkOuter // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| pcGuidCaptureDevice | GUID* | inoptional |
| pcGuidRenderDevice | GUID* | inoptional |
| pcDSCBufferDesc | DSCBUFFERDESC* | in |
| pcDSBufferDesc | DSBUFFERDESC* | in |
| hWnd | HWND | in |
| dwLevel | DWORD | in |
| ppDSFD | IDirectSoundFullDuplex** | out |
| ppDSCBuffer8 | IDirectSoundCaptureBuffer8** | out |
| ppDSBuffer8 | IDirectSoundBuffer8** | out |
| pUnkOuter | IUnknown* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// DSOUND.dll
#include <windows.h>
HRESULT DirectSoundFullDuplexCreate(
const GUID* pcGuidCaptureDevice, // optional
const GUID* pcGuidRenderDevice, // optional
DSCBUFFERDESC* pcDSCBufferDesc,
DSBUFFERDESC* pcDSBufferDesc,
HWND hWnd,
DWORD dwLevel,
IDirectSoundFullDuplex** ppDSFD,
IDirectSoundCaptureBuffer8** ppDSCBuffer8,
IDirectSoundBuffer8** ppDSBuffer8,
IUnknown* pUnkOuter // optional
);[DllImport("DSOUND.dll", ExactSpelling = true)]
static extern int DirectSoundFullDuplexCreate(
IntPtr pcGuidCaptureDevice, // GUID* optional
IntPtr pcGuidRenderDevice, // GUID* optional
IntPtr pcDSCBufferDesc, // DSCBUFFERDESC*
IntPtr pcDSBufferDesc, // DSBUFFERDESC*
IntPtr hWnd, // HWND
uint dwLevel, // DWORD
IntPtr ppDSFD, // IDirectSoundFullDuplex** out
IntPtr ppDSCBuffer8, // IDirectSoundCaptureBuffer8** out
IntPtr ppDSBuffer8, // IDirectSoundBuffer8** out
IntPtr pUnkOuter // IUnknown* optional
);<DllImport("DSOUND.dll", ExactSpelling:=True)>
Public Shared Function DirectSoundFullDuplexCreate(
pcGuidCaptureDevice As IntPtr, ' GUID* optional
pcGuidRenderDevice As IntPtr, ' GUID* optional
pcDSCBufferDesc As IntPtr, ' DSCBUFFERDESC*
pcDSBufferDesc As IntPtr, ' DSBUFFERDESC*
hWnd As IntPtr, ' HWND
dwLevel As UInteger, ' DWORD
ppDSFD As IntPtr, ' IDirectSoundFullDuplex** out
ppDSCBuffer8 As IntPtr, ' IDirectSoundCaptureBuffer8** out
ppDSBuffer8 As IntPtr, ' IDirectSoundBuffer8** out
pUnkOuter As IntPtr ' IUnknown* optional
) As Integer
End Function' pcGuidCaptureDevice : GUID* optional
' pcGuidRenderDevice : GUID* optional
' pcDSCBufferDesc : DSCBUFFERDESC*
' pcDSBufferDesc : DSBUFFERDESC*
' hWnd : HWND
' dwLevel : DWORD
' ppDSFD : IDirectSoundFullDuplex** out
' ppDSCBuffer8 : IDirectSoundCaptureBuffer8** out
' ppDSBuffer8 : IDirectSoundBuffer8** out
' pUnkOuter : IUnknown* optional
Declare PtrSafe Function DirectSoundFullDuplexCreate Lib "dsound" ( _
ByVal pcGuidCaptureDevice As LongPtr, _
ByVal pcGuidRenderDevice As LongPtr, _
ByVal pcDSCBufferDesc As LongPtr, _
ByVal pcDSBufferDesc As LongPtr, _
ByVal hWnd As LongPtr, _
ByVal dwLevel As Long, _
ByVal ppDSFD As LongPtr, _
ByVal ppDSCBuffer8 As LongPtr, _
ByVal ppDSBuffer8 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
DirectSoundFullDuplexCreate = ctypes.windll.dsound.DirectSoundFullDuplexCreate
DirectSoundFullDuplexCreate.restype = ctypes.c_int
DirectSoundFullDuplexCreate.argtypes = [
ctypes.c_void_p, # pcGuidCaptureDevice : GUID* optional
ctypes.c_void_p, # pcGuidRenderDevice : GUID* optional
ctypes.c_void_p, # pcDSCBufferDesc : DSCBUFFERDESC*
ctypes.c_void_p, # pcDSBufferDesc : DSBUFFERDESC*
wintypes.HANDLE, # hWnd : HWND
wintypes.DWORD, # dwLevel : DWORD
ctypes.c_void_p, # ppDSFD : IDirectSoundFullDuplex** out
ctypes.c_void_p, # ppDSCBuffer8 : IDirectSoundCaptureBuffer8** out
ctypes.c_void_p, # ppDSBuffer8 : IDirectSoundBuffer8** out
ctypes.c_void_p, # pUnkOuter : IUnknown* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DSOUND.dll')
DirectSoundFullDuplexCreate = Fiddle::Function.new(
lib['DirectSoundFullDuplexCreate'],
[
Fiddle::TYPE_VOIDP, # pcGuidCaptureDevice : GUID* optional
Fiddle::TYPE_VOIDP, # pcGuidRenderDevice : GUID* optional
Fiddle::TYPE_VOIDP, # pcDSCBufferDesc : DSCBUFFERDESC*
Fiddle::TYPE_VOIDP, # pcDSBufferDesc : DSBUFFERDESC*
Fiddle::TYPE_VOIDP, # hWnd : HWND
-Fiddle::TYPE_INT, # dwLevel : DWORD
Fiddle::TYPE_VOIDP, # ppDSFD : IDirectSoundFullDuplex** out
Fiddle::TYPE_VOIDP, # ppDSCBuffer8 : IDirectSoundCaptureBuffer8** out
Fiddle::TYPE_VOIDP, # ppDSBuffer8 : IDirectSoundBuffer8** out
Fiddle::TYPE_VOIDP, # pUnkOuter : IUnknown* optional
],
Fiddle::TYPE_INT)#[link(name = "dsound")]
extern "system" {
fn DirectSoundFullDuplexCreate(
pcGuidCaptureDevice: *const GUID, // GUID* optional
pcGuidRenderDevice: *const GUID, // GUID* optional
pcDSCBufferDesc: *mut DSCBUFFERDESC, // DSCBUFFERDESC*
pcDSBufferDesc: *mut DSBUFFERDESC, // DSBUFFERDESC*
hWnd: *mut core::ffi::c_void, // HWND
dwLevel: u32, // DWORD
ppDSFD: *mut *mut core::ffi::c_void, // IDirectSoundFullDuplex** out
ppDSCBuffer8: *mut *mut core::ffi::c_void, // IDirectSoundCaptureBuffer8** out
ppDSBuffer8: *mut *mut core::ffi::c_void, // IDirectSoundBuffer8** 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 DirectSoundFullDuplexCreate(IntPtr pcGuidCaptureDevice, IntPtr pcGuidRenderDevice, IntPtr pcDSCBufferDesc, IntPtr pcDSBufferDesc, IntPtr hWnd, uint dwLevel, IntPtr ppDSFD, IntPtr ppDSCBuffer8, IntPtr ppDSBuffer8, IntPtr pUnkOuter);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DSOUND_DirectSoundFullDuplexCreate' -Namespace Win32 -PassThru
# $api::DirectSoundFullDuplexCreate(pcGuidCaptureDevice, pcGuidRenderDevice, pcDSCBufferDesc, pcDSBufferDesc, hWnd, dwLevel, ppDSFD, ppDSCBuffer8, ppDSBuffer8, pUnkOuter)#uselib "DSOUND.dll"
#func global DirectSoundFullDuplexCreate "DirectSoundFullDuplexCreate" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; DirectSoundFullDuplexCreate varptr(pcGuidCaptureDevice), varptr(pcGuidRenderDevice), varptr(pcDSCBufferDesc), varptr(pcDSBufferDesc), hWnd, dwLevel, ppDSFD, ppDSCBuffer8, ppDSBuffer8, pUnkOuter ; 戻り値は stat
; pcGuidCaptureDevice : GUID* optional -> "sptr"
; pcGuidRenderDevice : GUID* optional -> "sptr"
; pcDSCBufferDesc : DSCBUFFERDESC* -> "sptr"
; pcDSBufferDesc : DSBUFFERDESC* -> "sptr"
; hWnd : HWND -> "sptr"
; dwLevel : DWORD -> "sptr"
; ppDSFD : IDirectSoundFullDuplex** out -> "sptr"
; ppDSCBuffer8 : IDirectSoundCaptureBuffer8** out -> "sptr"
; ppDSBuffer8 : IDirectSoundBuffer8** out -> "sptr"
; pUnkOuter : IUnknown* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "DSOUND.dll" #cfunc global DirectSoundFullDuplexCreate "DirectSoundFullDuplexCreate" var, var, var, var, sptr, int, sptr, sptr, sptr, sptr ; res = DirectSoundFullDuplexCreate(pcGuidCaptureDevice, pcGuidRenderDevice, pcDSCBufferDesc, pcDSBufferDesc, hWnd, dwLevel, ppDSFD, ppDSCBuffer8, ppDSBuffer8, pUnkOuter) ; pcGuidCaptureDevice : GUID* optional -> "var" ; pcGuidRenderDevice : GUID* optional -> "var" ; pcDSCBufferDesc : DSCBUFFERDESC* -> "var" ; pcDSBufferDesc : DSBUFFERDESC* -> "var" ; hWnd : HWND -> "sptr" ; dwLevel : DWORD -> "int" ; ppDSFD : IDirectSoundFullDuplex** out -> "sptr" ; ppDSCBuffer8 : IDirectSoundCaptureBuffer8** out -> "sptr" ; ppDSBuffer8 : IDirectSoundBuffer8** out -> "sptr" ; pUnkOuter : IUnknown* optional -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "DSOUND.dll" #cfunc global DirectSoundFullDuplexCreate "DirectSoundFullDuplexCreate" sptr, sptr, sptr, sptr, sptr, int, sptr, sptr, sptr, sptr ; res = DirectSoundFullDuplexCreate(varptr(pcGuidCaptureDevice), varptr(pcGuidRenderDevice), varptr(pcDSCBufferDesc), varptr(pcDSBufferDesc), hWnd, dwLevel, ppDSFD, ppDSCBuffer8, ppDSBuffer8, pUnkOuter) ; pcGuidCaptureDevice : GUID* optional -> "sptr" ; pcGuidRenderDevice : GUID* optional -> "sptr" ; pcDSCBufferDesc : DSCBUFFERDESC* -> "sptr" ; pcDSBufferDesc : DSBUFFERDESC* -> "sptr" ; hWnd : HWND -> "sptr" ; dwLevel : DWORD -> "int" ; ppDSFD : IDirectSoundFullDuplex** out -> "sptr" ; ppDSCBuffer8 : IDirectSoundCaptureBuffer8** out -> "sptr" ; ppDSBuffer8 : IDirectSoundBuffer8** out -> "sptr" ; pUnkOuter : IUnknown* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DirectSoundFullDuplexCreate(GUID* pcGuidCaptureDevice, GUID* pcGuidRenderDevice, DSCBUFFERDESC* pcDSCBufferDesc, DSBUFFERDESC* pcDSBufferDesc, HWND hWnd, DWORD dwLevel, IDirectSoundFullDuplex** ppDSFD, IDirectSoundCaptureBuffer8** ppDSCBuffer8, IDirectSoundBuffer8** ppDSBuffer8, IUnknown* pUnkOuter) #uselib "DSOUND.dll" #cfunc global DirectSoundFullDuplexCreate "DirectSoundFullDuplexCreate" var, var, var, var, intptr, int, intptr, intptr, intptr, intptr ; res = DirectSoundFullDuplexCreate(pcGuidCaptureDevice, pcGuidRenderDevice, pcDSCBufferDesc, pcDSBufferDesc, hWnd, dwLevel, ppDSFD, ppDSCBuffer8, ppDSBuffer8, pUnkOuter) ; pcGuidCaptureDevice : GUID* optional -> "var" ; pcGuidRenderDevice : GUID* optional -> "var" ; pcDSCBufferDesc : DSCBUFFERDESC* -> "var" ; pcDSBufferDesc : DSBUFFERDESC* -> "var" ; hWnd : HWND -> "intptr" ; dwLevel : DWORD -> "int" ; ppDSFD : IDirectSoundFullDuplex** out -> "intptr" ; ppDSCBuffer8 : IDirectSoundCaptureBuffer8** out -> "intptr" ; ppDSBuffer8 : IDirectSoundBuffer8** out -> "intptr" ; pUnkOuter : IUnknown* optional -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DirectSoundFullDuplexCreate(GUID* pcGuidCaptureDevice, GUID* pcGuidRenderDevice, DSCBUFFERDESC* pcDSCBufferDesc, DSBUFFERDESC* pcDSBufferDesc, HWND hWnd, DWORD dwLevel, IDirectSoundFullDuplex** ppDSFD, IDirectSoundCaptureBuffer8** ppDSCBuffer8, IDirectSoundBuffer8** ppDSBuffer8, IUnknown* pUnkOuter) #uselib "DSOUND.dll" #cfunc global DirectSoundFullDuplexCreate "DirectSoundFullDuplexCreate" intptr, intptr, intptr, intptr, intptr, int, intptr, intptr, intptr, intptr ; res = DirectSoundFullDuplexCreate(varptr(pcGuidCaptureDevice), varptr(pcGuidRenderDevice), varptr(pcDSCBufferDesc), varptr(pcDSBufferDesc), hWnd, dwLevel, ppDSFD, ppDSCBuffer8, ppDSBuffer8, pUnkOuter) ; pcGuidCaptureDevice : GUID* optional -> "intptr" ; pcGuidRenderDevice : GUID* optional -> "intptr" ; pcDSCBufferDesc : DSCBUFFERDESC* -> "intptr" ; pcDSBufferDesc : DSBUFFERDESC* -> "intptr" ; hWnd : HWND -> "intptr" ; dwLevel : DWORD -> "int" ; ppDSFD : IDirectSoundFullDuplex** out -> "intptr" ; ppDSCBuffer8 : IDirectSoundCaptureBuffer8** out -> "intptr" ; ppDSBuffer8 : IDirectSoundBuffer8** out -> "intptr" ; pUnkOuter : IUnknown* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dsound = windows.NewLazySystemDLL("DSOUND.dll")
procDirectSoundFullDuplexCreate = dsound.NewProc("DirectSoundFullDuplexCreate")
)
// pcGuidCaptureDevice (GUID* optional), pcGuidRenderDevice (GUID* optional), pcDSCBufferDesc (DSCBUFFERDESC*), pcDSBufferDesc (DSBUFFERDESC*), hWnd (HWND), dwLevel (DWORD), ppDSFD (IDirectSoundFullDuplex** out), ppDSCBuffer8 (IDirectSoundCaptureBuffer8** out), ppDSBuffer8 (IDirectSoundBuffer8** out), pUnkOuter (IUnknown* optional)
r1, _, err := procDirectSoundFullDuplexCreate.Call(
uintptr(pcGuidCaptureDevice),
uintptr(pcGuidRenderDevice),
uintptr(pcDSCBufferDesc),
uintptr(pcDSBufferDesc),
uintptr(hWnd),
uintptr(dwLevel),
uintptr(ppDSFD),
uintptr(ppDSCBuffer8),
uintptr(ppDSBuffer8),
uintptr(pUnkOuter),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DirectSoundFullDuplexCreate(
pcGuidCaptureDevice: PGUID; // GUID* optional
pcGuidRenderDevice: PGUID; // GUID* optional
pcDSCBufferDesc: Pointer; // DSCBUFFERDESC*
pcDSBufferDesc: Pointer; // DSBUFFERDESC*
hWnd: THandle; // HWND
dwLevel: DWORD; // DWORD
ppDSFD: Pointer; // IDirectSoundFullDuplex** out
ppDSCBuffer8: Pointer; // IDirectSoundCaptureBuffer8** out
ppDSBuffer8: Pointer; // IDirectSoundBuffer8** out
pUnkOuter: Pointer // IUnknown* optional
): Integer; stdcall;
external 'DSOUND.dll' name 'DirectSoundFullDuplexCreate';result := DllCall("DSOUND\DirectSoundFullDuplexCreate"
, "Ptr", pcGuidCaptureDevice ; GUID* optional
, "Ptr", pcGuidRenderDevice ; GUID* optional
, "Ptr", pcDSCBufferDesc ; DSCBUFFERDESC*
, "Ptr", pcDSBufferDesc ; DSBUFFERDESC*
, "Ptr", hWnd ; HWND
, "UInt", dwLevel ; DWORD
, "Ptr", ppDSFD ; IDirectSoundFullDuplex** out
, "Ptr", ppDSCBuffer8 ; IDirectSoundCaptureBuffer8** out
, "Ptr", ppDSBuffer8 ; IDirectSoundBuffer8** out
, "Ptr", pUnkOuter ; IUnknown* optional
, "Int") ; return: HRESULT●DirectSoundFullDuplexCreate(pcGuidCaptureDevice, pcGuidRenderDevice, pcDSCBufferDesc, pcDSBufferDesc, hWnd, dwLevel, ppDSFD, ppDSCBuffer8, ppDSBuffer8, pUnkOuter) = DLL("DSOUND.dll", "int DirectSoundFullDuplexCreate(void*, void*, void*, void*, void*, dword, void*, void*, void*, void*)")
# 呼び出し: DirectSoundFullDuplexCreate(pcGuidCaptureDevice, pcGuidRenderDevice, pcDSCBufferDesc, pcDSBufferDesc, hWnd, dwLevel, ppDSFD, ppDSCBuffer8, ppDSBuffer8, pUnkOuter)
# pcGuidCaptureDevice : GUID* optional -> "void*"
# pcGuidRenderDevice : GUID* optional -> "void*"
# pcDSCBufferDesc : DSCBUFFERDESC* -> "void*"
# pcDSBufferDesc : DSBUFFERDESC* -> "void*"
# hWnd : HWND -> "void*"
# dwLevel : DWORD -> "dword"
# ppDSFD : IDirectSoundFullDuplex** out -> "void*"
# ppDSCBuffer8 : IDirectSoundCaptureBuffer8** out -> "void*"
# ppDSBuffer8 : IDirectSoundBuffer8** out -> "void*"
# pUnkOuter : IUnknown* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。