midi_methods.cpp

来自「java编程的一些Applets例子。值得深入研究一下。」· C++ 代码 · 共 46 行

CPP
46
字号
/* midi_methods.cpp

   C wrapper for Windows MIDI interface, callable by Java programs
*/

#include "StubPreamble.h"
#include "midi_MidiOutDevice.h"

#include <mmsystem.h>

extern "C" __declspec(dllexport) long midi_MidiOutDevice_MidiOutGetNumDevs(struct Hmidi_MidiOutDevice *)
{
	int n = midiOutGetNumDevs(); 
	return n;
}


extern "C" __declspec(dllexport) long midi_MidiOutDevice_MidiOutOpen(struct Hmidi_MidiOutDevice *thisdev)
{
	HMIDIOUT hmidiout = NULL;
	UINT rc = midiOutOpen(&hmidiout, unhand(thisdev)->deviceId, NULL, NULL, CALLBACK_NULL);

	unhand(thisdev)->deviceHandle = (long) hmidiout;

	return (long) rc;
}


extern "C" __declspec(dllexport) long midi_MidiOutDevice_MidiOutReset(struct Hmidi_MidiOutDevice *thisdev)
{
	return midiOutReset((HMIDIOUT)unhand(thisdev)->deviceHandle);
}


extern "C" __declspec(dllexport) long midi_MidiOutDevice_MidiOutClose(struct Hmidi_MidiOutDevice *thisdev)
{
	return midiOutClose((HMIDIOUT)unhand(thisdev)->deviceHandle);
}


extern "C" __declspec(dllexport) long midi_MidiOutDevice_MidiOutShortMsg(struct Hmidi_MidiOutDevice *thisdev, long message)
{
	return midiOutShortMsg((HMIDIOUT)unhand(thisdev)->deviceHandle, message);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?