00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "MarSystemManager.h"
00020 #include "MarSystem.h"
00021 #include "HalfWaveRectifier.h"
00022 #include "common.h"
00023 #include "Series.h"
00024 #include "Cascade.h"
00025 #include "Parallel.h"
00026 #include "Fanin.h"
00027 #include "Fanout.h"
00028 #include "TimeStretch.h"
00029 #include "PatchMatrix.h"
00030 #include "Peaker.h"
00031 #include "PeakerAdaptive.h"
00032 #include "MaxArgMax.h"
00033 #include "MinArgMin.h"
00034 #include "AutoCorrelation.h"
00035 #include "Spectrum.h"
00036 #include "InvSpectrum.h"
00037 #include "Negative.h"
00038 #include "PvConvert.h"
00039 #include "PvFold.h"
00040 #include "PvOscBank.h"
00041 #include "ShiftInput.h"
00042 #include "ShiftOutput.h"
00043 #include "Shifter.h"
00044 #include "PvUnconvert.h"
00045 #include "PvOverlapadd.h"
00046 #include "PvConvolve.h"
00047 #include "AuFileSource.h"
00048 #include "WavFileSource.h"
00049 #include "WavFileSource2.h"
00050 #include "SineSource.h"
00051 #include "NoiseSource.h"
00052 #include "AudioSinkBlocking.h"
00053 #include "AudioSink.h"
00054 #include "Mono2Stereo.h"
00055 #include "PeakConvert.h"
00056 #include "PeakConvert2.h"
00057 #include "OverlapAdd.h"
00058 #include "ClassificationReport.h"
00059 #include "PeakRatio.h"
00060 #include "PeakSynthOsc.h"
00061 #include "PeakSynthOscBank.h"
00062 #include "PeakSynthFFT.h"
00063 #include "PeakResidual.h"
00064 #include "RealvecSource.h"
00065 #include "RealvecSink.h"
00066 #include "Power.h"
00067 #include "Cartesian2Polar.h"
00068 #include "Polar2Cartesian.h"
00069 #include "Windowing.h"
00070 #include "AuFileSink.h"
00071 #include "WavFileSink.h"
00072 #include "PowerSpectrum.h"
00073 #include "Centroid.h"
00074 #include "Rolloff.h"
00075 #include "Flux.h"
00076 #include "ZeroCrossings.h"
00077 #include "Memory.h"
00078 #include "Mean.h"
00079 #include "DTW.h"
00080 #include "StandardDeviation.h"
00081 #include "PlotSink.h"
00082 #include "GaussianClassifier.h"
00083 #include "GMMClassifier.h"
00084 #include "SoundFileSource.h"
00085 #include "SoundFileSource2.h"
00086 #include "SoundFileSink.h"
00087 #include "MP3FileSink.h"
00088 #include "Confidence.h"
00089 #include "Rms.h"
00090 #include "Peak2Rms.h"
00091 #include "WekaSink.h"
00092 #include "WekaSource.h"
00093 #include "MFCC.h"
00094 #include "SCF.h"
00095 #include "SFM.h"
00096 #include "Accumulator.h"
00097 #include "Shredder.h"
00098 #include "WaveletPyramid.h"
00099 #include "WaveletBands.h"
00100 #include "FullWaveRectifier.h"
00101 #include "OnePole.h"
00102 #include "Norm.h"
00103 #include "Sum.h"
00104 #include "Product.h"
00105 #include "Reciprocal.h"
00106 #include "AccentFilterBank.h"
00107 #include "ConstQFiltering.h"
00108 #include "Compressor.h"
00109 #include "Differentiator.h"
00110 #include "Delta.h"
00111 #include "Square.h"
00112 #include "Subtract.h"
00113 #include "Median.h"
00114 #include "MedianFilter.h"
00115 #include "AubioYin.h"
00116 #include "Yin.h"
00117 #include "DownSampler.h"
00118 #include "PeakPeriods2BPM.h"
00119 #include "BeatHistogramFromPeaks.h"
00120 #include "BeatHistogram.h"
00121 #include "BeatHistoFeatures.h"
00122 #include "BeatPhase.h"
00123 #include "FM.h"
00124 #include "Annotator.h"
00125 #include "ZeroRClassifier.h"
00126 #include "KNNClassifier.h"
00127 #include "Kurtosis.h"
00128 #include "Skewness.h"
00129 #include "ViconFileSource.h"
00130 #include "ClassOutputSink.h"
00131 #include "Filter.h"
00132 #include "Biquad.h"
00133 #include "ERB.h"
00134 #include "LyonPassiveEar.h"
00135 #include "Clip.h"
00136 #include "HarmonicEnhancer.h"
00137 #include "Reassign.h"
00138 #include "SilenceRemove.h"
00139 #include "NormMaxMin.h"
00140 #include "Normalize.h"
00141 #include "SMO.h"
00142 #include "Plucked.h"
00143 #include "Delay.h"
00144 #include "LPC.h"
00145 #include "LPCC.h"
00146 #include "LSP.h"
00147 #include "SOM.h"
00148 #include "FlowCutSource.h"
00149 #include "MidiInput.h"
00150 #include "MidiOutput.h"
00151 #include "BICchangeDetector.h"
00152 #include "SpectralSNR.h"
00153 #include "StereoSpectrum.h"
00154 #include "StereoSpectrumFeatures.h"
00155 #include "Vibrato.h"
00156 #include "Panorama.h"
00157 #include "FlowThru.h"
00158 #include "FanOutIn.h"
00159 #include "CompExp.h"
00160 #include "MarSystemTemplateMedium.h"
00161 #include "PeakFeatureSelect.h"
00162 #include "SimilarityMatrix.h"
00163 #include "SelfSimilarityMatrix.h"
00164 #include "Metric.h"
00165 #include "HWPS.h"
00166 #include "RBF.h"
00167 #include "NormMatrix.h"
00168 #include "WHaSp.h"
00169 #include "PeakLabeler.h"
00170 #include "PeakClusterSelect.h"
00171 #include "PeakViewSink.h"
00172 #include "NormCut.h"
00173 #include "PeakViewSource.h"
00174 #include "OneRClassifier.h"
00175 #include "WekaData.h"
00176 #include "PhiSEMSource.h"
00177 #include "PhiSEMFilter.h"
00178 #include "SVMClassifier.h"
00179 #include "Chroma.h"
00180 #include "Spectrum2Chroma.h"
00181 #include "Spectrum2Mel.h"
00182 #include "ADRess.h"
00183 #include "ADRessSpectrum.h"
00184 #include "ADRessStereoSpectrum.h"
00185 #include "EnhADRess.h"
00186 #include "StereoSpectrumSources.h"
00187 #include "EnhADRessStereoSpectrum.h"
00188 #include "McAulayQuatieri.h"
00189 #include "PeakerOnset.h"
00190 #include "ADSR.h"
00191 #include "Reverse.h"
00192 #include "Deinterleave.h"
00193 #include "DeInterleaveSizecontrol.h"
00194 #include "SNR.h"
00195 #include "PCA.h"
00196 #include "AbsMax.h"
00197 #include "MaxMin.h"
00198 #include "TimelineLabeler.h"
00199 #include "RadioDrumInput.h"
00200 #include "NoiseGate.h"
00201 #include "ResampleBezier.h"
00202 #include "ResampleLinear.h"
00203 #include "Resample.h"
00204 #include "ResampleSinc.h"
00205 #include "ResampleNearestNeighbour.h"
00206 #include "StretchLinear.h"
00207 #include "MidiFileSynthSource.h"
00208 #include "PvMultiResolution.h"
00209 #include "Gain.h"
00210 #include "Selector.h"
00211 #include "SpectralTransformations.h"
00212 #include "RunningStatistics.h"
00213 #include "SliceDelta.h"
00214 #include "DeltaFirstOrderRegression.h"
00215 #include "ArffFileSink.h"
00216 #include "MixToMono.h"
00217 #include "SoundFileSourceHopper.h"
00218 #include "TempoHypotheses.h"
00219 #include "OnsetTimes.h"
00220 #include "BeatAgent.h"
00221 #include "BeatReferee.h"
00222 #include "PhaseLock.h"
00223 #include "BeatTimesSink.h"
00224 #include "CrossCorrelation.h"
00225 #include "SliceShuffle.h"
00226 #include "RunningAutocorrelation.h"
00227 #include "SubtractMean.h"
00228 #include "AutoCorrelationFFT.h"
00229 #include "PeakEnhancer.h"
00230 #include "Transposer.h"
00231 #include "SimulMaskingFft.h"
00232 #include "AimPZFC.h"
00233 #include "AimPZFC2.h"
00234 #include "AimGammatone.h"
00235 #include "AimHCL.h"
00236 #include "AimHCL2.h"
00237 #include "AimLocalMax.h"
00238 #include "AimSAI.h"
00239 #include "AimSSI.h"
00240 #include "AimBoxes.h"
00241 #include "AimVQ.h"
00242 #include "Unfold.h"
00243 #include "TimeFreqPeakConnectivity.h"
00244 #include "Combinator.h"
00245 #include "ParallelMatrixWeight.h"
00246 #include "PeakDistanceHorizontality.h"
00247 #include "PeakViewMerge.h"
00248 #include "FMeasure.h"
00249 #include "DelaySamples.h"
00250 #include "OrcaSnip.h"
00251 #include "AMDF.h"
00252 #include "Inject.h"
00253 #include "PowerToAverageRatio.h"
00254 #include "MeanAbsoluteDeviation.h"
00255 #include "NormalizeAbs.h"
00256 #include "RemoveObservations.h"
00257 #include "SpectralFlatnessAllBands.h"
00258 #include "MathPower.h"
00259 #include "PitchDiff.h"
00260 #include "CARFAC.h"
00261
00262 #include "HarmonicStrength.h"
00263 #include "CsvFileSource.h"
00264 #include "Krumhansl_key_finder.h"
00265 #include "PWMSource.h"
00266 #include "DCSource.h"
00267 #include "AudioSource.h"
00268 #include "AudioSourceBlocking.h"
00269
00270
00271
00272 using std::ostringstream;
00273 using std::map;
00274 using std::istream;
00275 using std::ostream;
00276 using std::vector;
00277
00278 using namespace Marsyas;
00279
00280 MarSystemManager::MarSystemManager()
00281 {
00282 registerPrototype("SoundFileSource", new SoundFileSource("sfp"));
00283 registerPrototype("SoundFileSource2", new SoundFileSource2("sf2p"));
00284 registerPrototype("HalfWaveRectifier", new HalfWaveRectifier("hwrp"));
00285 registerPrototype("AutoCorrelation", new AutoCorrelation("acrp"));
00286 registerPrototype("Series", new Series("srp"));
00287 registerPrototype("Fanin", new Fanin("finp"));
00288 registerPrototype("Fanout", new Fanout("fonp"));
00289 registerPrototype("Parallel", new Parallel("parallelp"));
00290 registerPrototype("Cascade", new Cascade("cascadep"));
00291 registerPrototype("TimeStretch", new TimeStretch("tscp"));
00292 registerPrototype("Peaker", new Peaker("pkrp"));
00293 registerPrototype("PatchMatrix", new PatchMatrix("patmatpr"));
00294 registerPrototype("PeakerAdaptive", new PeakerAdaptive("pkr1pr"));
00295 registerPrototype("MaxArgMax", new MaxArgMax("mxrp"));
00296 registerPrototype("MinArgMin", new MinArgMin("mnrp"));
00297 registerPrototype("Spectrum", new Spectrum("spkp"));
00298 registerPrototype("InvSpectrum", new InvSpectrum("ispkp"));
00299 registerPrototype("Negative", new Negative("negp"));
00300 registerPrototype("PvConvert", new PvConvert("pvconvp"));
00301 registerPrototype("PvUnconvert", new PvUnconvert("pvuconvp"));
00302 registerPrototype("PvFold", new PvFold("pvfp"));
00303 registerPrototype("PvOverlapadd", new PvOverlapadd("pvovlfp"));
00304 registerPrototype("PvOscBank", new PvOscBank("pvoscp"));
00305 registerPrototype("PeakRatio", new PeakRatio("perap"));
00306 registerPrototype("PeakSynthOscBank", new PeakSynthOscBank("pvoscp"));
00307 registerPrototype("PeakSynthFFT", new PeakSynthFFT("pvfft"));
00308 registerPrototype("ShiftInput", new ShiftInput("sip"));
00309 registerPrototype("ShiftOutput", new ShiftOutput("sop"));
00310 registerPrototype("Shifter", new Shifter("sp"));
00311 registerPrototype("PvConvolve", new PvConvolve("pvconvpr"));
00312 registerPrototype("PeakConvert", new PeakConvert("peconvp"));
00313 registerPrototype("PeakConvert2", new PeakConvert2("peconvp2"));
00314 registerPrototype("OverlapAdd", new OverlapAdd("oa"));
00315 registerPrototype("PeakSynthOsc", new PeakSynthOsc("pso"));
00316 registerPrototype("PeakResidual", new PeakResidual("peres"));
00317 registerPrototype("RealvecSource", new RealvecSource("realvecSrc"));
00318 registerPrototype("RealvecSink", new RealvecSink("realvecSink"));
00319 registerPrototype("Power", new Power("pow"));
00320 registerPrototype("Cartesian2Polar", new Cartesian2Polar("c2p"));
00321 registerPrototype("Polar2Cartesian", new Polar2Cartesian("p2c"));
00322 registerPrototype("FlowCutSource", new FlowCutSource("fcs"));
00323 registerPrototype("AuFileSource", new AuFileSource("aufp"));
00324 registerPrototype("WavFileSource", new WavFileSource("wavfp"));
00325 registerPrototype("WavFileSource2", new WavFileSource2("wavf2p"));
00326 registerPrototype("SoundFileSink", new SoundFileSink("sfsp"));
00327 registerPrototype("MP3FileSink", new MP3FileSink("sfsp"));
00328 registerPrototype("AudioSink", new AudioSink("audiosinkp"));
00329 registerPrototype("AuFileSink", new AuFileSink("ausinkp"));
00330 registerPrototype("WavFileSink", new WavFileSink("wavsinkp"));
00331 registerPrototype("Mono2Stereo", new Mono2Stereo("mono2stereop"));
00332 registerPrototype("Windowing", new Windowing("win"));
00333 registerPrototype("PowerSpectrum", new PowerSpectrum("pspkp"));
00334 registerPrototype("Centroid", new Centroid("cntrp"));
00335 registerPrototype("Rolloff", new Rolloff("rlfp"));
00336 registerPrototype("Flux", new Flux("fluxp"));
00337 registerPrototype("ZeroCrossings", new ZeroCrossings("zcrsp"));
00338 registerPrototype("Memory", new Memory("memp"));
00339 registerPrototype("Mean", new Mean("meanp"));
00340 registerPrototype("StandardDeviation", new StandardDeviation("stdp"));
00341 registerPrototype("PlotSink", new PlotSink("plotsp"));
00342 registerPrototype("GaussianClassifier", new GaussianClassifier("gaussp"));
00343 registerPrototype("GMMClassifier", new GMMClassifier("gmmsp"));
00344 registerPrototype("Confidence", new Confidence("confp"));
00345 registerPrototype("Rms", new Rms("rms"));
00346 registerPrototype("Peak2Rms", new Peak2Rms("peakrms"));
00347 registerPrototype("WekaSink", new WekaSink("wsink"));
00348 registerPrototype("WekaSource", new WekaSource("wsource"));
00349 registerPrototype("MFCC", new MFCC("mfcc"));
00350 registerPrototype("SCF", new SCF("scf"));
00351 registerPrototype("SFM", new SFM("sfm"));
00352 registerPrototype("Accumulator", new Accumulator("acc"));
00353 registerPrototype("Shredder", new Shredder("shred"));
00354 registerPrototype("WaveletPyramid", new WaveletPyramid("wvpyramid"));
00355 registerPrototype("WaveletBands", new WaveletBands("wvbands"));
00356 registerPrototype("FullWaveRectifier", new FullWaveRectifier("fwr"));
00357 registerPrototype("OnePole", new OnePole("lpf"));
00358 registerPrototype("Norm", new Norm("norm"));
00359 registerPrototype("Sum", new Sum("sum"));
00360 registerPrototype("Product", new Product("product"));
00361 registerPrototype("Reciprocal", new Reciprocal("reciprocal"));
00362 registerPrototype("AccentFilterBank", new AccentFilterBank("afb"));
00363 registerPrototype("ConstQFiltering", new ConstQFiltering("cqfpr"));
00364 registerPrototype("Compressor", new Compressor("compressor"));
00365 registerPrototype("Differentiator", new Differentiator("differentiator"));
00366 registerPrototype("Delta", new Delta("deltapr"));
00367 registerPrototype("Square", new Square("square"));
00368 registerPrototype("Subtract", new Subtract("subtract"));
00369 registerPrototype("Median", new Median("median"));
00370 registerPrototype("MedianFilter", new MedianFilter("medianfilterpr"));
00371 registerPrototype("AMDF", new AMDF("amdfpr"));
00372 registerPrototype("AubioYin", new AubioYin("aubioyin"));
00373 registerPrototype("Yin", new Yin("yin"));
00374 registerPrototype("DownSampler", new DownSampler("ds"));
00375 registerPrototype("PeakPeriods2BPM", new PeakPeriods2BPM("p2bpm"));
00376 registerPrototype("BeatHistogramFromPeaks", new BeatHistogramFromPeaks("beathistofrompeakspr"));
00377 registerPrototype("BeatPhase", new BeatPhase("beatphase"));
00378 registerPrototype("BeatHistogram", new BeatHistogram("beathistopr"));
00379 registerPrototype("BeatHistoFeatures", new BeatHistoFeatures("bhfp"));
00380 registerPrototype("SineSource", new SineSource("sinesp"));
00381 registerPrototype("NoiseSource", new NoiseSource("noisesrcsp"));
00382 registerPrototype("FM", new FM("fmp"));
00383 registerPrototype("Annotator", new Annotator("anonp"));
00384 registerPrototype("ZeroRClassifier", new ZeroRClassifier("zerorp"));
00385 registerPrototype("KNNClassifier", new KNNClassifier("knnp"));
00386 registerPrototype("SMO", new SMO("smopr"));
00387 registerPrototype("Plucked", new Plucked("pluckedpr"));
00388 registerPrototype("Delay", new Delay("delaypr"));
00389 registerPrototype("DelaySamples", new DelaySamples("delay"));
00390 registerPrototype("Kurtosis", new Kurtosis("kurtosisp"));
00391 registerPrototype("Skewness", new Skewness("Skewnessp"));
00392 registerPrototype("ViconFileSource", new ViconFileSource("viconfilesourcep"));
00393 registerPrototype("ClassOutputSink", new ClassOutputSink("classoutputsinkp"));
00394 registerPrototype("Filter", new Filter("filterp"));
00395 registerPrototype("Biquad", new Biquad("biquadp"));
00396 registerPrototype("RadioDrumInput", new RadioDrumInput("radiodrump"));
00397 registerPrototype("NoiseGate", new NoiseGate("noisegatep"));
00398 registerPrototype("ERB", new ERB("erbp"));
00399 registerPrototype("LyonPassiveEar", new LyonPassiveEar("lyonp"));
00400 registerPrototype("Clip", new Clip("clpr"));
00401 registerPrototype("HarmonicEnhancer", new HarmonicEnhancer("hepr"));
00402 registerPrototype("Reassign", new Reassign("reassignpr"));
00403 registerPrototype("SilenceRemove", new SilenceRemove("silenceremovepr"));
00404 registerPrototype("NormMaxMin", new NormMaxMin("normmaxminpr"));
00405 registerPrototype("Normalize", new Normalize("normalizepr"));
00406 registerPrototype("LPC", new LPC("lpcwarppr"));
00407 registerPrototype("LPCC", new LPCC("lpccpr"));
00408 registerPrototype("LSP", new LSP("lsppr"));
00409 registerPrototype("SOM", new SOM("sompr"));
00410 registerPrototype("MidiInput", new MidiInput("midiinpr"));
00411 registerPrototype("MidiOutput", new MidiOutput("midioutpr"));
00412 registerPrototype("BICchangeDetector", new BICchangeDetector("bicchgdetpr"));
00413 registerPrototype("SpectralSNR", new SpectralSNR("ssnrpr"));
00414 registerPrototype("StereoSpectrum", new StereoSpectrum("stereopr"));
00415 registerPrototype("StereoSpectrumFeatures", new StereoSpectrumFeatures("stereospkfpr"));
00416 registerPrototype("Vibrato", new Vibrato("vibratopr"));
00417 registerPrototype("Panorama", new Panorama("panoramapr"));
00418 registerPrototype("FlowThru", new FlowThru("flowthrupr"));
00419 registerPrototype("FanOutIn", new FanOutIn("fanoutinpr"));
00420 registerPrototype("CompExp", new CompExp("compexppr"));
00421 registerPrototype("MarSystemTemplateMedium", new MarSystemTemplateMedium("marsystemtemplatemediumpr"));
00422 registerPrototype("PeakFeatureSelect", new PeakFeatureSelect("pefeatselectpr"));
00423 registerPrototype("SimilarityMatrix", new SimilarityMatrix("similaritymatrixpr"));
00424 registerPrototype("SelfSimilarityMatrix", new SelfSimilarityMatrix("selfsimilaritymatrixpr"));
00425 registerPrototype("Metric", new Metric("metricpr"));
00426 registerPrototype("HWPS", new HWPS("hwpspr"));
00427 registerPrototype("RBF", new RBF("rbfpr"));
00428 registerPrototype("NormMatrix", new NormMatrix("normmatrixpr"));
00429 registerPrototype("WHaSp", new WHaSp("whasppr"));
00430 registerPrototype("PeakLabeler", new PeakLabeler("pelabelerpr"));
00431 registerPrototype("PeakClusterSelect", new PeakClusterSelect("peclusterselectpr"));
00432 registerPrototype("PeakViewSink", new PeakViewSink("peakviewsinkpr"));
00433 registerPrototype("NormCut", new NormCut("normcutpr"));
00434 registerPrototype("PeakViewSource", new PeakViewSource("peakviewsourcepr"));
00435 registerPrototype("OneRClassifier", new OneRClassifier("onerclassifierpr"));
00436 registerPrototype("ClassificationReport", new ClassificationReport("classificationreportpr"));
00437 registerPrototype("PhiSEMSource", new PhiSEMSource("phisemsourcepr"));
00438 registerPrototype("PhiSEMFilter", new PhiSEMFilter("phisemfilterpr"));
00439 registerPrototype("SVMClassifier", new SVMClassifier("svmclassifierpr"));
00440 registerPrototype("Chroma", new Chroma("chromapr"));
00441 registerPrototype("Spectrum2Chroma", new Spectrum2Chroma("spectrum2chromapr"));
00442
00443 registerPrototype("Spectrum2Mel", new Spectrum2Mel("spectrum2melpr"));
00444 registerPrototype("ADRess", new ADRess("adresspr"));
00445 registerPrototype("ADRessSpectrum", new ADRessSpectrum("adressspectrumpr"));
00446 registerPrototype("ADRessStereoSpectrum", new ADRessStereoSpectrum("adressstereospectrumpr"));
00447 registerPrototype("EnhADRess", new EnhADRess("Enhadresspr"));
00448 registerPrototype("StereoSpectrumSources", new StereoSpectrumSources("stereospectrumsourcespr"));
00449 registerPrototype("EnhADRessStereoSpectrum", new EnhADRessStereoSpectrum("enhadressstereospectrumpr"));
00450 registerPrototype("PeakerOnset", new PeakerOnset("pkronsetpr"));
00451 registerPrototype("ADSR", new ADSR("adsrpr"));
00452 registerPrototype("Reverse", new Reverse("reversepr"));
00453 registerPrototype("DeInterleaveSizecontrol", new DeInterleaveSizecontrol("deintszctrlpr"));
00454 registerPrototype("DTW", new DTW("dtwpr"));
00455 registerPrototype("Deinterleave", new Deinterleave("deintpr"));
00456 registerPrototype("SNR", new SNR("snrpr"));
00457 registerPrototype("PCA", new PCA("pcapr"));
00458 registerPrototype("AbsMax", new AbsMax("absmaxpr"));
00459 registerPrototype("MaxMin", new MaxMin("maxminpr"));
00460 registerPrototype("TimelineLabeler", new TimelineLabeler("timelinelabelerpr"));
00461 registerPrototype("StretchLinear", new StretchLinear("stretchlinearpr"));
00462 registerPrototype("ResampleBezier", new ResampleBezier("resampberpr"));
00463 registerPrototype("ResampleLinear", new ResampleLinear("resamplinpr"));
00464 registerPrototype("Resample", new Resample("resampabspr"));
00465 registerPrototype("ResampleSinc", new ResampleSinc("resampsincpr"));
00466 registerPrototype("ResampleNearestNeighbour", new ResampleNearestNeighbour("resampnnpr"));
00467 registerPrototype("MidiFileSynthSource", new MidiFileSynthSource("midifilesynthsourcepr"));
00468 registerPrototype("PvMultiResolution", new PvMultiResolution("PvMultiResolution"));
00469 registerPrototype("AudioSinkBlocking", new AudioSinkBlocking("AudioSinkBlocking"));
00470
00471
00472 registerPrototype("Gain", new Gain("gp"));
00473 registerPrototype("Selector", new Selector("selectorpr"));
00474 registerPrototype("SpectralTransformations", new SpectralTransformations("spectraltransformationspr"));
00475 registerPrototype("RunningStatistics", new RunningStatistics("runningstatisticspr"));
00476 registerPrototype("SliceDelta", new SliceDelta("slicedeltapr"));
00477 registerPrototype("DeltaFirstOrderRegression", new DeltaFirstOrderRegression("delta"));
00478 registerPrototype("ArffFileSink", new ArffFileSink("arfffilesinkpr"));
00479 registerPrototype("MixToMono", new MixToMono("mixtomono"));
00480 registerPrototype("SoundFileSourceHopper", new SoundFileSourceHopper("soundfilesourcehopper"));
00481 registerPrototype("TempoHypotheses", new TempoHypotheses("tempohyp"));
00482 registerPrototype("OnsetTimes", new OnsetTimes("OnsetTimes"));
00483 registerPrototype("BeatAgent", new BeatAgent("beatagent"));
00484 registerPrototype("BeatReferee", new BeatReferee("beatreferee"));
00485
00486 registerPrototype("AutoCorrelationFFT", new AutoCorrelationFFT("autocorfftpr"));
00487 registerPrototype("PeakEnhancer", new PeakEnhancer("peakenhpr"));
00488 registerPrototype("PhaseLock", new PhaseLock("phaselock"));
00489 registerPrototype("BeatTimesSink", new BeatTimesSink("beattimessink"));
00490 registerPrototype("CrossCorrelation",new CrossCorrelation("crossCorrelationpr"));
00491 registerPrototype("SliceShuffle", new SliceShuffle("sliceshuffle"));
00492 registerPrototype("RunningAutocorrelation", new RunningAutocorrelation("runningautocorrelation"));
00493 registerPrototype("SubtractMean", new SubtractMean("subtractmean"));
00494
00495 registerPrototype("Transposer", new Transposer("transposer"));
00496 registerPrototype("SimulMaskingFft", new SimulMaskingFft("simulmask"));
00497 registerPrototype("TimeFreqPeakConnectivity", new TimeFreqPeakConnectivity("tfpeakconn"));
00498 registerPrototype("Combinator", new Combinator("combinator"));
00499 registerPrototype("ParallelMatrixWeight", new ParallelMatrixWeight("parallelmatrixweight"));
00500 registerPrototype("PeakDistanceHorizontality", new PeakDistanceHorizontality("horizontality"));
00501 registerPrototype("PeakViewMerge", new PeakViewMerge("PeakViewMerge"));
00502 registerPrototype("FMeasure", new FMeasure("F-Measure"));
00503 registerPrototype("OrcaSnip", new OrcaSnip("GetSnipBounds"));
00504
00505
00506 registerPrototype("AimPZFC", new AimPZFC("aimpzfc"));
00507 registerPrototype("AimPZFC2", new AimPZFC2("aimpzfc2"));
00508
00509 registerPrototype("AimGammatone", new AimGammatone("aimgammatone"));
00510 registerPrototype("AimHCL", new AimHCL("aimhcl"));
00511 registerPrototype("AimHCL2", new AimHCL2("aimhcl2"));
00512 registerPrototype("AimLocalMax", new AimLocalMax("aimlocalmax"));
00513 registerPrototype("AimSAI", new AimSAI("aimsai"));
00514 registerPrototype("AimSSI", new AimSSI("aimssi"));
00515 registerPrototype("AimBoxes", new AimBoxes("aimboxes"));
00516 registerPrototype("AimVQ", new AimVQ("aimvq"));
00517 registerPrototype("Unfold", new Unfold("unfold"));
00518
00519 registerPrototype("Inject", new Inject("injectpr"));
00520 registerPrototype("PowerToAverageRatio", new PowerToAverageRatio("crestpr"));
00521 registerPrototype("MeanAbsoluteDeviation", new MeanAbsoluteDeviation("meanabsolutedeviationpr"));
00522 registerPrototype("NormalizeAbs", new NormalizeAbs("normalizeabspr"));
00523 registerPrototype("RemoveObservations", new RemoveObservations("removeobservationspr"));
00524 registerPrototype("SpectralFlatnessAllBands", new SpectralFlatnessAllBands("spectralflatnessallbandspr"));
00525 registerPrototype("MathPower", new MathPower("mathpowerpr"));
00526 registerPrototype("PitchDiff", new PitchDiff("pitchdiffpr"));
00527 registerPrototype("CARFAC", new CARFAC("carfac"));
00528
00529 registerPrototype("HarmonicStrength", new HarmonicStrength("harmonicstrengthpr"));
00530 registerPrototype("CsvFileSource", new CsvFileSource("csvfilesourcepr"));
00531 registerPrototype("Krumhansl_key_finder", new Krumhansl_key_finder("krumhansl_key_finderpr"));
00532 registerPrototype("PWMSource", new PWMSource("pwmsourcepr"));
00533 registerPrototype("DCSource", new DCSource("dcsourcepr"));
00534 registerPrototype("AudioSource", new AudioSource("audiosourcepr"));
00535 registerPrototype("AudioSourceBlocking", new AudioSourceBlocking("audiosourceblockingpr"));
00536
00537
00538
00539
00540
00541
00542 compositesMap_["DeviBot" ] = DEVIBOT;
00543 compositesMap_["Stereo2Mono" ] = STEREO2MONO;
00544 compositesMap_["TextureStats" ] = TEXTURESTATS;
00545 compositesMap_["LPCnet" ] = LPCNET;
00546 compositesMap_["PowerSpectrumNet" ] = POWERSPECTRUMNET;
00547 compositesMap_["PowerSpectrumNet1" ] = POWERSPECTRUMNET1;
00548 compositesMap_["STFT_features" ] = STFT_FEATURES;
00549 compositesMap_["TimbreFeatures" ] = TIMBREFEATURES;
00550 compositesMap_["StereoPanningSpectrumFeatures"] = STEREOPANNINGSPECTRUMFEATURES;
00551 compositesMap_["StereoFeatures" ] = STEREOFEATURES;
00552 compositesMap_["PhaseVocoder" ] = PHASEVOCODER;
00553 compositesMap_["PhaseVocoderOscBank" ] = PHASEVOCODEROSCBANK;
00554 compositesMap_["PitchSACF" ] = PITCHSACF;
00555 compositesMap_["PitchPraat" ] = PITCHPRAAT;
00556 compositesMap_["PeakAnalyse" ] = PEAKANALYSE;
00557 compositesMap_["WHaSpnet" ] = WHASPNET;
00558 compositesMap_["StereoFeatures2" ] = STEREOFEATURES2;
00559 compositesMap_["Classifier" ] = CLASSIFIER;
00560 compositesMap_["Pipe_Block" ] = PIPE_BLOCK;
00561 compositesMap_["AFB_Block_A" ] = AFB_BLOCK_A;
00562 compositesMap_["AFB_Block_B" ] = AFB_BLOCK_B;
00563 compositesMap_["AFB_Block_C" ] = AFB_BLOCK_C;
00564 compositesMap_["Decimating_QMF" ] = DECIMATING_QMF;
00565 compositesMap_["MultiPitch" ] = MULTIPITCH;
00566 }
00567
00568 void MarSystemManager::registerComposite(std::string prototype)
00569 {
00570 if (compositesMap_.find(prototype) == compositesMap_.end())
00571 return;
00572
00573
00574 switch (compositesMap_[prototype])
00575 {
00576 case STUB:
00577 break;
00578
00579
00580 case MULTIPITCH:
00581 {
00582
00583 MarSystem* lpf1;
00584 MarSystem* lpf2;
00585 MarSystem* hpf1;
00586 MarSystem* hwr;
00587 MarSystem* hwr2;
00588 MarSystem* hwr3;
00589 MarSystem* autocorhi;
00590 MarSystem* autocorlo;
00591 MarSystem* sum;
00592 MarSystem* pe2;
00593 MarSystem* pe3;
00594 MarSystem* pe4;
00595
00596 MarSystem* fan;
00597 MarSystem* hinet;
00598 MarSystem* lonet;
00599
00600 MarSystem* multipitpr;
00601
00602 realvec numlow, denomlow;
00603 realvec numhigh, denomhigh;
00604
00605 numlow.create(3);
00606 denomlow.create(3);
00607 numhigh.create(3);
00608 denomhigh.create(3);
00609
00610
00611 numlow(0)=0.1207f; numlow(1)=0.2415f; numlow(2)=0.1207f;
00612 denomlow(0)=1.0f; denomlow(1)=-0.8058f; denomlow(2)=0.2888f;
00613
00614 numhigh(0)=0.5236f; numhigh(1)=-1.0473f; numhigh(2)=0.5236f;
00615 denomhigh(0)=1.0f; denomhigh(1)=-0.8058f; denomhigh(2)=0.2888f;
00616
00617 lpf1 = new Filter("lpf1");
00618 lpf1->updControl("mrs_realvec/ncoeffs", numlow);
00619 lpf1->updControl("mrs_realvec/dcoeffs", denomlow);
00620
00621 lpf2 = new Filter("lpf2");
00622 lpf2->updControl("mrs_realvec/ncoeffs", numlow);
00623 lpf2->updControl("mrs_realvec/dcoeffs", denomlow);
00624
00625 hpf1 = new Filter("hpf1");
00626 hpf1->updControl("mrs_realvec/ncoeffs", numhigh);
00627 hpf1->updControl("mrs_realvec/dcoeffs", denomhigh);
00628
00629 hwr = new HalfWaveRectifier("hwr");
00630 hwr2 = new HalfWaveRectifier("hwr2");
00631 hwr3 = new HalfWaveRectifier("hwr3");
00632 autocorhi = new AutoCorrelationFFT("autocorhi");
00633 autocorlo = new AutoCorrelationFFT("autocorlo");
00634
00635 pe2 = new PeakEnhancer("pe2");
00636 pe3 = new PeakEnhancer("pe3");
00637 pe4 = new PeakEnhancer("pe4");
00638
00639 multipitpr = new Series("multipitpr");
00640 fan = new Fanout("fan");
00641 hinet = new Series("hinet");
00642 lonet = new Series("lonet");
00643 sum = new Sum("sum");
00644
00645 lonet->addMarSystem(lpf1);
00646 lonet->addMarSystem(hwr);
00647 lonet->addMarSystem(autocorlo);
00648 hinet->addMarSystem(hpf1);
00649 hinet->addMarSystem(hwr2);
00650 hinet->addMarSystem(lpf2);
00651 hinet->addMarSystem(autocorhi);
00652
00653 fan->addMarSystem(hinet);
00654 fan->addMarSystem(lonet);
00655
00656 multipitpr->addMarSystem(fan);
00657 multipitpr->addMarSystem(sum);
00658 multipitpr->addMarSystem(pe2);
00659 multipitpr->addMarSystem(pe3);
00660 multipitpr->addMarSystem(pe4);
00661 multipitpr->addMarSystem(hwr3);
00662 registerPrototype("MultiPitch", multipitpr);
00663 }
00664 break;
00665
00666 case DEVIBOT:
00667 {
00668
00669
00670
00671 MarSystem* devibotpr = new MidiOutput("devibotpr");
00672 devibotpr->linkControl("mrs_natural/byte2", "mrs_natural/arm");
00673 devibotpr->linkControl("mrs_natural/byte3", "mrs_natural/velocity");
00674 devibotpr->linkControl("mrs_bool/sendMessage", "mrs_bool/strike");
00675 devibotpr->updControl("mrs_natural/byte1", 144);
00676 registerPrototype("DeviBot", devibotpr);
00677 }
00678 break;
00679
00680 case STEREO2MONO:
00681 {
00682
00683
00684
00685 MarSystem* stereo2monopr = new Sum("stereo2monopr");
00686 stereo2monopr->updControl("mrs_real/weight", 0.5);
00687 registerPrototype("Stereo2Mono", stereo2monopr);
00688 }
00689 break;
00690
00691 case TEXTURESTATS:
00692 {
00693
00694
00695
00696 MarSystem* textureStatspr = new Series("tstatspr");
00697 textureStatspr->addMarSystem(new Memory("mempr"));
00698
00699 MarSystem* meanstdpr = new Fanout("meanstdpr");
00700 meanstdpr->addMarSystem(new Mean("meanpr"));
00701 meanstdpr->addMarSystem(new StandardDeviation("stdpr"));
00702 textureStatspr->addMarSystem(meanstdpr);
00703
00704 textureStatspr->linkControl("Memory/mempr/mrs_natural/memSize", "mrs_natural/memSize");
00705 textureStatspr->linkControl("Memory/mempr/mrs_bool/reset", "mrs_bool/reset");
00706 registerPrototype("TextureStats", textureStatspr);
00707 }
00708 break;
00709
00710 case POWERSPECTRUMNET:
00711 {
00712
00713
00714
00715 MarSystem* pspectpr = create("Series", "pspectpr");
00716 pspectpr->addMarSystem(create("ShiftInput", "si"));
00717 pspectpr->addMarSystem(create("Windowing", "hamming"));
00718 pspectpr->addMarSystem(create("Spectrum","spk"));
00719 pspectpr->updControl("Spectrum/spk/mrs_real/cutoff", 1.0);
00720 pspectpr->addMarSystem(create("PowerSpectrum", "pspk"));
00721 pspectpr->updControl("PowerSpectrum/pspk/mrs_string/spectrumType","power");
00722 pspectpr->linkControl("Spectrum/spk/mrs_real/cutoff", "mrs_real/cutoff");
00723 pspectpr->linkControl("ShiftInput/si/mrs_natural/winSize", "mrs_natural/winSize");
00724 registerPrototype("PowerSpectrumNet", pspectpr);
00725 }
00726 break;
00727
00728 case POWERSPECTRUMNET1:
00729 {
00730 MarSystem* pspectpr1 = create("Series", "pspectpr1");
00731 pspectpr1->addMarSystem(create("Spectrum","spk"));
00732 pspectpr1->updControl("Spectrum/spk/mrs_real/cutoff", 1.0);
00733 pspectpr1->addMarSystem(create("PowerSpectrum", "pspk"));
00734 pspectpr1->updControl("PowerSpectrum/pspk/mrs_string/spectrumType","power");
00735 pspectpr1->linkControl("Spectrum/spk/mrs_real/cutoff", "mrs_real/cutoff");
00736 registerPrototype("PowerSpectrumNet1", pspectpr1);
00737 }
00738 break;
00739
00740 case STFT_FEATURES:
00741 {
00742
00743 MarSystem* stft_features_pr = create("Fanout", "stft_features_pr");
00744 stft_features_pr->addMarSystem(create("Centroid", "cntrd"));
00745 stft_features_pr->addMarSystem(create("Rolloff", "rlf"));
00746 stft_features_pr->addMarSystem(create("Flux", "flux"));
00747 stft_features_pr->addMarSystem(create("MFCC", "mfcc"));
00748
00749 MarSystem* chromaPrSeries = create("Series", "chromaPrSeries");
00750
00751 chromaPrSeries->addMarSystem(create("Spectrum2Chroma", "chroma"));
00752 chromaPrSeries->addMarSystem(create("PeakRatio","pr"));
00753
00754 stft_features_pr->addMarSystem(chromaPrSeries);
00755 stft_features_pr->addMarSystem(create("SCF", "scf"));
00756 stft_features_pr->addMarSystem(create("SFM", "sfm"));
00757 registerPrototype("STFT_features", stft_features_pr);
00758 }
00759 break;
00760
00761
00762 case LPCNET:
00763 case TIMBREFEATURES:
00764 {
00765
00766
00767
00768 MarSystem* LPCnetpr = new Series("lpcnetpr");
00769
00770
00771 LPCnetpr->addMarSystem(create("Filter", "preEmph"));
00772 realvec ncoeffs(2);
00773 realvec dcoeffs(1);
00774 ncoeffs(0) = 1.0;
00775 ncoeffs(1) = -0.97;
00776 dcoeffs(0) = 1.0;
00777 LPCnetpr->updControl("Filter/preEmph/mrs_realvec/ncoeffs", ncoeffs);
00778 LPCnetpr->updControl("Filter/preEmph/mrs_realvec/dcoeffs", dcoeffs);
00779 LPCnetpr->addMarSystem(create("ShiftInput", "si"));
00780 LPCnetpr->addMarSystem(create("Windowing", "ham"));
00781 LPCnetpr->addMarSystem(create("LPC", "lpc"));
00782 LPCnetpr->linkControl("Filter/preEmph/mrs_realvec/ncoeffs", "mrs_realvec/preEmphFIR");
00783 LPCnetpr->linkControl("ShiftInput/si/mrs_natural/winSize","mrs_natural/winSize");
00784 LPCnetpr->linkControl("LPC/lpc/mrs_natural/order", "mrs_natural/order");
00785 LPCnetpr->linkControl("LPC/lpc/mrs_real/lambda", "mrs_real/lambda");
00786 LPCnetpr->linkControl("LPC/lpc/mrs_real/gamma", "mrs_real/gamma");
00787 registerPrototype("LPCnet", LPCnetpr);
00788
00790
00792 MarSystem* timbre_features_pr = new Fanout("timbre_features_pr");
00793
00794 MarSystem* timeDomainFeatures = create("Series", "timeDomain");
00795 timeDomainFeatures->addMarSystem(create("ShiftInput", "si"));
00796 MarSystem* tdf = create("Fanout", "tdf");
00797 tdf->addMarSystem(create("ZeroCrossings", "zcrs"));
00798 timeDomainFeatures->addMarSystem(tdf);
00799 timbre_features_pr->addMarSystem(timeDomainFeatures);
00800
00801 MarSystem* spectralShape = create("Series", "spectralShape");
00802 spectralShape->addMarSystem(create("ShiftInput", "si"));
00803 spectralShape->addMarSystem(create("Windowing", "hamming"));
00804 spectralShape->addMarSystem(create("PowerSpectrumNet1", "powerSpect1"));
00805 MarSystem* spectrumFeatures = create("STFT_features", "spectrumFeatures");
00806 spectralShape->addMarSystem(spectrumFeatures);
00807 timbre_features_pr->addMarSystem(spectralShape);
00808
00809 MarSystem* lpcFeatures = create("Series", "lpcFeatures");
00810 lpcFeatures->addMarSystem(create("Filter", "preEmph"));
00811 lpcFeatures->updControl("Filter/preEmph/mrs_realvec/ncoeffs", ncoeffs);
00812 lpcFeatures->updControl("Filter/preEmph/mrs_realvec/dcoeffs", dcoeffs);
00813 lpcFeatures->addMarSystem(create("ShiftInput", "si"));
00814 lpcFeatures->addMarSystem(create("Windowing", "ham"));
00815 MarSystem* lpcf = create("Fanout", "lpcf");
00816 MarSystem* lspbranch = create("Series", "lspbranch");
00817 MarSystem* lpccbranch = create("Series","lpccbranch");
00818 lspbranch->addMarSystem(create("LPC", "lpc"));
00819 lspbranch->updControl("LPC/lpc/mrs_natural/order", 18);
00820 lspbranch->addMarSystem(create("LSP", "lsp"));
00821 lpccbranch->addMarSystem(create("LPC", "lpc"));
00822 lpccbranch->updControl("LPC/lpc/mrs_natural/order", 12);
00823 lpccbranch->addMarSystem(create("LPCC", "lpcc"));
00824 lpcf->addMarSystem(lspbranch);
00825 lpcf->addMarSystem(lpccbranch);
00826 lpcFeatures->addMarSystem(lpcf);
00827 timbre_features_pr->addMarSystem(lpcFeatures);
00828
00829 timbre_features_pr->linkControl("Series/timeDomain/ShiftInput/si/mrs_natural/winSize", "mrs_natural/winSize");
00830 timbre_features_pr->linkControl("Series/spectralShape/ShiftInput/si/mrs_natural/winSize", "mrs_natural/winSize");
00831 timbre_features_pr->linkControl("Series/lpcFeatures/ShiftInput/si/mrs_natural/winSize", "mrs_natural/winSize");
00832
00833 timbre_features_pr->linkControl("Series/spectralShape/STFT_features/spectrumFeatures/mrs_string/enableChild", "mrs_string/enableSPChild");
00834 timbre_features_pr->linkControl("Series/spectralShape/STFT_features/spectrumFeatures/mrs_string/disableChild","mrs_string/disableSPChild");
00835
00836 timbre_features_pr->linkControl("Series/timeDomain/Fanout/tdf/mrs_string/enableChild", "mrs_string/enableTDChild");
00837 timbre_features_pr->linkControl("Series/timeDomain/Fanout/tdf/mrs_string/disableChild", "mrs_string/disableTDChild");
00838
00839 timbre_features_pr->linkControl("Series/lpcFeatures/Fanout/lpcf/mrs_string/enableChild", "mrs_string/enableLPCChild");
00840 timbre_features_pr->linkControl("Series/lpcFeatures/Fanout/lpcf/mrs_string/disableChild", "mrs_string/disableLPCChild");
00841
00842 timbre_features_pr->updControl("mrs_string/disableSPChild", "all");
00843 timbre_features_pr->updControl("mrs_string/disableTDChild", "all");
00844 timbre_features_pr->updControl("mrs_string/disableLPCChild", "all");
00845
00846 registerPrototype("TimbreFeatures", timbre_features_pr);
00847 }
00848 break;
00849
00850 case STEREOPANNINGSPECTRUMFEATURES:
00851 {
00853
00855 MarSystem *stereoFeatNet = create("Series", "stereoFeatNet");
00856 MarSystem* stereobranches = create("Parallel", "stereobranches");
00857 MarSystem* left = create("Series", "left");
00858 MarSystem* right = create("Series", "right");
00859 left->addMarSystem(create("ShiftInput", "sileft"));
00860 left->addMarSystem(create("Windowing", "hamleft"));
00861 left->addMarSystem(create("Spectrum", "spkleft"));
00862 right->addMarSystem(create("ShiftInput", "siright"));
00863 right->addMarSystem(create("Windowing", "hamright"));
00864 right->addMarSystem(create("Spectrum", "spkright"));
00865
00866 stereobranches->addMarSystem(left);
00867 stereobranches->addMarSystem(right);
00868
00869 stereoFeatNet->addMarSystem(stereobranches);
00870 stereoFeatNet->addMarSystem(create("StereoSpectrum", "sspk"));
00871 stereoFeatNet->addMarSystem(create("StereoSpectrumFeatures", "sspkf"));
00872 registerPrototype("StereoPanningSpectrumFeatures", stereoFeatNet);
00873 }
00874 break;
00875
00876 case STEREOFEATURES:
00877 {
00878
00880
00882 MarSystem* stereoFeatures = create("Fanout", "stereoFeatures");
00883 MarSystem* stereoTimbreFeatures = create("Parallel", "stereoTimbreFeatures");
00884 MarSystem* featExtractorLeft = create("TimbreFeatures", "featExtractorLeft");
00885 MarSystem* featExtractorRight = create("TimbreFeatures", "featExtractorRight");
00886 stereoTimbreFeatures->addMarSystem(featExtractorLeft);
00887 stereoTimbreFeatures->addMarSystem(featExtractorRight);
00888 stereoFeatures->addMarSystem(stereoTimbreFeatures);
00889 stereoFeatures->addMarSystem(create("StereoPanningSpectrumFeatures", "SPSFeatures"));
00890
00891
00892 stereoFeatures->linkControl("Parallel/stereoTimbreFeatures/TimbreFeatures/featExtractorLeft/mrs_natural/winSize", "mrs_natural/winSize");
00893 stereoFeatures->linkControl("Parallel/stereoTimbreFeatures/TimbreFeatures/featExtractorRight/mrs_natural/winSize", "mrs_natural/winSize");
00894 stereoFeatures->linkControl("StereoPanningSpectrumFeatures/SPSFeatures/Parallel/stereobranches/Series/left/ShiftInput/sileft/mrs_natural/winSize", "mrs_natural/winSize");
00895 stereoFeatures->linkControl("StereoPanningSpectrumFeatures/SPSFeatures/Parallel/stereobranches/Series/right/ShiftInput/siright/mrs_natural/winSize", "mrs_natural/winSize");
00896
00897
00898 stereoFeatures->linkControl("Parallel/stereoTimbreFeatures/TimbreFeatures/featExtractorLeft/mrs_string/enableSPChild", "mrs_string/enableSPChild");
00899 stereoFeatures->linkControl("Parallel/stereoTimbreFeatures/TimbreFeatures/featExtractorRight/mrs_string/enableSPChild", "mrs_string/enableSPChild");
00900
00901 stereoFeatures->linkControl("Parallel/stereoTimbreFeatures/TimbreFeatures/featExtractorLeft/mrs_string/enableTDChild", "mrs_string/enableTDChild");
00902 stereoFeatures->linkControl("Parallel/stereoTimbreFeatures/TimbreFeatures/featExtractorRight/mrs_string/enableTDChild", "mrs_string/enableTDChild");
00903
00904
00905 registerPrototype("StereoFeatures", stereoFeatures);
00906 }
00907 break;
00908
00909 case PHASEVOCODER:
00910 {
00911
00912
00913
00914 MarSystem* pvocpr = new Series("pvocpr");
00915 pvocpr->addMarSystem(new ShiftInput("si"));
00916 pvocpr->addMarSystem(new PvFold("fo"));
00917 pvocpr->addMarSystem(new Spectrum("spk"));
00918 pvocpr->addMarSystem(new PvConvert("conv"));
00919 pvocpr->addMarSystem(new PvUnconvert("uconv"));
00920 pvocpr->addMarSystem(new InvSpectrum("ispectrum"));
00921 pvocpr->addMarSystem(new PvOverlapadd("pover"));
00922 pvocpr->addMarSystem(new ShiftOutput("so"));
00923
00924 pvocpr->linkControl("ShiftInput/si/mrs_natural/winSize",
00925 "mrs_natural/winSize");
00926 pvocpr->linkControl("PvOverlapadd/pover/mrs_natural/winSize",
00927 "mrs_natural/winSize");
00928
00929
00930 pvocpr->linkControl("PvConvert/conv/mrs_natural/Decimation",
00931 "mrs_natural/Decimation");
00932 pvocpr->linkControl("PvUnconvert/uconv/mrs_natural/Decimation",
00933 "mrs_natural/Decimation");
00934 pvocpr->linkControl("PvOverlapadd/pover/mrs_natural/Decimation",
00935 "mrs_natural/Decimation");
00936
00937 pvocpr->linkControl("PvUnconvert/uconv/mrs_natural/Interpolation",
00938 "mrs_natural/Interpolation");
00939 pvocpr->linkControl("PvOverlapadd/pover/mrs_natural/Interpolation",
00940 "mrs_natural/Interpolation");
00941 pvocpr->linkControl("ShiftOutput/so/mrs_natural/Interpolation",
00942 "mrs_natural/Interpolation");
00943
00944 pvocpr->linkControl("PvFold/fo/mrs_natural/FFTSize",
00945 "mrs_natural/FFTSize");
00946 pvocpr->linkControl("PvOverlapadd/pover/mrs_natural/FFTSize",
00947 "mrs_natural/FFTSize");
00948
00949 pvocpr->linkControl("PvConvert/conv/mrs_realvec/phases",
00950 "PvUnconvert/uconv/mrs_realvec/analysisphases");
00951
00952 pvocpr->linkControl("PvUnconvert/uconv/mrs_realvec/regions",
00953 "PvConvert/conv/mrs_realvec/regions");
00954
00955 pvocpr->linkControl("PvConvert/conv/mrs_natural/Sinusoids",
00956 "mrs_natural/Sinusoids");
00957 pvocpr->linkControl("PvConvert/conv/mrs_string/mode",
00958 "mrs_string/convertMode");
00959 pvocpr->linkControl("PvUnconvert/uconv/mrs_string/mode",
00960 "mrs_string/unconvertMode");
00961 pvocpr->linkControl("PvUnconvert/uconv/mrs_bool/phaselock",
00962 "mrs_bool/phaselock");
00963
00964
00965 pvocpr->linkControl("PvFold/fo/mrs_real/rmsIn",
00966 "PvOverlapadd/pover/mrs_real/rmsIn");
00967
00968
00969 registerPrototype("PhaseVocoder", pvocpr);
00970 }
00971 break;
00972
00973 case PHASEVOCODEROSCBANK:
00974 {
00975 MarSystem* pvocpr1 = new Series("pvocpr1");
00976 pvocpr1->addMarSystem(new ShiftInput("si"));
00977 pvocpr1->addMarSystem(new PvFold("fo"));
00978 pvocpr1->addMarSystem(new Spectrum("spk"));
00979 pvocpr1->addMarSystem(new PvConvert("conv"));
00980 pvocpr1->addMarSystem(new PvOscBank("pob"));
00981 pvocpr1->addMarSystem(new ShiftOutput("so"));
00982
00983 pvocpr1->linkControl("ShiftInput/si/mrs_natural/winSize",
00984 "mrs_natural/winSize");
00985
00986 pvocpr1->linkControl("PvOscBank/pob/mrs_natural/winSize",
00987 "mrs_natural/winSize");
00988
00989 pvocpr1->linkControl("PvFold/fo/mrs_real/rmsIn",
00990 "PvOscBank/pob/mrs_real/rmsIn");
00991
00992 pvocpr1->linkControl("PvConvert/conv/mrs_natural/Decimation",
00993 "mrs_natural/Decimation");
00994 pvocpr1->linkControl("ShiftOutput/so/mrs_natural/Interpolation",
00995 "mrs_natural/Interpolation");
00996 pvocpr1->linkControl("PvFold/fo/mrs_natural/FFTSize",
00997 "mrs_natural/FFTSize");
00998 pvocpr1->linkControl("PvConvert/conv/mrs_natural/Sinusoids",
00999 "mrs_natural/Sinusoids");
01000 pvocpr1->linkControl("PvConvert/conv/mrs_string/mode",
01001 "mrs_string/convertMode");
01002 pvocpr1->linkControl("PvOscBank/pob/mrs_natural/Interpolation",
01003 "mrs_natural/Interpolation");
01004 pvocpr1->linkControl("PvOscBank/pob/mrs_real/PitchShift",
01005 "mrs_real/PitchShift");
01006
01007 pvocpr1->linkControl("PvOscBank/pob/mrs_bool/phaselock",
01008 "mrs_bool/phaselock");
01009
01010 pvocpr1->linkControl("PvConvert/conv/mrs_realvec/phases",
01011 "PvOscBank/pob/mrs_realvec/analysisphases");
01012
01013
01014
01015
01016 registerPrototype("PhaseVocoderOscBank", pvocpr1);
01017 }
01018 break;
01019
01020
01021 case PITCHSACF:
01022 case PITCHPRAAT:
01023 {
01024
01025
01026
01027 MarSystem* pitchSACF = new Series("pitchSACF");
01028
01029 pitchSACF->addMarSystem(create("AutoCorrelation", "acr"));
01030 pitchSACF->updControl("AutoCorrelation/acr/mrs_real/magcompress", .67);
01031
01032 pitchSACF->addMarSystem(create("HalfWaveRectifier", "hwr"));
01033 MarSystem* fanout = create("Fanout", "fanout");
01034 fanout->addMarSystem(create("Gain", "id1"));
01035 fanout->addMarSystem(create("TimeStretch", "tsc"));
01036 pitchSACF->addMarSystem(fanout);
01037 MarSystem* fanin = create("Fanin", "fanin");
01038 fanin->addMarSystem(create("Gain", "id2"));
01039 fanin->addMarSystem(create("Negative", "nid"));
01040 pitchSACF->addMarSystem(fanin);
01041 pitchSACF->addMarSystem(create("HalfWaveRectifier", "hwr"));
01042 pitchSACF->addMarSystem(create("Peaker", "pkr"));
01043 pitchSACF->addMarSystem(create("MaxArgMax", "mxr"));
01044
01045 pitchSACF->updControl("mrs_natural/inSamples", 512);
01046 pitchSACF->updControl("Fanout/fanout/TimeStretch/tsc/mrs_real/factor", 0.5);
01047
01048 pitchSACF->updControl("Peaker/pkr/mrs_real/peakSpacing", 0.00);
01049
01050 pitchSACF->updControl("Peaker/pkr/mrs_real/peakStrength", 0.4);
01051 pitchSACF->updControl("MaxArgMax/mxr/mrs_natural/nMaximums", 1);
01052
01053 pitchSACF->linkControl("mrs_natural/lowSamples", "Peaker/pkr/mrs_natural/peakStart");
01054 pitchSACF->linkControl("mrs_natural/highSamples", "Peaker/pkr/mrs_natural/peakEnd");
01055
01056 mrs_real lowPitch = 36;
01057 mrs_real highPitch = 79;
01058 mrs_real lowFreq = pitch2hertz(lowPitch);
01059 mrs_real highFreq = pitch2hertz(highPitch);
01060 mrs_natural lowSamples =
01061 hertz2samples(highFreq, pitchSACF->getctrl("mrs_real/osrate")->to<mrs_real>());
01062 mrs_natural highSamples =
01063 hertz2samples(lowFreq, pitchSACF->getctrl("mrs_real/osrate")->to<mrs_real>());
01064 pitchSACF->updControl("mrs_natural/lowSamples", lowSamples);
01065 pitchSACF->updControl("mrs_natural/highSamples", highSamples);
01066 registerPrototype("PitchSACF", pitchSACF);
01067
01068
01069
01070
01071
01072
01073 MarSystem* pitchPraat = new Series("pitchPraat");
01074 pitchPraat->addMarSystem(create("Windowing", "wi"));
01075 pitchPraat->addMarSystem(create("AutoCorrelation", "acr"));
01076 pitchPraat->updControl("AutoCorrelation/acr/mrs_natural/normalize", 1);
01077 pitchPraat->updControl("AutoCorrelation/acr/mrs_real/octaveCost", 0.0);
01078 pitchPraat->updControl("AutoCorrelation/acr/mrs_real/voicingThreshold", 0.3);
01079 pitchPraat->linkControl("mrs_real/voicingThreshold", "AutoCorrelation/acr/mrs_real/voicingThreshold");
01080 pitchPraat->addMarSystem(create("Peaker", "pkr"));
01081 pitchPraat->addMarSystem(create("MaxArgMax", "mxr"));
01082
01083
01084
01085
01086
01087 pitchPraat->updControl("mrs_natural/inSamples", 1024);
01088 pitchPraat->updControl("Windowing/wi/mrs_string/type", "Hanning");
01089 pitchPraat->updControl("Peaker/pkr/mrs_real/peakSpacing", 0.00);
01090 pitchPraat->updControl("Peaker/pkr/mrs_natural/interpolation", 1);
01091
01092 pitchPraat->updControl("MaxArgMax/mxr/mrs_natural/nMaximums", 1);
01093 pitchPraat->updControl("MaxArgMax/mxr/mrs_natural/interpolation", 1);
01094 pitchPraat->linkControl("mrs_natural/lowSamples", "Peaker/pkr/mrs_natural/peakStart");
01095 pitchPraat->linkControl("mrs_natural/highSamples", "Peaker/pkr/mrs_natural/peakEnd");
01096
01097 lowPitch = 36;
01098 highPitch = 79;
01099 lowFreq = pitch2hertz(lowPitch);
01100 highFreq = pitch2hertz(highPitch);
01101
01102 lowSamples =
01103 hertz2samples(highFreq, pitchPraat->getctrl("mrs_real/osrate")->to<mrs_real>());
01104 highSamples =
01105 hertz2samples(lowFreq, pitchPraat->getctrl("mrs_real/osrate")->to<mrs_real>());
01106 pitchPraat->updControl("mrs_natural/lowSamples", lowSamples);
01107 pitchPraat->updControl("mrs_natural/highSamples", highSamples);
01108 registerPrototype("PitchPraat", pitchPraat);
01109 }
01110 break;
01111
01112 case PIPE_BLOCK:
01113 {
01114 MarSystem* pipeBlock = new Series("Pipe_Block");
01115
01116 pipeBlock->addMarSystem(create("AFB_Block_A", "blockA"));
01117
01118 pipeBlock->addMarSystem(create("AFB_Block_B", "blockB"));
01119 pipeBlock->linkControl("mrs_natural/factor", "AFB_Block_B/blockB/mrs_natural/factor");
01120
01121 pipeBlock->addMarSystem(create("AFB_Block_C", "blockC"));
01122
01123 registerPrototype("Pipe_Block", pipeBlock);
01124 }
01125 break;
01126
01127 case AFB_BLOCK_A:
01128 {
01129 MarSystem* afbBlockA = new Series("AFB_Block_A");
01130
01131 afbBlockA->addMarSystem(create("Decimating_QMF", "qmf1"));
01132
01133 MarSystem* parallel = create("Parallel", "parallel");
01134
01135 parallel->addMarSystem(create("DownSampler", "ds"));
01136 parallel->updControl("DownSampler/ds/mrs_natural/factor", 2);
01137
01138 MarSystem* ser = new Series("ser");
01139
01140 ser->addMarSystem(create("Decimating_QMF", "qmf2"));
01141
01142 ser->addMarSystem(create("Selector", "selector"));
01143
01144 parallel->addMarSystem(ser);
01145
01146 afbBlockA->addMarSystem(parallel);
01147
01148 afbBlockA->updControl("Parallel/parallel/Series/ser/Selector/selector/mrs_natural/enable", 0);
01149 afbBlockA->updControl("Parallel/parallel/Series/ser/Selector/selector/mrs_natural/disable", 1);
01150
01151 afbBlockA->addMarSystem(create("Sum", "sum"));
01152
01153
01154 registerPrototype("AFB_Block_A", afbBlockA);
01155 }
01156 break;
01157
01158 case AFB_BLOCK_B:
01159 {
01160 MarSystem* afbBlockB = new Series("AFB_Block_B");
01161
01162 afbBlockB->addMarSystem(create("Square", "sq"));
01163 afbBlockB->addMarSystem(create("Biquad", "bq"));
01164
01165 afbBlockB->updControl("Biquad/bq/mrs_string/type", "lowpass");
01166 afbBlockB->updControl("Biquad/bq/mrs_real/resonance", 1.0);
01167 afbBlockB->updControl("Biquad/bq/mrs_real/frequency", 10.0);
01168
01169 afbBlockB->addMarSystem(create("DownSampler", "ds"));
01170
01171 afbBlockB->linkControl("mrs_natural/factor", "DownSampler/ds/mrs_natural/factor");
01172
01173 registerPrototype("AFB_Block_B", afbBlockB);
01174 }
01175 break;
01176
01177 case AFB_BLOCK_C:
01178 {
01179 MarSystem* afbBlockC = new Series("AFB_Block_C");
01180
01181 MarSystem* fanout = create("Fanout", "fanout");
01182
01183
01184 MarSystem* ser = create("Series", "ser");
01185
01186 ser->addMarSystem(create("Compressor", "comp"));
01187 ser->addMarSystem(create("Differentiator", "diff"));
01188 ser->addMarSystem(create("HalfWaveRectifier", "rect"));
01189 ser->addMarSystem(create("Gain", "g2"));
01190
01191 fanout->addMarSystem(create("Gain", "g1"));
01192 fanout->addMarSystem(ser);
01193
01194 afbBlockC->addMarSystem(fanout);
01195
01196 afbBlockC->updControl("Fanout/fanout/Series/ser/Gain/g2/mrs_real/gain", 0.8);
01197 afbBlockC->updControl("Fanout/fanout/Gain/g1/mrs_real/gain", 0.2);
01198
01199 afbBlockC->addMarSystem(create("Sum", "sum"));
01200
01201 afbBlockC->updControl("Sum/sum/mrs_real/weight", 1.0);
01202
01203 registerPrototype("AFB_Block_C", afbBlockC);
01204 }
01205 break;
01206
01207 case DECIMATING_QMF:
01208 {
01209 MarSystem* decimating_QMF = new Series("Decimating_QMF");
01210
01211 decimating_QMF->addMarSystem(create("Gain", "g"));
01212
01213 decimating_QMF->updControl("Gain/g/mrs_real/gain", 0.5);
01214
01215 MarSystem* fanout0 = create("Fanout", "fanout0");
01216
01217 MarSystem* ser0 = create("Series", "ser0");
01218 MarSystem* ser1 = create("Series", "ser1");
01219
01220 ser0->addMarSystem(create("DownSampler", "ds0"));
01221 ser0->updControl("DownSampler/ds0/mrs_natural/factor", 2);
01222
01223 ser0->addMarSystem(create("Biquad", "a0"));
01224 ser0->updControl("Biquad/a0/mrs_string/type", "allpass");
01225 ser0->updControl("Biquad/a0/mrs_real/frequency", 3000.0);
01226 ser0->updControl("Biquad/a0/mrs_real/resonance", 1.0);
01227
01228 ser1->addMarSystem(create("Delay", "d"));
01229 ser1->updControl("Delay/d/mrs_natural/delaySamples", 1);
01230 ser1->updControl("Delay/d/mrs_real/feedback", 0.0);
01231 ser1->updControl("Delay/d/mrs_real/gain", 1.0);
01232
01233 ser1->addMarSystem(create("DownSampler", "ds1"));
01234 ser1->updControl("DownSampler/ds1/mrs_natural/factor", 2);
01235
01236 ser1->addMarSystem(create("Biquad", "a1"));
01237 ser1->updControl("Biquad/a1/mrs_string/type", "allpass");
01238 ser1->updControl("Biquad/a1/mrs_real/frequency", 500.0);
01239 ser1->updControl("Biquad/a1/mrs_real/resonance", 1.0);
01240
01241 fanout0->addMarSystem(ser0);
01242 fanout0->addMarSystem(ser1);
01243
01244 decimating_QMF->addMarSystem(fanout0);
01245
01246 MarSystem* fanout1 = create("Fanout", "fanout1");
01247
01248 fanout1->addMarSystem(create("Sum", "sum"));
01249 fanout1->addMarSystem(create("Subtract", "sub"));
01250
01251 decimating_QMF->addMarSystem(fanout1);
01252
01253 registerPrototype("Decimating_QMF", decimating_QMF);
01254 }
01255 break;
01256
01257
01258 case PEAKANALYSE:
01259 {
01260
01261
01262
01263 MarSystem* peAnalysePr = new Series("PeakAnalysePr");
01264 peAnalysePr->addMarSystem(create("ShiftInput", "si"));
01265 peAnalysePr->addMarSystem(create("Shifter", "sh"));
01266 peAnalysePr->addMarSystem(create("Windowing", "wi"));
01267 MarSystem *parallel = create("Parallel", "par");
01268 parallel->addMarSystem(create("Spectrum", "spk1"));
01269 parallel->addMarSystem(create("Spectrum", "spk2"));
01270 peAnalysePr->addMarSystem(parallel);
01271 peAnalysePr->addMarSystem(create("PeakConvert", "conv"));
01272 peAnalysePr->linkControl("mrs_natural/winSize",
01273 "ShiftInput/si/mrs_natural/winSize");
01274 peAnalysePr->linkControl("mrs_natural/FFTSize",
01275 "Windowing/wi/mrs_natural/size");
01276 peAnalysePr->linkControl("mrs_string/WindowType",
01277 "Windowing/wi/mrs_string/type");
01278 peAnalysePr->linkControl("mrs_bool/zeroPhasing",
01279 "Windowing/wi/mrs_bool/zeroPhasing");
01280 peAnalysePr->linkControl("mrs_natural/frameMaxNumPeaks",
01281 "PeakConvert/conv/mrs_natural/frameMaxNumPeaks");
01282
01283
01284 peAnalysePr->updControl("Shifter/sh/mrs_natural/shift", 1);
01285 registerPrototype("PeakAnalyse", peAnalysePr);
01286 }
01287 break;
01288
01289 case WHASPNET:
01290 {
01291
01292
01293
01294 MarSystem* WHaSpnetpr = new Series("WHaSpnetpr");
01295 WHaSpnetpr->addMarSystem(create("PeakAnalyse", "analyse"));
01296 WHaSpnetpr->addMarSystem(create("WHaSp", "whasp"));
01297
01298 WHaSpnetpr->linkControl("WHaSp/whasp/mrs_natural/totalNumPeaks",
01299 "PeakAnalyse/analyse/PeakConvert/conv/mrs_natural/totalNumPeaks");
01300 WHaSpnetpr->linkControl("WHaSp/whasp/mrs_natural/frameMaxNumPeaks",
01301 "PeakAnalyse/analyse/PeakConvert/conv/mrs_natural/frameMaxNumPeaks");
01302
01303 WHaSpnetpr->linkControl("mrs_natural/frameMaxNumPeaks",
01304 "PeakAnalyse/analyse/mrs_natural/frameMaxNumPeaks");
01305 WHaSpnetpr->updControl("mrs_natural/frameMaxNumPeaks", 20);
01306
01307 registerPrototype("WHaSpnet", WHaSpnetpr);
01308 }
01309 break;
01310
01311 case STEREOFEATURES2:
01312 {
01313
01314
01315
01316 MarSystem* stereoFeats2 = new Fanout("StereoFeatures2pr");
01317 stereoFeats2->addMarSystem(create("StereoSpectrumFeatures","stereospkfeats"));
01318 stereoFeats2->addMarSystem(create("StereoSpectrumSources","stereospksources"));
01319 registerPrototype("StereoFeatures2", stereoFeats2);
01320 }
01321 break;
01322
01323 case CLASSIFIER:
01324 {
01325
01326
01327
01328 MarSystem* classifierpr = create("Fanout", "Classifierpr");
01329 classifierpr->addMarSystem(create("ZeroRClassifier", "zerorcl"));
01330 classifierpr->addMarSystem(create("GaussianClassifier", "gaussiancl"));
01331 classifierpr->addMarSystem(create("SVMClassifier", "svmcl"));
01332
01333
01334 classifierpr->addctrl("mrs_natural/nClasses", 1);
01335 classifierpr->addctrl("mrs_string/mode", "train");
01336 classifierpr->setctrlState("mrs_string/mode", true);
01337 classifierpr->addctrl("mrs_realvec/classProbabilities", realvec());
01338
01339
01340 classifierpr->linkControl("ZeroRClassifier/zerorcl/mrs_natural/nClasses",
01341 "mrs_natural/nClasses");
01342 classifierpr->linkControl("GaussianClassifier/gaussiancl/mrs_natural/nClasses",
01343 "mrs_natural/nClasses");
01344 classifierpr->linkControl("SVMClassifier/svmcl/mrs_natural/nClasses",
01345 "mrs_natural/nClasses");
01346
01347 classifierpr->linkControl("ZeroRClassifier/zerorcl/mrs_string/mode",
01348 "mrs_string/mode");
01349 classifierpr->linkControl("GaussianClassifier/gaussiancl/mrs_string/mode",
01350 "mrs_string/mode");
01351 classifierpr->linkControl("SVMClassifier/svmcl/mrs_string/mode",
01352 "mrs_string/mode");
01353
01354 classifierpr->linkControl("ZeroRClassifier/zerorcl/mrs_realvec/classProbabilities",
01355 "mrs_realvec/classProbabilities");
01356 classifierpr->linkControl("GaussianClassifier/gaussiancl/mrs_realvec/classProbabilities",
01357 "mrs_realvec/classProbabilities");
01358 classifierpr->linkControl("SVMClassifier/svmcl/mrs_realvec/classProbabilities",
01359 "mrs_realvec/classProbabilities");
01360
01361 classifierpr->updControl("mrs_string/disableChild", "all");
01362 registerPrototype("Classifier", classifierpr);
01363 }
01364 break;
01365
01366 }
01367
01368 compositesMap_[prototype] = STUB;
01369 }
01370
01371 MarSystemManager::~MarSystemManager()
01372 {
01373 map<mrs_string, MarSystem *>::const_iterator iter;
01374
01375 for (iter=registry_.begin(); iter != registry_.end(); ++iter)
01376 {
01377 delete iter->second;
01378 }
01379 registry_.clear();
01380 }
01381
01382 void
01383 MarSystemManager::registerPrototype(mrs_string type, MarSystem *marsystem)
01384 {
01385
01386 marsystem->setType(type);
01387
01388 std::map<std::string,MarSystem*>::iterator iter = registry_.find(type);
01389 if (iter != registry_.end())
01390 {
01391 MarSystem* m = iter->second;
01392 delete m;
01393 }
01394
01395 registry_[type] = marsystem;
01396 }
01397
01398
01399 MarSystem*
01400 MarSystemManager::getPrototype(mrs_string type)
01401 {
01402 if (registry_.find(type) != registry_.end())
01403 return (MarSystem *)(registry_[type])->clone();
01404 else
01405 {
01406 MRSWARN("MarSystemManager::getPrototype: No prototype found for " + type);
01407 return NULL;
01408 }
01409 }
01410
01411 MarSystem*
01412 MarSystemManager::create(mrs_string type, mrs_string name)
01413 {
01414
01415 registerComposite(type);
01416
01417 if (registry_.find(type) != registry_.end())
01418 {
01419 MarSystem* m = (MarSystem *)(registry_[type])->clone();
01420 m->setName(name);
01421 return m;
01422 }
01423 else
01424 {
01425 MRSWARN("MarSystemManager::create: No prototype found for " + type);
01426 return NULL;
01427 }
01428 }
01429
01430 MarSystem*
01431 MarSystemManager::create(std::string marsystemname)
01432 {
01433 mrs_string::size_type loc = marsystemname.rfind("/", marsystemname.length()-1);
01434 if (loc != mrs_string::npos)
01435 return create(marsystemname.substr(0,loc),
01436 marsystemname.substr(loc +1));
01437 else
01438 return create(marsystemname, marsystemname + "_unknown");
01439 }
01440
01441
01442 MarSystem*
01443 MarSystemManager::loadFromFile(std::string filename)
01444 {
01445 ifstream ifs(filename.c_str());
01446 MarSystem* net;
01447 net = getMarSystem(ifs);
01448 return net;
01449 }
01450
01451
01452
01453 MarSystem*
01454 MarSystemManager::getMarSystem(istream& is, MarSystem *parent)
01455 {
01456
01457
01458
01459 mrs_string skipstr;
01460 mrs_string mcomposite;
01461 mrs_natural i;
01462 bool isComposite;
01463 mrs_string marSystem = "MarSystem";
01464 mrs_string marSystemComposite = "MarSystemComposite";
01465
01466
01467
01468
01469 is >> skipstr;
01470 is >> mcomposite;
01471 if (mcomposite == marSystem)
01472 isComposite = false;
01473 else if (mcomposite == marSystemComposite)
01474 isComposite = true;
01475 else
01476 {
01477 MRSERR("Unknown MarSystemType" << mcomposite);
01478 MRSERR("skipstr = " << skipstr);
01479 return 0;
01480 }
01481
01482
01483
01484
01485 is >> skipstr >> skipstr >> skipstr;
01486 mrs_string mtype;
01487 is >> mtype;
01488
01489
01490
01491
01492
01493 is >> skipstr >> skipstr >> skipstr;
01494 mrs_string mname;
01495 is >> mname;
01496
01497 MarSystem* msys = getPrototype(mtype);
01498
01499 if (msys == 0)
01500 {
01501 if (compositesMap_.find(mtype) == compositesMap_.end())
01502 {
01503 MRSERR("MarSystem::getMarSystem - MarSystem " << mtype << " is not yet part of Marsyas");
01504 return 0;
01505 }
01506 else
01507 {
01508
01509 registerComposite(mtype);
01510 msys = getPrototype(mtype);
01511 }
01512 }
01513
01514 msys->setName(mname);
01515 msys->setParent(parent);
01516
01517
01518
01519 is >> *msys;
01520
01521 msys->update();
01522
01523 workingSet_[msys->getName()] = msys;
01524
01525
01526
01527 if (isComposite)
01528 {
01529
01530
01531
01532
01533
01534
01535
01536 is >> skipstr >> skipstr >> skipstr;
01537 mrs_natural nComponents;
01538 is >> nComponents;
01539 for (i=0; i < nComponents; ++i)
01540 {
01541 MarSystem* cmsys = getMarSystem(is, msys);
01542 if (cmsys == 0)
01543 return 0;
01544 msys->addMarSystem(cmsys);
01545 }
01546 msys->update();
01547 }
01548 return msys;
01549 }
01550
01551
01552
01553
01554
01555
01556 vector <mrs_string> MarSystemManager::registeredPrototypes()
01557 {
01558 vector <mrs_string> retVal;
01559
01560 map<mrs_string, MarSystem *>::const_iterator iter;
01561
01562 for (iter=registry_.begin(); iter != registry_.end(); ++iter)
01563 {
01564 retVal.push_back (iter->first);
01565 }
01566
01567 return retVal;
01568 }
01569
01570
01571 map<mrs_string, MarSystem*> MarSystemManager::getWorkingSet(istream& is)
01572 {
01573 getMarSystem(is);
01574 return workingSet_;
01575 }
01576
01577
01578
01579
01580
01581
01582
01583
01584 bool MarSystemManager::isRegistered (mrs_string name)
01585 {
01586 return (registry_.find(name) != registry_.end());
01587 }