ホーム › Media.Audio › midiStreamOut
midiStreamOut
関数MIDIイベントバッファをストリームへ送出して再生する。
シグネチャ
// WINMM.dll
#include <windows.h>
DWORD midiStreamOut(
HMIDISTRM hms,
MIDIHDR* pmh,
DWORD cbmh
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hms | HMIDISTRM | in |
| pmh | MIDIHDR* | out |
| cbmh | DWORD | in |
戻り値の型: DWORD
各言語での呼び出し定義
// WINMM.dll
#include <windows.h>
DWORD midiStreamOut(
HMIDISTRM hms,
MIDIHDR* pmh,
DWORD cbmh
);[DllImport("WINMM.dll", ExactSpelling = true)]
static extern uint midiStreamOut(
IntPtr hms, // HMIDISTRM
IntPtr pmh, // MIDIHDR* out
uint cbmh // DWORD
);<DllImport("WINMM.dll", ExactSpelling:=True)>
Public Shared Function midiStreamOut(
hms As IntPtr, ' HMIDISTRM
pmh As IntPtr, ' MIDIHDR* out
cbmh As UInteger ' DWORD
) As UInteger
End Function' hms : HMIDISTRM
' pmh : MIDIHDR* out
' cbmh : DWORD
Declare PtrSafe Function midiStreamOut Lib "winmm" ( _
ByVal hms As LongPtr, _
ByVal pmh As LongPtr, _
ByVal cbmh As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
midiStreamOut = ctypes.windll.winmm.midiStreamOut
midiStreamOut.restype = wintypes.DWORD
midiStreamOut.argtypes = [
wintypes.HANDLE, # hms : HMIDISTRM
ctypes.c_void_p, # pmh : MIDIHDR* out
wintypes.DWORD, # cbmh : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('WINMM.dll')
midiStreamOut = Fiddle::Function.new(
lib['midiStreamOut'],
[
Fiddle::TYPE_VOIDP, # hms : HMIDISTRM
Fiddle::TYPE_VOIDP, # pmh : MIDIHDR* out
-Fiddle::TYPE_INT, # cbmh : DWORD
],
-Fiddle::TYPE_INT)#[link(name = "winmm")]
extern "system" {
fn midiStreamOut(
hms: *mut core::ffi::c_void, // HMIDISTRM
pmh: *mut MIDIHDR, // MIDIHDR* out
cbmh: u32 // DWORD
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("WINMM.dll")]
public static extern uint midiStreamOut(IntPtr hms, IntPtr pmh, uint cbmh);
"@
$api = Add-Type -MemberDefinition $sig -Name 'WINMM_midiStreamOut' -Namespace Win32 -PassThru
# $api::midiStreamOut(hms, pmh, cbmh)#uselib "WINMM.dll"
#func global midiStreamOut "midiStreamOut" sptr, sptr, sptr
; midiStreamOut hms, varptr(pmh), cbmh ; 戻り値は stat
; hms : HMIDISTRM -> "sptr"
; pmh : MIDIHDR* out -> "sptr"
; cbmh : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "WINMM.dll" #cfunc global midiStreamOut "midiStreamOut" sptr, var, int ; res = midiStreamOut(hms, pmh, cbmh) ; hms : HMIDISTRM -> "sptr" ; pmh : MIDIHDR* out -> "var" ; cbmh : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "WINMM.dll" #cfunc global midiStreamOut "midiStreamOut" sptr, sptr, int ; res = midiStreamOut(hms, varptr(pmh), cbmh) ; hms : HMIDISTRM -> "sptr" ; pmh : MIDIHDR* out -> "sptr" ; cbmh : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; DWORD midiStreamOut(HMIDISTRM hms, MIDIHDR* pmh, DWORD cbmh) #uselib "WINMM.dll" #cfunc global midiStreamOut "midiStreamOut" intptr, var, int ; res = midiStreamOut(hms, pmh, cbmh) ; hms : HMIDISTRM -> "intptr" ; pmh : MIDIHDR* out -> "var" ; cbmh : DWORD -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; DWORD midiStreamOut(HMIDISTRM hms, MIDIHDR* pmh, DWORD cbmh) #uselib "WINMM.dll" #cfunc global midiStreamOut "midiStreamOut" intptr, intptr, int ; res = midiStreamOut(hms, varptr(pmh), cbmh) ; hms : HMIDISTRM -> "intptr" ; pmh : MIDIHDR* out -> "intptr" ; cbmh : DWORD -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winmm = windows.NewLazySystemDLL("WINMM.dll")
procmidiStreamOut = winmm.NewProc("midiStreamOut")
)
// hms (HMIDISTRM), pmh (MIDIHDR* out), cbmh (DWORD)
r1, _, err := procmidiStreamOut.Call(
uintptr(hms),
uintptr(pmh),
uintptr(cbmh),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction midiStreamOut(
hms: THandle; // HMIDISTRM
pmh: Pointer; // MIDIHDR* out
cbmh: DWORD // DWORD
): DWORD; stdcall;
external 'WINMM.dll' name 'midiStreamOut';result := DllCall("WINMM\midiStreamOut"
, "Ptr", hms ; HMIDISTRM
, "Ptr", pmh ; MIDIHDR* out
, "UInt", cbmh ; DWORD
, "UInt") ; return: DWORD●midiStreamOut(hms, pmh, cbmh) = DLL("WINMM.dll", "dword midiStreamOut(void*, void*, dword)")
# 呼び出し: midiStreamOut(hms, pmh, cbmh)
# hms : HMIDISTRM -> "void*"
# pmh : MIDIHDR* out -> "void*"
# cbmh : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。