text
stringlengths
0
2.2M
}
break;
case WindowType::HANNING:
for (auto& c : coefs_) {
c = 0.5 * (1.0 - std::cos(2 * M_PI * c / (N - 1)));
}
break;
default:
throw std::invalid_argument("Windowing: unsupported window type");
}
}
std::vector<float> Windowing::apply(const std::vector<float>& input) const {
auto output(input);
applyInPlace(output);
return output;
}
void Windowing::applyInPlace(std::vector<float>& input) const {
if (input.size() % windowLength_ != 0) {
throw std::invalid_argument(
"Windowing: input size is not divisible by windowLength");
}
size_t n = 0;
for (auto& in : input) {
in *= coefs_[n++];
if (n == windowLength_) {
n = 0;
}
}
}
} // namespace audio
} // namespace lib
} // namespace fl
#include "promise-cpp/promise.hpp"
#ifndef PROMISE_HEADONLY
#include "promise-cpp/promise_inl.hpp"
#endif
/*
Copyright 2009-2020, Sumeet Chhetri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
* Renderer.cpp
*
* Created on: Jan 2, 2010
* Author: sumeet
*/
#include "Renderer.h"
Renderer::Renderer() {
}
Renderer::~Renderer() {
}
std::string Renderer::generateStartOpenTag(const std::string& tagName)
{
std::string str = "<" + tagName;
return str;
}
std::string Renderer::generateEndOpenTag()
{
std::string str = ">";
return str;
}
std::string Renderer::generateCloseTag(const std::string& tagName)
{
std::string str = "</" + tagName + ">";
return str;
}
std::string Renderer::generateAttributes(const AttributeList& attributes)
{
std::string str;
AttributeList::const_iterator itr;
for(itr = attributes.begin();itr!=attributes.end();itr++)
{
str += (" " + itr->first + "=\"" + itr->second + "\" ");
}