/* This file is part of EqualizerAPO, a system-wide equalizer. Copyright (C) 2014 Jonas Thedering This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include #include #include "helpers/LogHelper.h" #include "helpers/MemoryHelper.h" #include "CopyFilter.h" using namespace std; CopyFilter::CopyFilter(const vector& assignments) { this->assignments = assignments; internalAssignments = NULL; assignmentCount = 0; } CopyFilter::~CopyFilter() { cleanup(); } vector CopyFilter::initialize(float sampleRate, unsigned maxFrameCount, vector channelNames) { cleanup(); assignmentCount = (unsigned)assignments.size(); internalAssignments = (InternalAssignment*)MemoryHelper::alloc(assignmentCount * sizeof(Assignment)); vector outChannelNames; for(unsigned i=0; i::const_iterator it = find(outChannelNames.begin(), outChannelNames.end(), channelName); ia.targetChannel = (int)(it-outChannelNames.begin()); if(it == outChannelNames.end()) outChannelNames.push_back(channelName); ia.sourceCount = (unsigned)a.sourceSum.size(); ia.sourceSum = (InternalAssignment::InternalSummand*)MemoryHelper::alloc(ia.sourceCount * sizeof(InternalAssignment::InternalSummand)); for(unsigned j=0; j 0) stream << ", "; stream << L"to channel " << outChannelNames[ia.targetChannel].c_str() << " "; for(unsigned j=0; j 0) stream << ", "; if(is.channel != -1) stream << L"from channel " << channelNames[is.channel].c_str() << L" with factor " << is.factor; else stream << L"value " << is.factor; } } TraceF(L"%s", stream.str().c_str()); return outChannelNames; } #pragma AVRT_CODE_BEGIN void CopyFilter::process(float** output, float** input, unsigned frameCount) { for(unsigned i=0; i