示例#1
0
// create a menu of the factory scales.
//
void MLPluginController::populateScaleMenu(const MLFileCollection& fileCollection)
{
    MLMenu* pMenu = findMenuByName("key_scale");
	pMenu->clear();
 	pMenu->addItem("12-equal");
    pMenu->appendMenu(fileCollection.buildMenu());
}
示例#2
0
void MLPluginController::processFileFromCollection (MLSymbol action, const MLFile fileToProcess, const MLFileCollection& collection, int idx, int size)
{
	MLSymbol collectionName(collection.getName());
	if(action == "process")
	{
		if(collectionName.beginsWith(MLSymbol("convert_presets")))
		{			
			// add file action to queue
			FileAction f(action, fileToProcess, &collection, idx, size);
			PaUtil_WriteRingBuffer( &mFileActionQueue, &f, 1 );
		}
	}
}
示例#3
0
void MLPluginProcessor::processFileFromCollection (const MLFile& srcFile, const MLFileCollection& collection, int idx, int size)
{
	MLSymbol collectionName = collection.getName();
    if(collectionName == "scales")
    {
    }
    else if(collectionName == "presets")
    {
        if(idx == 1) // starting?
		{
			
		}
		else if(idx == size) // done?
        {
			
        }
    }
    else if(collectionName == "midi_programs")
    {
		// nothing to do
		// debug() << "GOT MIDI PROGRAM file: " << srcFile.getLongName() << "\n";
    }
}
示例#4
0
void MLPluginController::populatePresetMenu(const MLFileCollection& presetFiles)
{
	MLMenu* menu = findMenuByName("preset");
	if (menu == nullptr)
	{
		debug() << "MLPluginController::populatePresetMenu(): menu not found!\n";
		return;
	}			
	menu->clear();
	
#if DEMO	
	menu->addItem("Save as version", false);
#else
	menu->addItem("Save as version");
#endif	
	
#if DEMO
	menu->addItem("Save", false);
#else

	menu->addItem("Save");
#endif	
	
#if DEMO
	menu->addItem("Save as...", false); 
#else
	menu->addItem("Save as...");
#endif	

	menu->addItem("Revert to saved"); 

	menu->addSeparator();		

	menu->addItem("Copy to clipboard");
	menu->addItem("Paste from clipboard");
	
#if SHOW_CONVERT_PRESETS
#if ML_MAC
	menu->addItem("Convert presets...");
#endif
#endif
	menu->addSeparator();
	
	// presets and directories starting with the name of the plugin followed by a space
	// will be sorted into a separate factory area.
	std::string prefix = MLProjectInfo::projectName + std::string(" ");
	
    // add factory presets, those starting with the plugin name
    menu->appendMenu(presetFiles.buildMenu
					 ([=](MLResourceMap<std::string, MLFile>::const_iterator it)
					  {
						  if(it.getDepth() > 0)
						  {
							  return true;
						  }
						  else
						  {
							  std::string fileName = it->getValue().getShortName();					 
							  return (prefix.compare(fileName.substr(0, prefix.length())) == 0);
						  };
					  }
					  )
					 );	
	menu->addSeparator();
    
    // add user presets, meaning all the others, but no "Samples"
	menu->appendMenu(presetFiles.buildMenu
					 ([=](MLResourceMap<std::string, MLFile>::const_iterator it)
					  {
						  if(it.getDepth() > 0)
						  {
							  return true;
						  }
						  else
						  {
							  std::string fileName = it->getValue().getShortName();		
							  if(fileName.compare("Samples") == 0) return false;
							  return (prefix.compare(fileName.substr(0, prefix.length())) != 0);
						  };
					  }
					  )
					 );
	menu->buildIndex();
}