void FTTask::computeSpectrogram() { debug_assert(!_amplitudeMatrix); BasicApplication::lockFFTW(); pair<Matrix*, Matrix*> spectrogram; logger().debug(nameAndTaskID() + " computing spectrogram."); try { pair<Matrix*, Matrix*> spectrogram = _audioData-> computeSpectrogram(_windowFunction, _windowSize, _overlap, 0, _zeroPadding, _removeDC); _amplitudeMatrix = spectrogram.first; _phaseMatrix = spectrogram.second; } catch (...) { BasicApplication::unlockFFTW(); throw; } BasicApplication::unlockFFTW(); _ftMagMatrix = _amplitudeMatrix; // Add transformations if specified in the configuration. // Keep in mind that the transformations are executed in the order in // which they were added, thus the order of these statements is vital! Poco::Util::LayeredConfiguration& cfg = BasicApplication::instance().config(); if (cfg.getBool("blissart.fft.transformations.spectralSubtraction", false)) { addTransformation(new transforms::SpectralSubtractionTransform); } if (cfg.getBool("blissart.fft.transformations.powerSpectrum", false)) { addTransformation(new transforms::PowerTransform); } if (cfg.getBool("blissart.fft.transformations.melFilter", false)) { addTransformation(new transforms::MelFilterTransform(_sampleRate)); } if (cfg.getBool("blissart.fft.transformations.slidingWindow", false)) { addTransformation(new transforms::SlidingWindowTransform); } }
InputMethodT makeIM (guint count, ...) { const gchar *trans; InputMethodT im; va_list transList; va_start (transList, count); for (guint i = 0; i < count; i++) { trans = va_arg (transList, const gchar *); im = addTransformation (im, _(trans)); } va_end (transList); return im; }
InputMethodT makeIMFromString (ustring imStr) { InputMethodT im; _size_t_ eolPos; ustring transPortion; ustring specialToken = (imStr.find (" -> ") != ustring::npos) ? _(" -> ") : _(" "); while (imStr.length () > 1) { eolPos = imStr.find ("\n"); transPortion = imStr.substr (0, eolPos); imStr = imStr.replace (0, eolPos + 1, ""); im = addTransformation (im, transPortion.replace (1, specialToken.length (), "")); } return standardizeIM (im); }
void CEntity::animatePlayList(NL3D::TAnimationTime time) { if (!_PlayListAnimation.empty()) { // Animation index uint id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[0].c_str()); // Try channel AnimationSet NL3D::UAnimation *anim = _AnimationSet->getAnimation(id); bool there = false; UTrack *posTrack = NULL; UTrack *rotQuatTrack = NULL; // Current matrix CMatrix current; current.identity(); // read an animation for init matrix rotQuatTrack = anim->getTrackByName("rotquat"); posTrack = anim->getTrackByName("pos"); there = posTrack || rotQuatTrack; // Accumul time float startTime = 0; float endTime = anim->getEndTime() - anim->getBeginTime(); uint index = 0; while (time >= endTime) { index++; if (index < _PlayListAnimation.size()) { id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[index].c_str()); NL3D::UAnimation *newAnim = _AnimationSet->getAnimation(id); UTrack *newPosTrack = newAnim->getTrackByName ("pos"); UTrack *newRotquatTrack = newAnim->getTrackByName ("rotquat"); // Add the transformation addTransformation (current, anim, newAnim->getBeginTime(), anim->getEndTime(), posTrack, rotQuatTrack, newPosTrack, newRotquatTrack, true); anim = newAnim; posTrack = newPosTrack; rotQuatTrack = newRotquatTrack; // Add start time startTime = endTime; endTime = startTime + (anim->getEndTime() - anim->getBeginTime()); } else { // Add the transformation addTransformation (current, anim, 0, anim->getEndTime(), posTrack, rotQuatTrack, NULL, NULL, false); break; } } // Time cropped ? if (index >= _PlayListAnimation.size()) { // Yes index--; id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[index].c_str()); anim = _AnimationSet->getAnimation(id); // End time for last anim startTime = anim->getEndTime() - time; } else { // No // Add the transformation addTransformation (current, anim, 0, anim->getBeginTime() + time - startTime, posTrack, rotQuatTrack, NULL, NULL, false); id = _AnimationSet->getAnimationIdByName(_PlayListAnimation[index].c_str()); anim = _AnimationSet->getAnimation(id); // Final time startTime -= anim->getBeginTime(); } // Set the slot _PlayList->setAnimation(0, id); _PlayList->setTimeOrigin(0, startTime); _PlayList->setSpeedFactor(0, 1.0f); _PlayList->setWeightSmoothness(0, 1.0f); _PlayList->setStartWeight(0, 1, 0); _PlayList->setEndWeight(0, 1, 1); _PlayList->setWrapMode(0, UPlayList::Clamp); // Setup the pos and rot for this shape if (there) { CVector pos = current.getPos(); // If a skeleton model if(!_Skeleton.empty()) { // scale animated pos value with the CFG scale pos *= _CharacterScalePos; _Skeleton.setPos(pos); _Skeleton.setRotQuat(current.getRot()); } else { _Instance.setPos(pos); _Instance.setRotQuat(current.getRot()); } } } }
InputMethodT addTransformation (InputMethodT im, const gchar *trans) { return addTransformation (im, _(trans)); }