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

midiOutCachePatches

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

シグネチャ

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

DWORD midiOutCachePatches(
    HMIDIOUT hmo,
    DWORD uBank,
    WORD* pwpa,
    DWORD fuCache
);

パラメーター

名前方向
hmoHMIDIOUTin
uBankDWORDin
pwpaWORD*in
fuCacheDWORDin

戻り値の型: DWORD

各言語での呼び出し定義

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

DWORD midiOutCachePatches(
    HMIDIOUT hmo,
    DWORD uBank,
    WORD* pwpa,
    DWORD fuCache
);
[DllImport("WINMM.dll", ExactSpelling = true)]
static extern uint midiOutCachePatches(
    IntPtr hmo,   // HMIDIOUT
    uint uBank,   // DWORD
    ref ushort pwpa,   // WORD*
    uint fuCache   // DWORD
);
<DllImport("WINMM.dll", ExactSpelling:=True)>
Public Shared Function midiOutCachePatches(
    hmo As IntPtr,   ' HMIDIOUT
    uBank As UInteger,   ' DWORD
    ByRef pwpa As UShort,   ' WORD*
    fuCache As UInteger   ' DWORD
) As UInteger
End Function
' hmo : HMIDIOUT
' uBank : DWORD
' pwpa : WORD*
' fuCache : DWORD
Declare PtrSafe Function midiOutCachePatches Lib "winmm" ( _
    ByVal hmo As LongPtr, _
    ByVal uBank As Long, _
    ByRef pwpa 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

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

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

var (
	winmm = windows.NewLazySystemDLL("WINMM.dll")
	procmidiOutCachePatches = winmm.NewProc("midiOutCachePatches")
)

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