Esempio n. 1
0
void OutputConnection::add(int inputBufferCount, float** inputBuffers, bool shouldApplyMixingMatrix) {
	//Ticking is now handled by the planner, see planner.cpp.
	//If the node is paused, we are going to output zeros, so skip.
	if(node->getState() == Lav_NODESTATE_PAUSED) return;
	//get the array of outputs from our node.
	float** outputArray=node->getOutputBufferArray();
	//it is the responsibility of our node to keep us configured, so we assume what info we have is accurate. If it is not, that is the fault of our node.
	///if they're the same, we fall through because we can do better with our sse kernels than audio_io.
	if(shouldApplyMixingMatrix && inputBufferCount != count ) {
		//Remix, but don't zero first.
		audio_io::remixAudioUninterleaved(block_size, count, outputArray+start, inputBufferCount, inputBuffers, false);
	}
	else { //copy and drop.
		int channelsToAdd =std::min(count, inputBufferCount);
		for(int i=0; i < channelsToAdd; i++) additionKernel(block_size, outputArray[i+start], inputBuffers[i], inputBuffers[i]);
	}
}
void FftConvolver::convolveFft(kiss_fft_cpx *fft, float* output) {
	//Do a complex multiply.
	//Note that the first line is subtraction because of the i^2.
	for(int i=0; i < fft_size; i++) {
		kiss_fft_cpx tmp;
		tmp.r = fft[i].r*response_fft[i].r-fft[i].i*response_fft[i].i;
		tmp.i = fft[i].r*response_fft[i].i+fft[i].i*response_fft[i].r;
		block_fft[i] = tmp;
	}
	kiss_fftri(ifft, block_fft, workspace);
	//Add the tail over the block.
	additionKernel(tail_size, tail, workspace, workspace);
	//Downscale the first part, our output.
	//Also copy to the output at the same time.
	scalarMultiplicationKernel(block_size, 1.0/workspace_size, workspace, output);
	//Copy out the tail.
	std::copy(workspace+block_size, workspace+workspace_size, tail);
}