本文整理汇总了C++中Endpoint::DriverOwned方法的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint::DriverOwned方法的具体用法?C++ Endpoint::DriverOwned怎么用?C++ Endpoint::DriverOwned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Endpoint
的用法示例。
在下文中一共展示了Endpoint::DriverOwned方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
bool CAMIDIEndpoints::Endpoint::GetEndpointInfo(EMode mode, EndpointInfo &info) {
Endpoint *ept = this, *ept2;
if (mode == kPairs) {
if ((ept2 = ept->PairMate()) == NULL)
return false;
info.mSourceEndpoint = ept2->IOEndpoint();
info.mDestinationEndpoint = ept->IOEndpoint();
}
else if (mode == kSources) {
info.mSourceEndpoint = ept->IOEndpoint();
info.mDestinationEndpoint = NULL;
}
else {
info.mSourceEndpoint = NULL;
info.mDestinationEndpoint = ept->IOEndpoint();
}
info.mUniqueID = ept->UniqueID();
if (ept->DriverOwned() && ept->Next() != NULL) {
// add one item for all connected items
CFMutableStringRef names = CFStringCreateMutable(NULL, 0);
bool first = true;
while (true) {
ept = ept->Next();
if (ept == NULL)
break;
if (!first) {
CFStringAppend(names, CFSTR(", "));
}
else first = false;
CFStringAppend(names, ept->Name());
}
info.mDisplayName = names;
}
else {
// a driver-owned endpoint with nothing connected externally,
// or an external endpoint
CFRetain(info.mDisplayName = ept->Name());
}
return true;
}
示例2: MIDIGetNumberOfSources
void CAMIDIEndpoints::UpdateFromCurrentState()
{
Clear();
UInt32 i, n;
MIDIEndpointRef epRef;
n = MIDIGetNumberOfSources();
mSources.reserve(n);
for (i = 0; i < n; ++i) {
epRef = MIDIGetSource(i);
if (epRef)
AddEndpoints(epRef, mSources);
}
n = MIDIGetNumberOfDestinations();
mDestinations.reserve(n);
for (i = 0; i < n; ++i) {
epRef = MIDIGetDestination(i);
if (epRef)
AddEndpoints(epRef, mDestinations);
}
// pairing
for (EndpointList::iterator dit = mDestinations.begin(); dit != mDestinations.end(); ++dit) {
Endpoint *ep = *dit;
MIDIEntityRef destEntity = ep->Entity();
if (destEntity != NULL) {
for (EndpointList::iterator eit = mSources.begin(); eit != mSources.end(); ++eit) {
Endpoint *ep2 = *eit;
MIDIEntityRef srcEntity = ep2->Entity();
if (srcEntity == destEntity && ep2->DriverOwned() == ep->DriverOwned()) {
ep2->SetPairMate(ep);
ep->SetPairMate(ep2);
}
}
}
}
}