ホーム › Media.Audio.DirectSound › DirectSoundCaptureCreate8
DirectSoundCaptureCreate8
関数DirectSound8キャプチャデバイスオブジェクトを生成する。
シグネチャ
// DSOUND.dll
#include <windows.h>
HRESULT DirectSoundCaptureCreate8(
const GUID* pcGuidDevice, // optional
IDirectSoundCapture** ppDSC8,
IUnknown* pUnkOuter // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| pcGuidDevice | GUID* | inoptional | 使用するキャプチャデバイスのGUIDへのポインタ。NULLで既定デバイス。 |
| ppDSC8 | IDirectSoundCapture** | out | 生成されたIDirectSoundCapture(8)インターフェースを受け取るポインタ。 |
| pUnkOuter | IUnknown* | inoptional | アグリゲーション用の外側IUnknown。通常はNULL。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// DSOUND.dll
#include <windows.h>
HRESULT DirectSoundCaptureCreate8(
const GUID* pcGuidDevice, // optional
IDirectSoundCapture** ppDSC8,
IUnknown* pUnkOuter // optional
);[DllImport("DSOUND.dll", ExactSpelling = true)]
static extern int DirectSoundCaptureCreate8(
IntPtr pcGuidDevice, // GUID* optional
IntPtr ppDSC8, // IDirectSoundCapture** out
IntPtr pUnkOuter // IUnknown* optional
);<DllImport("DSOUND.dll", ExactSpelling:=True)>
Public Shared Function DirectSoundCaptureCreate8(
pcGuidDevice As IntPtr, ' GUID* optional
ppDSC8 As IntPtr, ' IDirectSoundCapture** out
pUnkOuter As IntPtr ' IUnknown* optional
) As Integer
End Function' pcGuidDevice : GUID* optional
' ppDSC8 : IDirectSoundCapture** out
' pUnkOuter : IUnknown* optional
Declare PtrSafe Function DirectSoundCaptureCreate8 Lib "dsound" ( _
ByVal pcGuidDevice As LongPtr, _
ByVal ppDSC8 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
DirectSoundCaptureCreate8 = ctypes.windll.dsound.DirectSoundCaptureCreate8
DirectSoundCaptureCreate8.restype = ctypes.c_int
DirectSoundCaptureCreate8.argtypes = [
ctypes.c_void_p, # pcGuidDevice : GUID* optional
ctypes.c_void_p, # ppDSC8 : IDirectSoundCapture** out
ctypes.c_void_p, # pUnkOuter : IUnknown* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('DSOUND.dll')
DirectSoundCaptureCreate8 = Fiddle::Function.new(
lib['DirectSoundCaptureCreate8'],
[
Fiddle::TYPE_VOIDP, # pcGuidDevice : GUID* optional
Fiddle::TYPE_VOIDP, # ppDSC8 : IDirectSoundCapture** out
Fiddle::TYPE_VOIDP, # pUnkOuter : IUnknown* optional
],
Fiddle::TYPE_INT)#[link(name = "dsound")]
extern "system" {
fn DirectSoundCaptureCreate8(
pcGuidDevice: *const GUID, // GUID* optional
ppDSC8: *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 DirectSoundCaptureCreate8(IntPtr pcGuidDevice, IntPtr ppDSC8, IntPtr pUnkOuter);
"@
$api = Add-Type -MemberDefinition $sig -Name 'DSOUND_DirectSoundCaptureCreate8' -Namespace Win32 -PassThru
# $api::DirectSoundCaptureCreate8(pcGuidDevice, ppDSC8, pUnkOuter)#uselib "DSOUND.dll"
#func global DirectSoundCaptureCreate8 "DirectSoundCaptureCreate8" sptr, sptr, sptr
; DirectSoundCaptureCreate8 varptr(pcGuidDevice), ppDSC8, pUnkOuter ; 戻り値は stat
; pcGuidDevice : GUID* optional -> "sptr"
; ppDSC8 : IDirectSoundCapture** out -> "sptr"
; pUnkOuter : IUnknown* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "DSOUND.dll" #cfunc global DirectSoundCaptureCreate8 "DirectSoundCaptureCreate8" var, sptr, sptr ; res = DirectSoundCaptureCreate8(pcGuidDevice, ppDSC8, pUnkOuter) ; pcGuidDevice : GUID* optional -> "var" ; ppDSC8 : IDirectSoundCapture** out -> "sptr" ; pUnkOuter : IUnknown* optional -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "DSOUND.dll" #cfunc global DirectSoundCaptureCreate8 "DirectSoundCaptureCreate8" sptr, sptr, sptr ; res = DirectSoundCaptureCreate8(varptr(pcGuidDevice), ppDSC8, pUnkOuter) ; pcGuidDevice : GUID* optional -> "sptr" ; ppDSC8 : IDirectSoundCapture** out -> "sptr" ; pUnkOuter : IUnknown* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT DirectSoundCaptureCreate8(GUID* pcGuidDevice, IDirectSoundCapture** ppDSC8, IUnknown* pUnkOuter) #uselib "DSOUND.dll" #cfunc global DirectSoundCaptureCreate8 "DirectSoundCaptureCreate8" var, intptr, intptr ; res = DirectSoundCaptureCreate8(pcGuidDevice, ppDSC8, pUnkOuter) ; pcGuidDevice : GUID* optional -> "var" ; ppDSC8 : IDirectSoundCapture** out -> "intptr" ; pUnkOuter : IUnknown* optional -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT DirectSoundCaptureCreate8(GUID* pcGuidDevice, IDirectSoundCapture** ppDSC8, IUnknown* pUnkOuter) #uselib "DSOUND.dll" #cfunc global DirectSoundCaptureCreate8 "DirectSoundCaptureCreate8" intptr, intptr, intptr ; res = DirectSoundCaptureCreate8(varptr(pcGuidDevice), ppDSC8, pUnkOuter) ; pcGuidDevice : GUID* optional -> "intptr" ; ppDSC8 : IDirectSoundCapture** out -> "intptr" ; pUnkOuter : IUnknown* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
dsound = windows.NewLazySystemDLL("DSOUND.dll")
procDirectSoundCaptureCreate8 = dsound.NewProc("DirectSoundCaptureCreate8")
)
// pcGuidDevice (GUID* optional), ppDSC8 (IDirectSoundCapture** out), pUnkOuter (IUnknown* optional)
r1, _, err := procDirectSoundCaptureCreate8.Call(
uintptr(pcGuidDevice),
uintptr(ppDSC8),
uintptr(pUnkOuter),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction DirectSoundCaptureCreate8(
pcGuidDevice: PGUID; // GUID* optional
ppDSC8: Pointer; // IDirectSoundCapture** out
pUnkOuter: Pointer // IUnknown* optional
): Integer; stdcall;
external 'DSOUND.dll' name 'DirectSoundCaptureCreate8';result := DllCall("DSOUND\DirectSoundCaptureCreate8"
, "Ptr", pcGuidDevice ; GUID* optional
, "Ptr", ppDSC8 ; IDirectSoundCapture** out
, "Ptr", pUnkOuter ; IUnknown* optional
, "Int") ; return: HRESULT●DirectSoundCaptureCreate8(pcGuidDevice, ppDSC8, pUnkOuter) = DLL("DSOUND.dll", "int DirectSoundCaptureCreate8(void*, void*, void*)")
# 呼び出し: DirectSoundCaptureCreate8(pcGuidDevice, ppDSC8, pUnkOuter)
# pcGuidDevice : GUID* optional -> "void*"
# ppDSC8 : IDirectSoundCapture** out -> "void*"
# pUnkOuter : IUnknown* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "dsound" fn DirectSoundCaptureCreate8(
pcGuidDevice: [*c]GUID, // GUID* optional
ppDSC8: ?*anyopaque, // IDirectSoundCapture** out
pUnkOuter: ?*anyopaque // IUnknown* optional
) callconv(std.os.windows.WINAPI) i32;proc DirectSoundCaptureCreate8(
pcGuidDevice: ptr GUID, # GUID* optional
ppDSC8: pointer, # IDirectSoundCapture** out
pUnkOuter: pointer # IUnknown* optional
): int32 {.importc: "DirectSoundCaptureCreate8", stdcall, dynlib: "DSOUND.dll".}pragma(lib, "dsound");
extern(Windows)
int DirectSoundCaptureCreate8(
GUID* pcGuidDevice, // GUID* optional
void* ppDSC8, // IDirectSoundCapture** out
void* pUnkOuter // IUnknown* optional
);ccall((:DirectSoundCaptureCreate8, "DSOUND.dll"), stdcall, Int32,
(Ptr{GUID}, Ptr{Cvoid}, Ptr{Cvoid}),
pcGuidDevice, ppDSC8, pUnkOuter)
# pcGuidDevice : GUID* optional -> Ptr{GUID}
# ppDSC8 : IDirectSoundCapture** out -> Ptr{Cvoid}
# pUnkOuter : IUnknown* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t DirectSoundCaptureCreate8(
void* pcGuidDevice,
void* ppDSC8,
void* pUnkOuter);
]]
local dsound = ffi.load("dsound")
-- dsound.DirectSoundCaptureCreate8(pcGuidDevice, ppDSC8, pUnkOuter)
-- pcGuidDevice : GUID* optional
-- ppDSC8 : IDirectSoundCapture** out
-- pUnkOuter : IUnknown* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('DSOUND.dll');
const DirectSoundCaptureCreate8 = lib.func('__stdcall', 'DirectSoundCaptureCreate8', 'int32_t', ['void *', 'void *', 'void *']);
// DirectSoundCaptureCreate8(pcGuidDevice, ppDSC8, pUnkOuter)
// pcGuidDevice : GUID* optional -> 'void *'
// ppDSC8 : IDirectSoundCapture** out -> 'void *'
// pUnkOuter : IUnknown* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("DSOUND.dll", {
DirectSoundCaptureCreate8: { parameters: ["pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.DirectSoundCaptureCreate8(pcGuidDevice, ppDSC8, pUnkOuter)
// pcGuidDevice : GUID* optional -> "pointer"
// ppDSC8 : IDirectSoundCapture** out -> "pointer"
// pUnkOuter : IUnknown* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t DirectSoundCaptureCreate8(
void* pcGuidDevice,
void* ppDSC8,
void* pUnkOuter);
C, "DSOUND.dll");
// $ffi->DirectSoundCaptureCreate8(pcGuidDevice, ppDSC8, pUnkOuter);
// pcGuidDevice : GUID* optional
// ppDSC8 : 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 DirectSoundCaptureCreate8(
Pointer pcGuidDevice, // GUID* optional
Pointer ppDSC8, // IDirectSoundCapture** out
Pointer pUnkOuter // IUnknown* optional
);
}@[Link("dsound")]
lib LibDSOUND
fun DirectSoundCaptureCreate8 = DirectSoundCaptureCreate8(
pcGuidDevice : GUID*, # GUID* optional
ppDSC8 : 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 DirectSoundCaptureCreate8Native = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef DirectSoundCaptureCreate8Dart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final DirectSoundCaptureCreate8 = DynamicLibrary.open('DSOUND.dll')
.lookupFunction<DirectSoundCaptureCreate8Native, DirectSoundCaptureCreate8Dart>('DirectSoundCaptureCreate8');
// pcGuidDevice : GUID* optional -> Pointer<Void>
// ppDSC8 : IDirectSoundCapture** out -> Pointer<Void>
// pUnkOuter : IUnknown* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function DirectSoundCaptureCreate8(
pcGuidDevice: PGUID; // GUID* optional
ppDSC8: Pointer; // IDirectSoundCapture** out
pUnkOuter: Pointer // IUnknown* optional
): Integer; stdcall;
external 'DSOUND.dll' name 'DirectSoundCaptureCreate8';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "DirectSoundCaptureCreate8"
c_DirectSoundCaptureCreate8 :: Ptr () -> Ptr () -> Ptr () -> IO Int32
-- pcGuidDevice : GUID* optional -> Ptr ()
-- ppDSC8 : IDirectSoundCapture** out -> Ptr ()
-- pUnkOuter : IUnknown* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let directsoundcapturecreate8 =
foreign "DirectSoundCaptureCreate8"
((ptr void) @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* pcGuidDevice : GUID* optional -> (ptr void) *)
(* ppDSC8 : 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 ("DirectSoundCaptureCreate8" direct-sound-capture-create8 :convention :stdcall) :int32
(pc-guid-device :pointer) ; GUID* optional
(pp-dsc8 :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 $DirectSoundCaptureCreate8 = Win32::API::More->new('DSOUND',
'int DirectSoundCaptureCreate8(LPVOID pcGuidDevice, LPVOID ppDSC8, LPVOID pUnkOuter)');
# my $ret = $DirectSoundCaptureCreate8->Call($pcGuidDevice, $ppDSC8, $pUnkOuter);
# pcGuidDevice : GUID* optional -> LPVOID
# ppDSC8 : IDirectSoundCapture** out -> LPVOID
# pUnkOuter : IUnknown* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
類似 API
- f DirectSoundCaptureCreate — DirectSoundキャプチャデバイスオブジェクトを生成する。