如何判断MIDIEndpointRef是否为虚拟?

时间:2013-11-21 20:12:26

标签: ios coremidi

我正试图在我的iOS应用中区分“虚拟”和“非虚拟”MIDIEndpointRefs。

MIDIObjectType枚举似乎是值得一看的地方,但据我所知,这个属性不是我可以查询的。

有什么建议吗?

2 个答案:

答案 0 :(得分:2)

MIDIEndpointRef开始,尝试使用MIDIEndpointGetEntity然后使用MIDIEntityGetDevice查找设备。如果实体或设备为零,则端点可能是“虚拟”。

答案 1 :(得分:1)

以下是我在OMAC google小组中指出的解决方案(感谢Jesse Chappell

static BOOL isVirtualEndpoint(MIDIEndpointRef ref)
{
    MIDIEntityRef entity = 0;

    MIDIEndpointGetEntity(ref, &entity);
    if (entity) 
    {
        return NO;
    }
    else 
    {
    return YES;
    }
}