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

midiOutCacheDrumPatches

関数
MIDI出力デバイスに指定ドラムパッチをキャッシュする。
DLLWINMM.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

// WINMM.dll
#include <windows.h>

DWORD midiOutCacheDrumPatches(
    HMIDIOUT hmo,
    DWORD uPatch,
    WORD* pwkya,
    DWORD fuCache
);

パラメーター

名前方向
hmoHMIDIOUTin
uPatchDWORDin
pwkyaWORD*in
fuCacheDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

// WINMM.dll
#include <windows.h>

DWORD midiOutCacheDrumPatches(
    HMIDIOUT hmo,
    DWORD uPatch,
    WORD* pwkya,
    DWORD fuCache
);
[DllImport("WINMM.dll", ExactSpelling = true)]
static extern uint midiOutCacheDrumPatches(
    IntPtr hmo,   // HMIDIOUT
    uint uPatch,   // DWORD
    ref ushort pwkya,   // WORD*
    uint fuCache   // DWORD
);
<DllImport("WINMM.dll", ExactSpelling:=True)>
Public Shared Function midiOutCacheDrumPatches(
    hmo As IntPtr,   ' HMIDIOUT
    uPatch As UInteger,   ' DWORD
    ByRef pwkya As UShort,   ' WORD*
    fuCache As UInteger   ' DWORD
) As UInteger
End Function
' hmo : HMIDIOUT
' uPatch : DWORD
' pwkya : WORD*
' fuCache : DWORD
Declare PtrSafe Function midiOutCacheDrumPatches Lib "winmm" ( _
    ByVal hmo As LongPtr, _
    ByVal uPatch As Long, _
    ByRef pwkya As Integer, _
    ByVal fuCache As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

midiOutCacheDrumPatches = ctypes.windll.winmm.midiOutCacheDrumPatches
midiOutCacheDrumPatches.restype = wintypes.DWORD
midiOutCacheDrumPatches.argtypes = [
    wintypes.HANDLE,  # hmo : HMIDIOUT
    wintypes.DWORD,  # uPatch : DWORD
    ctypes.POINTER(ctypes.c_ushort),  # pwkya : WORD*
    wintypes.DWORD,  # fuCache : DWORD
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('WINMM.dll')
midiOutCacheDrumPatches = Fiddle::Function.new(
  lib['midiOutCacheDrumPatches'],
  [
    Fiddle::TYPE_VOIDP,  # hmo : HMIDIOUT
    -Fiddle::TYPE_INT,  # uPatch : DWORD
    Fiddle::TYPE_VOIDP,  # pwkya : WORD*
    -Fiddle::TYPE_INT,  # fuCache : DWORD
  ],
  -Fiddle::TYPE_INT)
#[link(name = "winmm")]
extern "system" {
    fn midiOutCacheDrumPatches(
        hmo: *mut core::ffi::c_void,  // HMIDIOUT
        uPatch: u32,  // DWORD
        pwkya: *mut u16,  // WORD*
        fuCache: u32  // DWORD
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("WINMM.dll")]
public static extern uint midiOutCacheDrumPatches(IntPtr hmo, uint uPatch, ref ushort pwkya, uint fuCache);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINMM_midiOutCacheDrumPatches' -Namespace Win32 -PassThru
# $api::midiOutCacheDrumPatches(hmo, uPatch, pwkya, fuCache)
#uselib "WINMM.dll"
#func global midiOutCacheDrumPatches "midiOutCacheDrumPatches" sptr, sptr, sptr, sptr
; midiOutCacheDrumPatches hmo, uPatch, varptr(pwkya), fuCache   ; 戻り値は stat
; hmo : HMIDIOUT -> "sptr"
; uPatch : DWORD -> "sptr"
; pwkya : WORD* -> "sptr"
; fuCache : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "WINMM.dll"
#cfunc global midiOutCacheDrumPatches "midiOutCacheDrumPatches" sptr, int, var, int
; res = midiOutCacheDrumPatches(hmo, uPatch, pwkya, fuCache)
; hmo : HMIDIOUT -> "sptr"
; uPatch : DWORD -> "int"
; pwkya : WORD* -> "var"
; fuCache : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; DWORD midiOutCacheDrumPatches(HMIDIOUT hmo, DWORD uPatch, WORD* pwkya, DWORD fuCache)
#uselib "WINMM.dll"
#cfunc global midiOutCacheDrumPatches "midiOutCacheDrumPatches" intptr, int, var, int
; res = midiOutCacheDrumPatches(hmo, uPatch, pwkya, fuCache)
; hmo : HMIDIOUT -> "intptr"
; uPatch : DWORD -> "int"
; pwkya : WORD* -> "var"
; fuCache : DWORD -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	winmm = windows.NewLazySystemDLL("WINMM.dll")
	procmidiOutCacheDrumPatches = winmm.NewProc("midiOutCacheDrumPatches")
)

// hmo (HMIDIOUT), uPatch (DWORD), pwkya (WORD*), fuCache (DWORD)
r1, _, err := procmidiOutCacheDrumPatches.Call(
	uintptr(hmo),
	uintptr(uPatch),
	uintptr(pwkya),
	uintptr(fuCache),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function midiOutCacheDrumPatches(
  hmo: THandle;   // HMIDIOUT
  uPatch: DWORD;   // DWORD
  pwkya: Pointer;   // WORD*
  fuCache: DWORD   // DWORD
): DWORD; stdcall;
  external 'WINMM.dll' name 'midiOutCacheDrumPatches';
result := DllCall("WINMM\midiOutCacheDrumPatches"
    , "Ptr", hmo   ; HMIDIOUT
    , "UInt", uPatch   ; DWORD
    , "Ptr", pwkya   ; WORD*
    , "UInt", fuCache   ; DWORD
    , "UInt")   ; return: DWORD
●midiOutCacheDrumPatches(hmo, uPatch, pwkya, fuCache) = DLL("WINMM.dll", "dword midiOutCacheDrumPatches(void*, dword, void*, dword)")
# 呼び出し: midiOutCacheDrumPatches(hmo, uPatch, pwkya, fuCache)
# hmo : HMIDIOUT -> "void*"
# uPatch : DWORD -> "dword"
# pwkya : WORD* -> "void*"
# fuCache : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。