ホーム › 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 | 使用するキャプチャデバイスのGUIDへのポインタ。NULLで既定デバイス。 |
| ppDSC | IDirectSoundCapture** | out | 生成されたIDirectSoundCaptureインターフェースを受け取るポインタ。 |
| pUnkOuter | IUnknown* | inoptional | アグリゲーション用の外側IUnknown。通常はNULL。 |
戻り値の型: 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)。const std = @import("std");
extern "dsound" fn DirectSoundCaptureCreate(
pcGuidDevice: [*c]GUID, // GUID* optional
ppDSC: ?*anyopaque, // IDirectSoundCapture** out
pUnkOuter: ?*anyopaque // IUnknown* optional
) callconv(std.os.windows.WINAPI) i32;proc DirectSoundCaptureCreate(
pcGuidDevice: ptr GUID, # GUID* optional
ppDSC: pointer, # IDirectSoundCapture** out
pUnkOuter: pointer # IUnknown* optional
): int32 {.importc: "DirectSoundCaptureCreate", stdcall, dynlib: "DSOUND.dll".}pragma(lib, "dsound");
extern(Windows)
int DirectSoundCaptureCreate(
GUID* pcGuidDevice, // GUID* optional
void* ppDSC, // IDirectSoundCapture** out
void* pUnkOuter // IUnknown* optional
);ccall((:DirectSoundCaptureCreate, "DSOUND.dll"), stdcall, Int32,
(Ptr{GUID}, Ptr{Cvoid}, Ptr{Cvoid}),
pcGuidDevice, ppDSC, pUnkOuter)
# pcGuidDevice : GUID* optional -> Ptr{GUID}
# ppDSC : IDirectSoundCapture** out -> Ptr{Cvoid}
# pUnkOuter : IUnknown* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DirectSoundCaptureCreate(
void* pcGuidDevice,
void* ppDSC,
void* pUnkOuter);
]]
local dsound = ffi.load("dsound")
-- dsound.DirectSoundCaptureCreate(pcGuidDevice, ppDSC, pUnkOuter)
-- pcGuidDevice : GUID* optional
-- ppDSC : IDirectSoundCapture** out
-- pUnkOuter : IUnknown* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('DSOUND.dll');
const DirectSoundCaptureCreate = lib.func('__stdcall', 'DirectSoundCaptureCreate', 'int32_t', ['void *', 'void *', 'void *']);
// DirectSoundCaptureCreate(pcGuidDevice, ppDSC, pUnkOuter)
// pcGuidDevice : GUID* optional -> 'void *'
// ppDSC : IDirectSoundCapture** out -> 'void *'
// pUnkOuter : IUnknown* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("DSOUND.dll", {
DirectSoundCaptureCreate: { parameters: ["pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.DirectSoundCaptureCreate(pcGuidDevice, ppDSC, pUnkOuter)
// pcGuidDevice : GUID* optional -> "pointer"
// ppDSC : IDirectSoundCapture** out -> "pointer"
// pUnkOuter : IUnknown* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DirectSoundCaptureCreate(
void* pcGuidDevice,
void* ppDSC,
void* pUnkOuter);
C, "DSOUND.dll");
// $ffi->DirectSoundCaptureCreate(pcGuidDevice, ppDSC, pUnkOuter);
// pcGuidDevice : GUID* optional
// ppDSC : IDirectSoundCapture** out
// pUnkOuter : IUnknown* optional
// 構造体/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 Dsound extends StdCallLibrary {
Dsound INSTANCE = Native.load("dsound", Dsound.class);
int DirectSoundCaptureCreate(
Pointer pcGuidDevice, // GUID* optional
Pointer ppDSC, // IDirectSoundCapture** out
Pointer pUnkOuter // IUnknown* optional
);
}@[Link("dsound")]
lib LibDSOUND
fun DirectSoundCaptureCreate = DirectSoundCaptureCreate(
pcGuidDevice : GUID*, # GUID* optional
ppDSC : Void*, # IDirectSoundCapture** out
pUnkOuter : Void* # IUnknown* optional
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef DirectSoundCaptureCreateNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef DirectSoundCaptureCreateDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final DirectSoundCaptureCreate = DynamicLibrary.open('DSOUND.dll')
.lookupFunction<DirectSoundCaptureCreateNative, DirectSoundCaptureCreateDart>('DirectSoundCaptureCreate');
// pcGuidDevice : GUID* optional -> Pointer<Void>
// ppDSC : IDirectSoundCapture** out -> Pointer<Void>
// pUnkOuter : IUnknown* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DirectSoundCaptureCreate(
pcGuidDevice: PGUID; // GUID* optional
ppDSC: Pointer; // IDirectSoundCapture** out
pUnkOuter: Pointer // IUnknown* optional
): Integer; stdcall;
external 'DSOUND.dll' name 'DirectSoundCaptureCreate';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DirectSoundCaptureCreate"
c_DirectSoundCaptureCreate :: Ptr () -> Ptr () -> Ptr () -> IO Int32
-- pcGuidDevice : GUID* optional -> Ptr ()
-- ppDSC : IDirectSoundCapture** out -> Ptr ()
-- pUnkOuter : IUnknown* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let directsoundcapturecreate =
foreign "DirectSoundCaptureCreate"
((ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* pcGuidDevice : GUID* optional -> (ptr void) *)
(* ppDSC : IDirectSoundCapture** out -> (ptr void) *)
(* pUnkOuter : IUnknown* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library dsound (t "DSOUND.dll"))
(cffi:use-foreign-library dsound)
(cffi:defcfun ("DirectSoundCaptureCreate" direct-sound-capture-create :convention :stdcall) :int32
(pc-guid-device :pointer) ; GUID* optional
(pp-dsc :pointer) ; IDirectSoundCapture** out
(p-unk-outer :pointer)) ; IUnknown* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $DirectSoundCaptureCreate = Win32::API::More->new('DSOUND',
'int DirectSoundCaptureCreate(LPVOID pcGuidDevice, LPVOID ppDSC, LPVOID pUnkOuter)');
# my $ret = $DirectSoundCaptureCreate->Call($pcGuidDevice, $ppDSC, $pUnkOuter);
# pcGuidDevice : GUID* optional -> LPVOID
# ppDSC : IDirectSoundCapture** out -> LPVOID
# pUnkOuter : IUnknown* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f DirectSoundCaptureCreate8 — DirectSound8キャプチャデバイスオブジェクトを生成する。