Exemplo n.º 1
0
void mixAudioBufferChannelsLogrithmicDRC(AudioBuffer &audioBuffer, std::vector<float> &channelLevels, AudioBuffer &mixBuffer, float threshold)
{
	if(audioBuffer.getChannels() == 0)
		return;

	AudioFormat format=audioBuffer.getFormat();
	unsigned int samples=audioBuffer.getSamples();

	switch(format)
	{
	case AudioFormat::UInt8:
	case AudioFormat::UInt8P:
		mixChannelsLogrithmicDRC<uint8_t>((uint8_t *)audioBuffer.getBuffer(), channelLevels, (uint8_t *)mixBuffer.getBuffer(), samples, threshold);
		break;
	case AudioFormat::Int16:
	case AudioFormat::Int16P:
		mixChannelsLogrithmicDRC<int16_t>((int16_t *)audioBuffer.getBuffer(), channelLevels, (int16_t *)mixBuffer.getBuffer(), samples, threshold);
		break;
	case AudioFormat::Int32:
	case AudioFormat::Int32P:
		mixChannelsLogrithmicDRC<int32_t>((int32_t *)audioBuffer.getBuffer(), channelLevels, (int32_t *)mixBuffer.getBuffer(), samples, threshold);
		break;
	case AudioFormat::Float:
	case AudioFormat::FloatP:
		mixChannelsLogrithmicDRC<float>((float *)audioBuffer.getBuffer(), channelLevels, (float *)mixBuffer.getBuffer(), samples, threshold);
		break;
	case AudioFormat::Double:
	case AudioFormat::DoubleP:
		mixChannelsLogrithmicDRC<double>((double *)audioBuffer.getBuffer(), channelLevels, (double *)mixBuffer.getBuffer(), samples, threshold);
		break;
	}
}