ios - 在 C/C++ 中使用 MIDISendEventList() 发送 MIDI
问题描述
我一直在努力迁移较旧的 Core MIDI 发送实现,以使用 Apple 较新的 UMP 感知 MIDI 事件列表 API 方法发送 MIDI 1.0 消息。
我已经找到了可以运行并且应该输出 MIDI 时钟消息的代码,但是当我发送它时,MIDISendEventList(...)
我看不到 MIDI 接口没有输出任何内容;该方法也没有返回错误来指示问题所在。
这是我正在使用的代码:
const ByteCount clockMessageSize = 1;
const UInt32 clockMessage[clockMessageSize] = { (UInt32)0xF8 }; // MIDI clock tick
const MIDITimeStamp timeStamp = mach_absolute_time();
MIDIEventList clockMessageEventList = {};
MIDIEventPacket* clockMessageEventListEndPacket = nullptr;
clockMessageEventListEndPacket = MIDIEventListInit(&clockMessageEventList, kMIDIProtocol_1_0);
clockMessageEventListEndPacket = MIDIEventListAdd(&clockMessageEventList, sizeof(MIDIEventList::packet), clockMessageEventListEndPacket, timeStamp, clockMessageSize, clockMessage);
for (NSUInteger endpointRefIndex = 0; endpointRefIndex < endPointRefsCount; ++endpointRefIndex) {
MIDIObjectRef destinationEndpoint = endPointRefs[endpointRefIndex];
OSStatus midiSendError = MIDISendEventList(outputPortRef, destinationEndpoint, &clockMessageEventList);
if (midiSendError != noErr) {
printf("MIDISendEventList error: %i", (int)midiSendError);
}
}
clockMessageEventList.packet
在配置之后但在发送之前检查显示:
(248, 0, 0, [... all zeros to index 63])
有谁知道我要去哪里错了?
解决方案
推荐阅读
- javascript - 打开另一个手风琴时如何自动关闭手风琴?
- facebook - 如何从我的 Facebook 应用程序访问我的客户帐户?
- ios - iOS Objective-C:如何识别通过 UINavigationController 呈现的视图控制器?
- spring-boot - 如何动态创建路由配置本身
- javascript - 无法字符串化或解析 JSON 数据、AJAX 请求
- ansible - 在 localhost 上运行一个 ansible playbook 任务,然后在远程服务器上运行另一个任务
- ember.js - Ember 部署脚本在特定 npm 包上失败
- c - 如何将 char 数组标记两次以将其转换为 3D char 数组?
- javascript - 单击链接时禁用折叠
- jquery - 如何在每个 div 滚动到视图时运行动画,而不是在一个 div 进入视图时运行所有动画