当前位置: 首页>>代码示例>>C++>>正文


C++ plugin::OutputList类代码示例

本文整理汇总了C++中plugin::OutputList的典型用法代码示例。如果您正苦于以下问题:C++ OutputList类的具体用法?C++ OutputList怎么用?C++ OutputList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了OutputList类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

// Get & load plugins that return timing marks
std::list<std::string> xLightsVamp::GetAvailablePlugins(AudioManager* paudio)
{
	std::list<std::string> ret;

	// Load the plugins in case they have not already been loaded
	LoadPlugins(paudio);

	for (std::vector<Vamp::Plugin *>::iterator it = _loadedPlugins.begin(); it != _loadedPlugins.end(); ++it)
	{
		Plugin::OutputList outputs = (*it)->getOutputDescriptors();

		for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
		{
			if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
				j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
				!j->hasFixedBinCount ||
				(j->hasFixedBinCount && j->binCount > 1))
			{
				// We are filering out this from our return array
				continue;
			}

			std::string name = std::string(wxString::FromUTF8((*it)->getName().c_str()).c_str());

			if (outputs.size() > 1)
			{
				// This is not the plugin's only output.
				// Use "plugin name: output name" as the effect name,
				// unless the output name is the same as the plugin name
				std::string outputName = std::string(wxString::FromUTF8(j->name.c_str()).c_str());
				if (outputName != name)
				{
					std::ostringstream stringStream;
					stringStream << name << ": " << outputName.c_str();
					name = stringStream.str();
				}
			}

			_plugins[name] = (*it);
		}
	}

	for (std::map<std::string, Vamp::Plugin *>::iterator it = _plugins.begin(); it != _plugins.end(); ++it)
	{
		ret.push_back(it->first);
	}

	return ret;
}
开发者ID:bagumondigi,项目名称:xLights,代码行数:50,代码来源:AudioManager.cpp

示例2: populate

void DlgPrefBeats::populate() {
    VampAnalyser::initializePluginPaths();
    m_listIdentifier.clear();
    m_listName.clear();
    m_listLibrary.clear();
    disconnect(plugincombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(pluginSelected(int)));
    plugincombo->clear();
    plugincombo->setDuplicatesEnabled(false);
    connect(plugincombo, SIGNAL(currentIndexChanged(int)),
            this, SLOT(pluginSelected(int)));
    VampPluginLoader *loader = VampPluginLoader::getInstance();
    std::vector<PluginLoader::PluginKey> plugins = loader->listPlugins();
    qDebug() << "VampPluginLoader::listPlugins() returned" << plugins.size() << "plugins";
    for (unsigned int iplugin=0; iplugin < plugins.size(); iplugin++) {
        // TODO(XXX): WTF, 48000
        Plugin *plugin = loader->loadPlugin(plugins[iplugin], 48000);
        //TODO: find a way to add beat trackers only
        if (plugin) {
            Plugin::OutputList outputs = plugin->getOutputDescriptors();
            for (unsigned int ioutput=0; ioutput < outputs.size(); ioutput++) {
                QString displayname = QString::fromStdString(plugin->getIdentifier()) + ":"
                                            + QString::number(ioutput);
                QString displaynametext = QString::fromStdString(plugin->getName());
                qDebug() << "Plugin output displayname:" << displayname << displaynametext;
                bool goodones = ((displayname.contains("mixxxbpmdetection")||
                                  displayname.contains("qm-tempotracker:0"))||
                                 displayname.contains("beatroot:0")||
                                 displayname.contains("marsyas_ibt:0")||
                                 displayname.contains("aubiotempo:0")
                                 );
                if (goodones) {
                    m_listName << displaynametext;
                    QString pluginlibrary = QString::fromStdString(plugins[iplugin]).section(":",0,0);
                    m_listLibrary << pluginlibrary;
                    QString displayname = QString::fromStdString(plugin->getIdentifier()) + ":"
                            + QString::number(ioutput);
                    m_listIdentifier << displayname;
                    plugincombo->addItem(displaynametext, displayname);
                }
            }
            delete plugin;
            plugin = 0;
        }
    }
}
开发者ID:happysoftcore,项目名称:mixxx,代码行数:46,代码来源:dlgprefbeats.cpp

示例3: populate

void DlgPrefKey::populate() {
   VampAnalyser::initializePluginPaths();
   m_listIdentifier.clear();
   m_listName.clear();
   m_listLibrary.clear();
   plugincombo->clear();
   plugincombo->setDuplicatesEnabled(false);
   VampPluginLoader* loader = VampPluginLoader::getInstance();
   std::vector<PluginLoader::PluginKey> plugins = loader->listPlugins();
   qDebug() << "VampPluginLoader::listPlugins() returned" << plugins.size() << "plugins";
   for (unsigned int iplugin=0; iplugin < plugins.size(); iplugin++) {
       // TODO(XXX): WTF, 48000
       Plugin* plugin = loader->loadPlugin(plugins[iplugin], 48000);
       //TODO(XXX): find a general way to add key detectors only
       if (plugin) {
           Plugin::OutputList outputs = plugin->getOutputDescriptors();
           for (unsigned int ioutput=0; ioutput < outputs.size(); ioutput++) {
               QString displayname = QString::fromStdString(plugin->getIdentifier()) + ":"
                                           + QString::number(ioutput);
               QString displaynametext = QString::fromStdString(plugin->getName());
               qDebug() << "Plugin output displayname:" << displayname << displaynametext;
               bool goodones = displayname.contains(VAMP_ANALYSER_KEY_DEFAULT_PLUGIN_ID);

               if (goodones) {
                   m_listName << displaynametext;
                   QString pluginlibrary = QString::fromStdString(plugins[iplugin]).section(":",0,0);
                   m_listLibrary << pluginlibrary;
                   QString displayname = QString::fromStdString(plugin->getIdentifier()) + ":"
                           + QString::number(ioutput);
                   m_listIdentifier << displayname;
                   plugincombo->addItem(displaynametext, displayname);
               }
           }
           delete plugin;
           plugin = 0;
       }
   }
}
开发者ID:calabrhoouse,项目名称:mixxx,代码行数:38,代码来源:dlgprefkey.cpp

示例4: if


//.........这里部分代码省略.........
                }

            } else if (verbosity == PluginInformationDetailed) {

                cout << header(plugin->getName(), 2);
                cout << " - Identifier:         "
                     << key << endl;
                cout << " - Plugin Version:     " 
                     << plugin->getPluginVersion() << endl;
                cout << " - Vamp API Version:   "
                     << plugin->getVampApiVersion() << endl;
                cout << " - Maker:              \""
                     << plugin->getMaker() << "\"" << endl;
                cout << " - Copyright:          \""
                     << plugin->getCopyright() << "\"" << endl;
                cout << " - Description:        \""
                     << plugin->getDescription() << "\"" << endl;
                cout << " - Input Domain:       "
                     << (plugin->getInputDomain() == Vamp::Plugin::TimeDomain ?
                         "Time Domain" : "Frequency Domain") << endl;
                cout << " - Default Step Size:  " 
                     << plugin->getPreferredStepSize() << endl;
                cout << " - Default Block Size: " 
                     << plugin->getPreferredBlockSize() << endl;
                cout << " - Minimum Channels:   " 
                     << plugin->getMinChannelCount() << endl;
                cout << " - Maximum Channels:   " 
                     << plugin->getMaxChannelCount() << endl;

            } else if (verbosity == PluginIds) {
                cout << "vamp:" << key << endl;
            }
            
            Plugin::OutputList outputs =
                plugin->getOutputDescriptors();

            if (verbosity == PluginInformationDetailed) {

                Plugin::ParameterList params = plugin->getParameterDescriptors();
                for (size_t j = 0; j < params.size(); ++j) {
                    Plugin::ParameterDescriptor &pd(params[j]);
                    cout << "\nParameter " << j+1 << ": \"" << pd.name << "\"" << endl;
                    cout << " - Identifier:         " << pd.identifier << endl;
                    cout << " - Description:        \"" << pd.description << "\"" << endl;
                    if (pd.unit != "") {
                        cout << " - Unit:               " << pd.unit << endl;
                    }
                    cout << " - Range:              ";
                    cout << pd.minValue << " -> " << pd.maxValue << endl;
                    cout << " - Default:            ";
                    cout << pd.defaultValue << endl;
                    if (pd.isQuantized) {
                        cout << " - Quantize Step:      "
                             << pd.quantizeStep << endl;
                    }
                    if (!pd.valueNames.empty()) {
                        cout << " - Value Names:        ";
                        for (size_t k = 0; k < pd.valueNames.size(); ++k) {
                            if (k > 0) cout << ", ";
                            cout << "\"" << pd.valueNames[k] << "\"";
                        }
                        cout << endl;
                    }
                }

                if (outputs.empty()) {
开发者ID:chrisbaume,项目名称:vamp-live-host,代码行数:67,代码来源:vamplivehost.cpp

示例5: runPlugin

int runPlugin(string myname, string soname, string id,
              string output, int outputNo, bool useFrames, PaStreamParameters inputParameters)
{
    float				*recordedSamples;
    float				*fifo;
    PaStream*           stream;
    PaError             err = paNoError;
    int					elapsed = 0;
    int					returnValue = 1;
    RealTime			rt;
    PluginWrapper		*wrapper = 0;
    RealTime			adjustment = RealTime::zeroTime;
    PluginLoader		*loader = PluginLoader::getInstance();
    PluginLoader::PluginKey key = loader->composePluginKey(soname, id);

    // load plugin
    Plugin *plugin = loader->loadPlugin(key, SAMPLE_RATE, PluginLoader::ADAPT_ALL_SAFE);
    if (!plugin) {
        cerr << myname << ": ERROR: Failed to load plugin \"" << id
             << "\" from library \"" << soname << "\"" << endl;
        return 1;
    }

    // Find block/step size
    int blockSize = plugin->getPreferredBlockSize();
    int stepSize = plugin->getPreferredStepSize();

    if (blockSize == 0) {
        blockSize = 1024;
    }
    if (stepSize == 0) {
        if (plugin->getInputDomain() == Plugin::FrequencyDomain) {
            stepSize = blockSize/2;
        } else {
            stepSize = blockSize;
        }
    } else if (stepSize > blockSize) {
        cerr << "WARNING: stepSize " << stepSize << " > blockSize " << blockSize << ", resetting blockSize to ";
        if (plugin->getInputDomain() == Plugin::FrequencyDomain) {
            blockSize = stepSize * 2;
        } else {
            blockSize = stepSize;
        }
        cerr << blockSize << endl;
    }

    // set up port audio
    fifo = new float[blockSize]();
    recordedSamples = new float[stepSize]();

    ofstream *out = 0;
    cerr << "Running plugin: \"" << plugin->getIdentifier() << "\"..." << endl;
    cerr << "Using block size = " << blockSize << ", step size = " << stepSize << endl;

    // display output name
    Plugin::OutputList outputs = plugin->getOutputDescriptors();
    Plugin::OutputDescriptor od;

    if (outputs.empty()) {
    	cerr << "ERROR: Plugin has no outputs!" << endl;
    	goto done;
    }

    if (outputNo < 0) {

        for (size_t oi = 0; oi < outputs.size(); ++oi) {
            if (outputs[oi].identifier == output) {
                outputNo = oi;
                break;
            }
        }

        if (outputNo < 0) {
            cerr << "ERROR: Non-existent output \"" << output << "\" requested" << endl;
            goto done;
        }

    } else {

        if (int(outputs.size()) <= outputNo) {
            cerr << "ERROR: Output " << outputNo << " requested, but plugin has only " << outputs.size() << " output(s)" << endl;
            goto done;
        }
    }

    od = outputs[outputNo];
    cerr << "Output is: \"" << od.identifier << "\"" << endl;

    // Initialise plugin
    if (!plugin->initialise(1, stepSize, blockSize)) {
        cerr << "ERROR: Plugin initialise (stepSize = " << stepSize << ", blockSize = "
             << blockSize << ") failed." << endl;
        goto done;
    }

    // Compensate timestamp if in freq domain
    wrapper = dynamic_cast<PluginWrapper *>(plugin);
    if (wrapper) {
        PluginInputDomainAdapter *ida =  wrapper->getWrapper<PluginInputDomainAdapter>();
        if (ida) adjustment = ida->getTimestampAdjustment();
//.........这里部分代码省略.........
开发者ID:chrisbaume,项目名称:vamp-live-host,代码行数:101,代码来源:vamplivehost.cpp

示例6: runPlugin


//.........这里部分代码省略.........
            stepSize = blockSize;
        }
    } else if (stepSize > blockSize) {
        cerr << "WARNING: stepSize " << stepSize << " > blockSize " << blockSize << ", resetting blockSize to ";
        if (plugin->getInputDomain() == Plugin::FrequencyDomain) {
            blockSize = stepSize * 2;
        } else {
            blockSize = stepSize;
        }
        cerr << blockSize << endl;
    }
    int overlapSize = blockSize - stepSize;
    sf_count_t currentStep = 0;
    int finalStepsRemaining = max(1, (blockSize / stepSize) - 1); // at end of file, this many part-silent frames needed after we hit EOF

    int channels = sfinfo.channels;

    float *filebuf = new float[blockSize * channels];
    float **plugbuf = new float*[channels];
    for (int c = 0; c < channels; ++c) plugbuf[c] = new float[blockSize + 2];

    cerr << "Using block size = " << blockSize << ", step size = "
              << stepSize << endl;

    // The channel queries here are for informational purposes only --
    // a PluginChannelAdapter is being used automatically behind the
    // scenes, and it will take case of any channel mismatch

    int minch = plugin->getMinChannelCount();
    int maxch = plugin->getMaxChannelCount();
    cerr << "Plugin accepts " << minch << " -> " << maxch << " channel(s)" << endl;
    cerr << "Sound file has " << channels << " (will mix/augment if necessary)" << endl;

    Plugin::OutputList outputs = plugin->getOutputDescriptors();
    Plugin::OutputDescriptor od;

    int returnValue = 1;
    int progress = 0;

    RealTime rt;
    PluginWrapper *wrapper = 0;
    RealTime adjustment = RealTime::zeroTime;

    if (outputs.empty()) {
        cerr << "ERROR: Plugin has no outputs!" << endl;
        goto done;
    }

    if (outputNo < 0) {

        for (size_t oi = 0; oi < outputs.size(); ++oi) {
            if (outputs[oi].identifier == output) {
                outputNo = oi;
                break;
            }
        }

        if (outputNo < 0) {
            cerr << "ERROR: Non-existent output \"" << output << "\" requested" << endl;
            goto done;
        }

    } else {

        if (int(outputs.size()) <= outputNo) {
            cerr << "ERROR: Output " << outputNo << " requested, but plugin has only " << outputs.size() << " output(s)" << endl;
开发者ID:cgreenhalgh,项目名称:vamp-live,代码行数:67,代码来源:vamp-live-host.cpp

示例7: AutoRegisterPlugins

bool VampEffectsModule::AutoRegisterPlugins(PluginManagerInterface & pm)
{
#ifdef EFFECT_CATEGORIES
   InitCategoryMap();
#endif

   PluginLoader *loader = PluginLoader::getInstance();

   EffectManager& em = EffectManager::Get();

   PluginLoader::PluginKeyList keys = loader->listPlugins();

   for (PluginLoader::PluginKeyList::iterator i = keys.begin();
        i != keys.end(); ++i) {

      Plugin *vp = loader->loadPlugin(*i, 48000); // rate doesn't matter here
      if (!vp) continue;

#ifdef EFFECT_CATEGORIES

      PluginLoader::PluginCategoryHierarchy category =
         loader->getPluginCategory(*i);
      wxString vampCategory = VampHierarchyToUri(category);

#endif

      // We limit the listed plugin outputs to those whose results can
      // readily be displayed in an Audacity label track.
      //
      // - Any output whose features have no values (time instants only),
      //   with or without duration, is fine
      //
      // - Any output whose features have more than one value, or an
      //   unknown or variable number of values, is right out
      //
      // - Any output whose features have exactly one value, with
      //   variable sample rate or with duration, should be OK --
      //   this implies a sparse feature, of which the time and/or
      //   duration are significant aspects worth displaying
      //
      // - An output whose features have exactly one value, with
      //   fixed sample rate and no duration, cannot be usefully
      //   displayed -- the value is the only significant piece of
      //   data there and we have no good value plot

      Plugin::OutputList outputs = vp->getOutputDescriptors();

      int n = 0;

      bool hasParameters = !vp->getParameterDescriptors().empty();

      for (Plugin::OutputList::iterator j = outputs.begin();
           j != outputs.end(); ++j) {

         if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
             j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
             !j->hasFixedBinCount ||
             (j->hasFixedBinCount && j->binCount > 1)) {

            // All of these qualities disqualify (see notes above)

            ++n;
            continue;
         }

         wxString name = LAT1CTOWX(vp->getName().c_str());

         if (outputs.size() > 1) {
            // This is not the plugin's only output.
            // Use "plugin name: output name" as the effect name,
            // unless the output name is the same as the plugin name
            wxString outputName = LAT1CTOWX(j->name.c_str());
            if (outputName != name) {
               name = wxString::Format(wxT("%s: %s"),
                                       name.c_str(), outputName.c_str());
            }
         }

#ifdef EFFECT_CATEGORIES
         VampEffect *effect = new VampEffect(*i, n, hasParameters, name,
                                                vampCategory);
#else
         VampEffect *effect = new VampEffect(*i, n, hasParameters, name);
#endif
         em.RegisterEffect(this, effect);

         ++n;
      }

      delete vp;
   }

   return true;
}
开发者ID:dot-Sean,项目名称:audio,代码行数:94,代码来源:LoadVamp.cpp

示例8: main

int main(int argc, char **argv)
{
    const char *myname = argv[0];

    if (argc != 2) {
	cerr << "usage: " << myname << " file.wav" << endl;
	return 2;
    }

    const char *infile = argv[1];

    SF_INFO sfinfo;
    SNDFILE *sndfile = sf_open(infile, SFM_READ, &sfinfo);

    if (!sndfile) {
	cerr << myname << ": Failed to open input file " << infile
	     << ": " << sf_strerror(sndfile) << endl;
	return 1;
    }

    Chordino *chordino = new Chordino(sfinfo.samplerate);
    PluginInputDomainAdapter *ia = new PluginInputDomainAdapter(chordino);
    ia->setProcessTimestampMethod(PluginInputDomainAdapter::ShiftData);
    PluginBufferingAdapter *adapter = new PluginBufferingAdapter(ia);

    int blocksize = adapter->getPreferredBlockSize();

    // Plugin requires 1 channel (we will mix down)
    if (!adapter->initialise(1, blocksize, blocksize)) {
	cerr << myname << ": Failed to initialise Chordino adapter!" << endl;
	return 1;
    }

    float *filebuf = new float[sfinfo.channels * blocksize];
    float *mixbuf = new float[blocksize];

    Plugin::FeatureList chordFeatures;
    Plugin::FeatureSet fs;

    int chordFeatureNo = -1;
    Plugin::OutputList outputs = adapter->getOutputDescriptors();
    for (int i = 0; i < int(outputs.size()); ++i) {
	if (outputs[i].identifier == "simplechord") {
	    chordFeatureNo = i;
	}
    }
    if (chordFeatureNo < 0) {
	cerr << myname << ": Failed to identify chords output!" << endl;
	return 1;
    }
    
    int frame = 0;
    while (frame < sfinfo.frames) {

	int count = -1;
	if ((count = sf_readf_float(sndfile, filebuf, blocksize)) <= 0) break;

	// mix down
	for (int i = 0; i < blocksize; ++i) {
	    mixbuf[i] = 0.f;
	    if (i < count) {
		for (int c = 0; c < sfinfo.channels; ++c) {
		    mixbuf[i] += filebuf[i * sfinfo.channels + c] / sfinfo.channels;
		}
	    }
	}

	RealTime timestamp = RealTime::frame2RealTime(frame, sfinfo.samplerate);
	
	// feed to plugin: can just take address of buffer, as only one channel
	fs = adapter->process(&mixbuf, timestamp);

	chordFeatures.insert(chordFeatures.end(),
			     fs[chordFeatureNo].begin(),
			     fs[chordFeatureNo].end());

	frame += count;
    }

    sf_close(sndfile);

    // features at end of processing (actually Chordino does all its work here)
    fs = adapter->getRemainingFeatures();

    // chord output is output index 0
    chordFeatures.insert(chordFeatures.end(),
			 fs[chordFeatureNo].begin(),
			 fs[chordFeatureNo].end());

    for (int i = 0; i < (int)chordFeatures.size(); ++i) {
	cout << chordFeatures[i].timestamp.toString() << ": "
	     << chordFeatures[i].label << endl;
    }

    delete[] filebuf;
    delete[] mixbuf;
    
    delete adapter;
}
开发者ID:vinodronold,项目名称:5FPY,代码行数:99,代码来源:chordextract.cpp

示例9: SelectOutput

void VampAnalyser::SelectOutput(const int outputnumber) {
    Plugin::OutputList outputs = m_plugin->getOutputDescriptors();
    if (outputnumber >= 0 && outputnumber < int(outputs.size())) {
        m_iOutput = outputnumber;
    }
}
开发者ID:PimpinFou,项目名称:mixxx,代码行数:6,代码来源:vampanalyser.cpp

示例10: Init

bool VampAnalyser::Init(const QString pluginlibrary, const QString pluginid,
                        const int samplerate, const int TotalSamples, bool bFastAnalysis) {
    m_iRemainingSamples = TotalSamples;
    m_rate = samplerate;

    if (samplerate <= 0.0) {
        qDebug() << "VampAnalyser: Track has non-positive samplerate";
        return false;
    }

    if (TotalSamples <= 0) {
        qDebug() << "VampAnalyser: Track has non-positive # of samples";
        return false;
    }

    if (m_plugin != NULL) {
        delete m_plugin;
        m_plugin = NULL;
        qDebug() << "VampAnalyser: kill plugin";
    }

    VampPluginLoader *loader = VampPluginLoader::getInstance();
    QStringList pluginlist = pluginid.split(":");
    if (pluginlist.size() != 2) {
        qDebug() << "VampAnalyser: got malformed pluginid: " << pluginid;
        return false;
    }

    bool isNumber = false;
    int outputnumber = (pluginlist.at(1)).toInt(&isNumber);
    if (!isNumber) {
        qDebug() << "VampAnalyser: got malformed pluginid: " << pluginid;
        return false;
    }

    QString plugin = pluginlist.at(0);
    m_key = loader->composePluginKey(pluginlibrary.toStdString(),
                                     plugin.toStdString());
    m_plugin = loader->loadPlugin(m_key, m_rate,
                                  Vamp::HostExt::PluginLoader::ADAPT_ALL_SAFE);

    if (!m_plugin) {
        qDebug() << "VampAnalyser: Cannot load Vamp Plug-in.";
        qDebug() << "Please copy libmixxxminimal.so from build dir to one of the following:";

        std::vector<std::string> path = PluginHostAdapter::getPluginPath();
        for (unsigned int i = 0; i < path.size(); i++) {
            qDebug() << QString::fromStdString(path[i]);
        }
        return false;
    }
    Plugin::OutputList outputs = m_plugin->getOutputDescriptors();
    if (outputs.empty()) {
        qDebug() << "VampAnalyser: Plugin has no outputs!";
        return false;
    }
    SelectOutput(outputnumber);

    m_iBlockSize = m_plugin->getPreferredBlockSize();
    qDebug() << "Vampanalyser BlockSize: " << m_iBlockSize;
    if (m_iBlockSize == 0) {
        // A plugin that can handle any block size may return 0. The final block
        // size will be set in the initialise() call. Since 0 means it is
        // accepting any size, 1024 should be good
        m_iBlockSize = 1024;
        qDebug() << "Vampanalyser: setting m_iBlockSize to 1024";
    }

    m_iStepSize = m_plugin->getPreferredStepSize();
    qDebug() << "Vampanalyser StepSize: " << m_iStepSize;
    if (m_iStepSize == 0 || m_iStepSize > m_iBlockSize) {
        // A plugin may return 0 if it has no particular interest in the step
        // size. In this case, the host should make the step size equal to the
        // block size if the plugin is accepting input in the time domain. If
        // the plugin is accepting input in the frequency domain, the host may
        // use any step size. The final step size will be set in the
        // initialise() call.
        m_iStepSize = m_iBlockSize;
        qDebug() << "Vampanalyser: setting m_iStepSize to" << m_iStepSize;
    }

    if (!m_plugin->initialise(2, m_iStepSize, m_iBlockSize)) {
        qDebug() << "VampAnalyser: Cannot initialise plugin";
        return false;
    }
    // Here we are using m_iBlockSize: it cannot be 0
    m_pluginbuf[0] = new CSAMPLE[m_iBlockSize];
    m_pluginbuf[1] = new CSAMPLE[m_iBlockSize];
    m_FastAnalysisEnabled = bFastAnalysis;
    if (m_FastAnalysisEnabled) {
        qDebug() << "Using fast analysis methods for BPM and Replay Gain.";
        m_iMaxSamplesToAnalyse = 120 * m_rate; //only consider the first minute
    }
    return true;
}
开发者ID:PimpinFou,项目名称:mixxx,代码行数:95,代码来源:vampanalyser.cpp

示例11:

Plugin *VampEffectsModule::FindPlugin(const wxString & path,
                                      int & output,
                                      bool & hasParameters)
{
   PluginLoader::PluginKey key = path.BeforeLast(wxT('/')).ToUTF8().data();

   Plugin *vp = PluginLoader::getInstance()->loadPlugin(key, 48000); // rate doesn't matter here
   if (!vp)
   {
      return false;
   }

   // We limit the listed plugin outputs to those whose results can
   // readily be displayed in an Audacity label track.
   //
   // - Any output whose features have no values (time instants only),
   //   with or without duration, is fine
   //
   // - Any output whose features have more than one value, or an
   //   unknown or variable number of values, is right out
   //
   // - Any output whose features have exactly one value, with
   //   variable sample rate or with duration, should be OK --
   //   this implies a sparse feature, of which the time and/or
   //   duration are significant aspects worth displaying
   //
   // - An output whose features have exactly one value, with
   //   fixed sample rate and no duration, cannot be usefully
   //   displayed -- the value is the only significant piece of
   //   data there and we have no good value plot

   Plugin::OutputList outputs = vp->getOutputDescriptors();

   output = 0;

   hasParameters = !vp->getParameterDescriptors().empty();

   for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
   {
      if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
            j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
            !j->hasFixedBinCount ||
            (j->hasFixedBinCount && j->binCount > 1))
      {
         // All of these qualities disqualify (see notes above)

         ++output;
         continue;
      }

      wxString name = wxString::FromUTF8(vp->getName().c_str());

      if (outputs.size() > 1)
      {
         // This is not the plugin's only output.
         // Use "plugin name: output name" as the effect name,
         // unless the output name is the same as the plugin name
         wxString outputName = wxString::FromUTF8(j->name.c_str());
         if (outputName != name)
         {
            name = wxString::Format(wxT("%s: %s"),
                                    name.c_str(), outputName.c_str());
         }
      }

      if (wxString::FromUTF8(key.c_str()) + wxT("/") + name == path)
      {
         return vp;
      }

      ++output;
   }

   delete vp;

   return NULL;
}
开发者ID:LBoggino,项目名称:audacity,代码行数:77,代码来源:LoadVamp.cpp

示例12: FindPlugins

wxArrayString VampEffectsModule::FindPlugins(PluginManagerInterface & WXUNUSED(pm))
{
   wxArrayString names;

   PluginLoader *loader = PluginLoader::getInstance();

   PluginLoader::PluginKeyList keys = loader->listPlugins();

   for (PluginLoader::PluginKeyList::iterator i = keys.begin(); i != keys.end(); ++i)
   {
      Plugin *vp = PluginLoader::getInstance()->loadPlugin(*i, 48000); // rate doesn't matter here
      if (!vp)
      {
         continue;
      }

      // We limit the listed plugin outputs to those whose results can
      // readily be displayed in an Audacity label track.
      //
      // - Any output whose features have no values (time instants only),
      //   with or without duration, is fine
      //
      // - Any output whose features have more than one value, or an
      //   unknown or variable number of values, is right out
      //
      // - Any output whose features have exactly one value, with
      //   variable sample rate or with duration, should be OK --
      //   this implies a sparse feature, of which the time and/or
      //   duration are significant aspects worth displaying
      //
      // - An output whose features have exactly one value, with
      //   fixed sample rate and no duration, cannot be usefully
      //   displayed -- the value is the only significant piece of
      //   data there and we have no good value plot

      Plugin::OutputList outputs = vp->getOutputDescriptors();

      int output = 0;

      for (Plugin::OutputList::iterator j = outputs.begin(); j != outputs.end(); ++j)
      {
         if (j->sampleType == Plugin::OutputDescriptor::FixedSampleRate ||
               j->sampleType == Plugin::OutputDescriptor::OneSamplePerStep ||
               !j->hasFixedBinCount ||
               (j->hasFixedBinCount && j->binCount > 1))
         {
            // All of these qualities disqualify (see notes above)

            ++output;
            continue;
         }

         wxString name = wxString::FromUTF8(vp->getName().c_str());

         if (outputs.size() > 1)
         {
            // This is not the plugin's only output.
            // Use "plugin name: output name" as the effect name,
            // unless the output name is the same as the plugin name
            wxString outputName = wxString::FromUTF8(j->name.c_str());
            if (outputName != name)
            {
               name = wxString::Format(wxT("%s: %s"),
                                       name.c_str(), outputName.c_str());
            }
         }

         wxString path = wxString::FromUTF8(i->c_str()) + wxT("/") + name;
         names.Add(path);

         ++output;
      }

      delete vp;
   }

   return names;
}
开发者ID:LBoggino,项目名称:audacity,代码行数:78,代码来源:LoadVamp.cpp

示例13: ProcessPlugin

wxString VAMPPluginDialog::ProcessPlugin(xLightsXmlFile* xml_file, xLightsFrame *xLightsParent, const wxString &name, AudioManager* media) 
{
    Vamp::Plugin *p = media->GetVamp()->GetPlugin(std::string(name.c_str()));
    Label1->SetLabel(p->getName());
    Label2->SetLabel(p->getDescription());

    int output = 0;
    Plugin::OutputList outputs = p->getOutputDescriptors();
    if (outputs.size() > 1) {
        for (int x = 0; x < outputs.size(); x++) {
            wxString pname = wxString::FromUTF8(p->getName().c_str());
            wxString outputName = wxString::FromUTF8(outputs[x].name.c_str());
            if (outputName != pname) {
                pname = wxString::Format(wxT("%s: %s"),
                                        pname.c_str(), outputName.c_str());
            }
            if (name == pname) {
                output = x;
                TimingName->SetValue(outputName);
            }
        }
    } else {
        TimingName->SetValue(p->getName());
    }

    PluginBase::ParameterList params = p->getParameterDescriptors();
    std::vector<void *> controls;
    for (int x = 0; x < params.size(); x++) {
        wxString tip = wxString::FromUTF8(params[x].description.c_str());
        wxString unit = wxString::FromUTF8(params[x].unit.c_str());

        float value = p->getParameter(params[x].identifier);
        wxString labelText = wxString::FromUTF8(params[x].name.c_str());
        if (!unit.IsEmpty()) {
            labelText += wxT(" (") + unit + wxT(")");
        }
        wxStaticText *desc = new wxStaticText(this, wxID_ANY, labelText + wxT(":"));
        SettingsSizer->Add(desc, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);

        if (params[x].isQuantized &&
            params[x].quantizeStep == 1.0 &&
            params[x].minValue == 0.0 &&
            params[x].maxValue == 1.0)
        {
            wxCheckBox *cb = new wxCheckBox(this, wxID_ANY, _(""));
            cb->SetValue(value > 0.5);

            if (!tip.IsEmpty())
            {
                cb->SetToolTip(tip);
            }
            SettingsSizer->Add(cb, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
            controls.push_back(cb);
        }
        else if (params[x].isQuantized &&
                 params[x].quantizeStep == 1.0 &&
                 !params[x].valueNames.empty())
        {

            wxChoice *choice = new wxChoice(this, wxID_ANY);

            for (size_t i = 0, cnt = params[x].valueNames.size(); i < cnt; i++)
            {
                wxString choicetxt = wxString::FromUTF8(params[x].valueNames[i].c_str());
                choice->Append(choicetxt);
                if (size_t(value - params[x].minValue + 0.5) == i) {
                    choice->SetSelection(i);
                }
            }
            choice->SetSizeHints(-1, -1);
            if (!tip.IsEmpty())
            {
                choice->SetToolTip(tip);
            }
            SettingsSizer->Add(choice, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5);
            controls.push_back(choice);
        }
        else
        {
            FloatSliderControl *slider = new FloatSliderControl(this, value, params[x].minValue, params[x].maxValue, tip);
            SettingsSizer->Add(slider,
                               1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5);
            controls.push_back(slider);
        }

    }
    Fit();
    int res = ShowModal();
    if (res == wxID_OK) {
        while (xml_file->TimingAlreadyExists(TimingName->GetValue().ToStdString(), xLightsParent)) {
            wxMessageBox("Timing track " + TimingName->GetValue() + " already exists");
            res = ShowModal();
            if (res != wxID_OK) {
                return "";
            }
        }

        std::vector<int> starts;
        std::vector<int> ends;
        std::vector<std::string> labels;
//.........这里部分代码省略.........
开发者ID:Jchuchla,项目名称:xLights,代码行数:101,代码来源:VAMPPluginDialog.cpp


注:本文中的plugin::OutputList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。