本文整理汇总了C++中OwnedArray::add方法的典型用法代码示例。如果您正苦于以下问题:C++ OwnedArray::add方法的具体用法?C++ OwnedArray::add怎么用?C++ OwnedArray::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OwnedArray
的用法示例。
在下文中一共展示了OwnedArray::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMonolithicData
bool ModulatorSamplerSoundPool::loadMonolithicData(const ValueTree &sampleMap, const Array<File>& monolithicFiles, OwnedArray<ModulatorSamplerSound> &sounds)
{
jassert(!mc->getMainSynthChain()->areVoicesActive());
clearUnreferencedMonoliths();
loadedMonoliths.add(new MonolithInfoToUse(monolithicFiles));
MonolithInfoToUse* hmaf = loadedMonoliths.getLast();
try
{
hmaf->fillMetadataInfo(sampleMap);
}
catch (StreamingSamplerSound::LoadingError l)
{
String x;
x << "Error at loading sample " << l.fileName << ": " << l.errorDescription;
mc->getDebugLogger().logMessage(x);
#if USE_FRONTEND
mc->sendOverlayMessage(DeactiveOverlay::State::CustomErrorMessage, x);
#else
debugError(mc->getMainSynthChain(), x);
#endif
}
for (int i = 0; i < sampleMap.getNumChildren(); i++)
{
ValueTree sample = sampleMap.getChild(i);
if (sample.getNumChildren() == 0)
{
String fileName = sample.getProperty("FileName").toString().fromFirstOccurrenceOf("{PROJECT_FOLDER}", false, false);
StreamingSamplerSound* sound = new StreamingSamplerSound(hmaf, 0, i);
pool.add(sound);
sounds.add(new ModulatorSamplerSound(mc, sound, i));
}
else
{
StreamingSamplerSoundArray multiMicArray;
for (int j = 0; j < sample.getNumChildren(); j++)
{
StreamingSamplerSound* sound = new StreamingSamplerSound(hmaf, j, i);
pool.add(sound);
multiMicArray.add(sound);
}
sounds.add(new ModulatorSamplerSound(mc, multiMicArray, i));
}
}
sendChangeMessage();
return true;
}
示例2: scanAndAddFile
bool KnownPluginList::scanAndAddFile (const String& fileOrIdentifier,
const bool dontRescanIfAlreadyInList,
OwnedArray <PluginDescription>& typesFound,
AudioPluginFormat& format)
{
const ScopedLock sl (scanLock);
if (dontRescanIfAlreadyInList
&& getTypeForFile (fileOrIdentifier) != nullptr)
{
bool needsRescanning = false;
for (int i = types.size(); --i >= 0;)
{
const PluginDescription* const d = types.getUnchecked(i);
if (d->fileOrIdentifier == fileOrIdentifier && d->pluginFormatName == format.getName())
{
if (format.pluginNeedsRescanning (*d))
needsRescanning = true;
else
typesFound.add (new PluginDescription (*d));
}
}
if (! needsRescanning)
return false;
}
if (blacklist.contains (fileOrIdentifier))
return false;
OwnedArray <PluginDescription> found;
{
const ScopedUnlock sl2 (scanLock);
if (scanner != nullptr)
{
if (! scanner->findPluginTypesFor (format, found, fileOrIdentifier))
addToBlacklist (fileOrIdentifier);
}
else
{
format.findAllTypesForFile (found, fileOrIdentifier);
}
}
for (int i = 0; i < found.size(); ++i)
{
PluginDescription* const desc = found.getUnchecked(i);
jassert (desc != nullptr);
addType (*desc);
typesFound.add (new PluginDescription (*desc));
}
return found.size() > 0;
}
示例3: scanAndAddFile
bool KnownPluginList::scanAndAddFile (const String& fileOrIdentifier,
const bool dontRescanIfAlreadyInList,
OwnedArray<PluginDescription>& typesFound,
AudioPluginFormat& format)
{
const ScopedLock sl (scanLock);
if (dontRescanIfAlreadyInList
&& getTypeForFile (fileOrIdentifier) != nullptr)
{
bool needsRescanning = false;
ScopedLock lock (typesArrayLock);
for (auto* d : types)
{
if (d->fileOrIdentifier == fileOrIdentifier && d->pluginFormatName == format.getName())
{
if (format.pluginNeedsRescanning (*d))
needsRescanning = true;
else
typesFound.add (new PluginDescription (*d));
}
}
if (! needsRescanning)
return false;
}
if (blacklist.contains (fileOrIdentifier))
return false;
OwnedArray<PluginDescription> found;
{
const ScopedUnlock sl2 (scanLock);
if (scanner != nullptr)
{
if (! scanner->findPluginTypesFor (format, found, fileOrIdentifier))
addToBlacklist (fileOrIdentifier);
}
else
{
format.findAllTypesForFile (found, fileOrIdentifier);
}
}
for (auto* desc : found)
{
jassert (desc != nullptr);
addType (*desc);
typesFound.add (new PluginDescription (*desc));
}
return ! found.isEmpty();
}
示例4: setupDefaultItemsIfNecessary
//==============================================================================
void DefaultMenuBarItemHandler::setupDefaultItemsIfNecessary()
{
if (menuBarItems.size() <= 0)
{
menuBarItems.add (new FileMenuBarItem());
menuBarItems.add (new EditMenuBarItem());
menuBarItems.add (new ViewMenuBarItem());
menuBarItems.add (new BuildMenuBarItem());
menuBarItems.add (new ToolsMenuBarItem());
menuBarItems.add (new HelpMenuBarItem());
}
}
示例5: getSubCategoryList
bool SmugMug::getSubCategoryList(OwnedArray<SubCategory>& subCategories)
{
StringPairArray params;
XmlElement* n = smugMugRequest(("smugmug.subcategories.getAll"), params);
if (n)
{
XmlElement* c = n->getChildByName(("SubCategories"));
if (c)
{
XmlElement* subCat = c->getChildByName(("SubCategory"));
while (subCat)
{
SubCategory* subCategory = new SubCategory();
subCategory->id = subCat->getIntAttribute(("id"));
subCategory->title = subCat->getStringAttribute(("Name"));
XmlElement* cat = subCat->getChildByName(("Category"));
if (cat)
subCategory->parentId = cat->getIntAttribute(("id"));
subCategories.add(subCategory);
subCat = subCat->getNextElementWithTagName(("SubCategory"));
}
}
delete n;
return true;
}
return false;
}
示例6: createNMWifiAccessPoint
OwnedArray<WifiAccessPoint> WifiStatusNM::nearbyAccessPoints() {
NMDeviceWifi *wdev;
const GPtrArray *ap_list;
OwnedArray<WifiAccessPoint> accessPoints;
wdev = NM_DEVICE_WIFI(nmdevice);
//nm_device_wifi_request_scan(wdev, NULL, NULL);
ap_list = nm_device_wifi_get_access_points(wdev);
if (ap_list != NULL) {
std::map<String, WifiAccessPoint *> uniqueAPs;
for (int i = 0; i < ap_list->len; i++) {
NMAccessPoint *ap = (NMAccessPoint *) g_ptr_array_index(ap_list, i);
auto created_ap = createNMWifiAccessPoint(ap);
/*FIXME: dropping hidden (no ssid) networks until gui supports it*/
if (created_ap->ssid.length() == 0)
continue;
if (uniqueAPs.find(created_ap->hash) == uniqueAPs.end())
uniqueAPs[created_ap->hash] = created_ap;
else
if (uniqueAPs[created_ap->hash]->signalStrength < created_ap->signalStrength)
uniqueAPs[created_ap->hash] = created_ap;
}
for (const auto entry : uniqueAPs)
accessPoints.add(entry.second);
}
DBG(__func__ << ": found " << accessPoints.size() << " AccessPoints");
return accessPoints;
}
示例7: findFonts
void Font::findFonts (OwnedArray<Font>& destArray) throw()
{
const StringArray names (findAllTypefaceNames());
for (int i = 0; i < names.size(); ++i)
destArray.add (new Font (names[i], defaultFontHeight, Font::plain));
}
示例8: createTokens
static void createTokens (int startPosition, const String& lineText,
CodeDocument::Iterator& source,
CodeTokeniser* analyser,
OwnedArray <SyntaxToken>& newTokens)
{
CodeDocument::Iterator lastIterator (source);
const int lineLength = lineText.length();
for (;;)
{
int tokenType = analyser->readNextToken (source);
int tokenStart = lastIterator.getPosition();
int tokenEnd = source.getPosition();
if (tokenEnd <= tokenStart)
break;
tokenEnd -= startPosition;
if (tokenEnd > 0)
{
tokenStart -= startPosition;
newTokens.add (new SyntaxToken (lineText.substring (jmax (0, tokenStart), tokenEnd),
tokenType));
if (tokenEnd >= lineLength)
break;
}
lastIterator = source;
}
source = lastIterator;
}
示例9: multiThreadedCallBackTest
void MonitorTests::multiThreadedCallBackTest()
{
beginTest("Concurrent CallBack Test");
Monitor monitor;
monitor.startMonitoring();
OwnedArray<SocketListener> listeners;
for (int i = 0; i < 50 ; i++) {
SocketListener* listener = new SocketListener();
listener->initializeSockets((40780 + (5*i)), &monitor, String("quassel") + String(i*20));
listeners.add(listener);
}
for (int i = 0; i < 50 ; i++) {
pool->addJob(listeners[i], false);
}
while(pool->getNumJobs() > 0 )
{
Thread::sleep(20);
}
monitor.stop();
for (int i = 0; i < 50 ; i++) {
expectEquals(listeners[i]->was_informed , true);
}
}
示例10: getCategoryList
bool SmugMug::getCategoryList(OwnedArray<Category>& categories)
{
StringPairArray params;
XmlElement* n = smugMugRequest(("smugmug.categories.get"), params);
if (n)
{
XmlElement* c = n->getChildByName(("Categories"));
if (c)
{
XmlElement* cat = c->getChildByName(("Category"));
while (cat)
{
Category* category = new Category();
category->id = cat->getIntAttribute(("id"));
category->title = cat->getStringAttribute(("Name"));
categories.add(category);
cat = cat->getNextElementWithTagName(("Category"));
}
}
delete n;
return true;
}
return false;
}
示例11: createFileCreationOptionComboBox
static void createFileCreationOptionComboBox (Component& setupComp,
OwnedArray<Component>& itemsCreated,
const char** fileOptions)
{
ComboBox* c = new ComboBox();
itemsCreated.add (c);
setupComp.addChildAndSetID (c, "filesToCreate");
c->addItemList (StringArray (fileOptions), 1);
c->setSelectedId (1, false);
Label* l = new Label (String::empty, "Files to Auto-Generate:");
l->attachToComponent (c, true);
itemsCreated.add (l);
c->setBounds ("parent.width / 2 + 160, 10, parent.width - 10, top + 22");
}
示例12: addToDeleteList
void ThreadPool::addToDeleteList (OwnedArray<ThreadPoolJob>& deletionList, ThreadPoolJob* const job) const
{
job->shouldStop = true;
job->pool = nullptr;
if (job->shouldBeDeleted)
deletionList.add (job);
}
示例13: createRequiredModules
void EnabledModuleList::createRequiredModules (OwnedArray<LibraryModule>& modules)
{
for (int i = 0; i < getNumModules(); ++i)
{
ModuleDescription info (getModuleInfo (getModuleID (i)));
if (info.isValid())
modules.add (new LibraryModule (info));
}
}
示例14: getImages
bool SmugMug::getImages(OwnedArray<ImageItem>& images, SmugID albumId)
{
StringPairArray params;
params.set(("AlbumID"), String(albumId.id));
params.set(("AlbumKey"), albumId.key);
params.set(("Heavy"), ("1"));
XmlElement* n = smugMugRequest(("smugmug.images.get"), params);
if (n)
{
XmlElement* a = n->getChildByName(("Album"));
if (a)
{
XmlElement* i = a->getChildByName(("Images"));
if (i)
{
XmlElement* img = i->getChildByName(("Image"));
while (img)
{
ImageItem* itm = new ImageItem();
itm->id.id = img->getIntAttribute(("id"));
itm->id.key = img->getStringAttribute(("Key"));
itm->filename = img->getStringAttribute(("FileName"));
itm->caption = img->getStringAttribute((""));
itm->keywords = img->getStringAttribute((""));
itm->position = img->getIntAttribute(("Position"));
itm->date = img->getStringAttribute(("Date"));
itm->format = img->getStringAttribute(("Format"));
itm->serial = img->getIntAttribute(("Serial"));
itm->watermark = img->getBoolAttribute(("Watermark"));
itm->size = img->getIntAttribute(("Size"));
itm->width = img->getIntAttribute(("Width"));
itm->height = img->getIntAttribute(("Height"));
itm->md5sum = img->getStringAttribute(("MD5Sum"));
itm->lastUpdated = img->getStringAttribute(("LastUpdated"));
itm->originalURL = img->getStringAttribute(("OriginalURL"));
itm->largeURL = img->getStringAttribute(("LargeURL"));
itm->mediumURL = img->getStringAttribute(("MediumURL"));
itm->smallURL = img->getStringAttribute(("SmallURL"));
itm->tinyURL = img->getStringAttribute(("TinyURL"));
itm->thumbURL = img->getStringAttribute(("ThumbURL"));
itm->albumURL = img->getStringAttribute(("AlbumURL"));
images.add(itm);
img = img->getNextElementWithTagName(("Image"));
}
}
}
delete n;
return images.size() > 0;
}
return false;
}
示例15: createControllerUpdatesForTime
//==============================================================================
void MidiMessageSequence::createControllerUpdatesForTime (const int channelNumber,
const double time,
OwnedArray<MidiMessage>& dest)
{
bool doneProg = false;
bool donePitchWheel = false;
Array<int> doneControllers;
doneControllers.ensureStorageAllocated (32);
for (int i = list.size(); --i >= 0;)
{
const MidiMessage& mm = list.getUnchecked(i)->message;
if (mm.isForChannel (channelNumber) && mm.getTimeStamp() <= time)
{
if (mm.isProgramChange())
{
if (! doneProg)
{
dest.add (new MidiMessage (mm, 0.0));
doneProg = true;
}
}
else if (mm.isController())
{
if (! doneControllers.contains (mm.getControllerNumber()))
{
dest.add (new MidiMessage (mm, 0.0));
doneControllers.add (mm.getControllerNumber());
}
}
else if (mm.isPitchWheel())
{
if (! donePitchWheel)
{
dest.add (new MidiMessage (mm, 0.0));
donePitchWheel = true;
}
}
}
}
}