📄 unitymidi.h
字号:
#pragma once#include <string>#include <list>#include <CoreMidi/CoreMidi.h>struct MidiMessage{ char command; char data0; char data1; MIDIEndpointRef endpoint;};extern "C"{// Starts receiving on all midi ports// Returns true if successfulint StartReceiving ();// Stops receiving on all midi portsvoid StopReceiving ();// Fetches the next queued midimessage for the device// Returns 0 if no message could be extracted, meaning that no midi messages are left to process.int PopMidiMessage (MidiMessage* message);// Returns the name of the device from the midi endpoint.// The Midi endpoint is stored in the midi message so that the C# side can ask for the device name,// the midi message is coming from.const char* GetMidiDeviceName (MIDIEndpointRef endPoint);}//**** Private interface ****//// ReceiveMidiMessage is the callback function we register with CoreMidi.// The callback simply stores all incoming messages in a buffer.// The C# side then pops all midi messages in the buffer.// This function is called in another thread so we should use mutexes when accessing the message buffervoid ReceiveMidiMessage (const MIDIPacketList *pktlist, void *refCon, void *connRefCon);void LockMutex ();void UnlockMutex ();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -