本文整理汇总了C++中MarSystem::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ MarSystem::getType方法的具体用法?C++ MarSystem::getType怎么用?C++ MarSystem::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MarSystem
的用法示例。
在下文中一共展示了MarSystem::getType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
bool MslCommandCurrent::execute()
{
map<string, MarSystem *>::const_iterator iter;
cout << endl;
cout << "Working set" << endl;
cout << "===========" << endl;
for (iter=workingSet.begin(); iter != workingSet.end(); ++iter) {
MarSystem* tmp = (MarSystem*)iter->second;
cout << "MarSystem: \"" << iter->first << "\"" << " of type: " << tmp->getType() << endl;
}
cout << endl;
return true;
}
示例2:
MslModel::~MslModel() {
map<string, MarSystem *>::const_iterator iter;
for (iter=workingSet.begin(); iter != workingSet.end(); ++iter) {
// we actually should only have to delete the most top
// level composite marsystem as they take care of
// deleting their internal marsystems... here we assume
// that there is only one type Series and its the top level.
MarSystem* tmp = (MarSystem*)iter->second;
string type = tmp->getType();
if (type.compare("Series") == 0) {
delete iter->second;
}
}
}
示例3: textract_trainAccumulator
//.........这里部分代码省略.........
{
spectrumFeatures->addMarSystem(mng.create("Centroid", "cntrd"));
spectrumFeatures->addMarSystem(mng.create("Rolloff", "rlf"));
spectrumFeatures->addMarSystem(mng.create("Flux", "flux"));
spectrumFeatures->addMarSystem(mng.create("MFCC", "mfcc"));
}
else if (extractorStr == "MFCC")
spectrumFeatures->addMarSystem(mng.create("MFCC", "mfcc"));
else if (extractorStr == "SCF")
spectrumFeatures->addMarSystem(mng.create("SCF", "scf"));
else if (extractorStr == "SFM")
spectrumFeatures->addMarSystem(mng.create("SFM", "sfm"));
mng.registerPrototype("SpectrumFeatures", spectrumFeatures->clone());
spectralShape->addMarSystem(mng.create("SpectrumFeatures", "spectrumFeatures"));
mng.registerPrototype("SpectralShape", spectralShape->clone());
// add time-domain zerocrossings
MarSystem* features = mng.create("Fanout", "features");
features->addMarSystem(mng.create("SpectralShape", "SpectralShape"));
if (extractorStr == "STFT")
features->addMarSystem(mng.create("ZeroCrossings", "zcrs"));
mng.registerPrototype("Features", features->clone());
// Means and standard deviation (statistics) for texture analysis
MarSystem* statistics = mng.create("Fanout","statistics");
statistics->addMarSystem(mng.create("Mean", "mn"));
statistics->addMarSystem(mng.create("StandardDeviation", "std"));
mng.registerPrototype("Statistics", statistics->clone());
// weka output
MarSystem *wsink = mng.create("WekaSink","wsink");
// Build the overall feature calculation network
MarSystem* featureNetwork = mng.create("Series", "featureNetwork");
featureNetwork->addMarSystem(src->clone());
featureNetwork->addMarSystem(mng.create("Features", "features"));
featureNetwork->addMarSystem(mng.create("Memory", "memory"));
featureNetwork->updctrl("Memory/memory/mrs_natural/memSize", memSize);
featureNetwork->addMarSystem(mng.create("Statistics", "statistics"));
// add network to accumulator
acc->addMarSystem(featureNetwork->clone());
// Final network compute 30-second statistics
MarSystem* total = mng.create("Series", "total");
total->addMarSystem(acc->clone());
total->addMarSystem(mng.create("Statistics", "statistics2"));
// total->addMarSystem(mng.create("Mean", "mn2"));
total->addMarSystem(wsink->clone());
// update controls
total->updctrl("mrs_natural/inSamples", MRS_DEFAULT_SLICE_NSAMPLES);
total->updctrl("Accumulator/acc/Series/featureNetwork/" + src->getType() + "/src/mrs_natural/pos", offset);
mrs_natural wc = 0;
mrs_natural samplesPlayed =0;
// main loop for extracting the features
string className = "";
total->updctrl("Accumulator/acc/Series/featureNetwork/SoundFileSource/src/mrs_string/filename", sfName);
wc = 0;
samplesPlayed = 0;
total->updctrl("WekaSink/wsink/mrs_natural/nLabels", (mrs_natural)3);
if (wekafname == EMPTYSTRING)
total->updctrl("WekaSink/wsink/mrs_string/filename", "weka2.arff");
else
total->updctrl("WekaSink/wsink/mrs_string/filename", wekafname);
// total->tick();
for (int r = 0; r < tline.numRegions(); r++)
{
cout << "start = " << tline.regionStart(r) << endl;
cout << "end = " << tline.regionEnd(r) << endl;
total->updctrl("Accumulator/acc/Series/featureNetwork/SoundFileSource/src/mrs_natural/pos", (mrs_natural)tline.regionStart(r) * tline.lineSize());
total->updctrl("mrs_natural/inSamples", tline.lineSize());
if (tlineName == EMPTYSTRING)
{
if ((tline.regionClass(r) > 0) && (tline.regionClass(r) != 4))//[?]
{
total->updctrl("WekaSink/wsink/mrs_natural/label", tline.regionClass(r)-1);
}
}
else
total->tick();
}
if (pluginName == EMPTYSTRING) // output to stdout
cout << (*total) << endl;
else
{
ofstream oss(pluginName.c_str());
oss << (*total) << endl;
}
}
示例4: sfplaygui
void sfplaygui(Collection l, mrs_natural offset, mrs_natural duration, mrs_real start, mrs_real length, mrs_real gain, string outName)
{
MarSystemManager mng;
string sfName = l.entry(0);
MarSystem* src = mng.create("SoundFileSource", "src");
src->updctrl("mrs_string/filename", sfName);
Messager* messager =0;
messager = new Messager(2,2001);
MarSystem *dest;
MarSystem *playbacknet = mng.create("Series", "playbacknet");
if (src == NULL)
{
string errmsg = "Skipping file: " + sfName + " (problem with reading)";
MRSWARN(errmsg);
}
else
{
if (outName == EMPTYSTRING) // audio output
dest = mng.create("AudioSink", "dest");
else // filename output
{
dest = mng.create("SoundFileSink", "dest");
dest->updctrl("mrs_string/filename", outName);
}
// create playback network
playbacknet->addMarSystem(src);
playbacknet->addMarSystem(mng.create("Gain", "gt"));
playbacknet->addMarSystem(dest);
int type;
mrs_natural i;
mrs_natural nChannels = playbacknet->getctrl("SoundFileSource/src/mrs_natural/nChannels")->to<mrs_natural>();
mrs_real srate = playbacknet->getctrl("SoundFileSource/src/mrs_real/israte")->to<mrs_real>();
// playback offset & duration
offset = (mrs_natural) (start * srate * nChannels);
duration = (mrs_natural) (length * srate * nChannels);
for (i=0; i < l.size(); i++)
{
sfName = l.entry(i);
cerr << "[" << start << ":" << (start + length) << "] - [" << offset << ":" << (offset + duration) << "] - " << sfName << "-" << endl;
playbacknet->updctrl("SoundFileSource/src/mrs_string/filename", sfName);
mrs_natural nChannels = src->getctrl("mrs_natural/nChannels")->to<mrs_natural>();
mrs_real srate = src->getctrl("mrs_real/israte")->to<mrs_real>();
// playback offset & duration
offset = (mrs_natural) (start * srate * nChannels);
duration = (mrs_natural) (length * srate * nChannels);
// udpate controls
// playbacknet.updctrl("mrs_natural/inSamples", MRS_DEFAULT_SLICE_NSAMPLES/64);
playbacknet->updctrl("mrs_natural/inSamples", 256);
playbacknet->updctrl("Gain/gt/mrs_real/gain", gain);
playbacknet->updctrl("SoundFileSource/src/mrs_natural/pos", offset);
playbacknet->updctrl(dest->getType() + "/dest/mrs_natural/nChannels",
src->getctrl("mrs_natural/nChannels")->to<mrs_natural>());
mrs_natural wc=0;
mrs_natural samplesPlayed = 0;
mrs_natural onSamples = playbacknet->getctrl("mrs_natural/onSamples")->to<mrs_natural>();
string message;
bool done = false;
while ((playbacknet->getctrl("SoundFileSource/src/mrs_bool/hasData")->to<mrs_bool>()) && (duration > samplesPlayed) && !done)
{
type = messager->nextMessage();
if (type < 0)
done = true;
else
{
message = messager->getMessage();
stringstream inss(message);
string cname = "";
mrs_real dur;
mrs_real val;
inss >> cname >> dur >> val;
val = val / 100.0;
if (cname != "")
playbacknet->updctrl(cname,val);
}
playbacknet->tick();
wc ++;
samplesPlayed += onSamples;
}
cerr << "Played " << wc << " slices of " << onSamples << " samples"
//.........这里部分代码省略.........