videoeditorengine/audioeditorengine/resampler/src/resampler_rate_conversion_output_driven_int16.cpp
changeset 0 951a5db380a0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/videoeditorengine/audioeditorengine/resampler/src/resampler_rate_conversion_output_driven_int16.cpp	Fri Jan 29 14:08:33 2010 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2010 Ixonos Plc.
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+*
+* Contributors:
+* Ixonos Plc
+*
+* Description:
+*
+*/
+
+
+#include "resampler_rate_conversion_output_driven_int16.h"
+#include "resampler_sinc_conv_one_to_two_int16.h"
+#include "resampler_sinc_conv_one_to_three_int16.h"
+#include "resampler_sinc_conv_two_to_three_int16.h"
+#include "resampler_sinc_conv_44_to_48_int16.h"
+#include "resampler_sinc_conv_two_to_one_int16.h"
+#include "resampler_sinc_conv_three_to_one_int16.h"
+
+bool 
+RESAMPLER_RateConversionOutputDrivenInt16::RateSupported(float inRate, 
+                                                   float outRate, 
+                                                   int channelCount)
+{
+    /* Note that this is a dummy test just to get rid of some warnings. */
+    if (inRate == 0 || outRate == 0 || channelCount == 0)
+    {
+        return false;
+    }
+
+    if (RESAMPLER_SincConvOneToTwoInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvOneToThreeInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvTwoToThreeInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConv44To48Int16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvTwoToOneInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    if (RESAMPLER_SincConvThreeToOneInt16::RateSupported(inRate, outRate))
+    {
+        return true;
+    }
+
+    return false;
+}
+
+
+RESAMPLER_RateConversionOutputDrivenInt16 *
+RESAMPLER_RateConversionOutputDrivenInt16::New(float inRate, 
+                                         float outRate, 
+                                         int channelCount)
+{
+    RESAMPLER_RateConversionOutputDrivenInt16 *converter = 0;
+    
+    /* Note that this is a dummy test just to make configuration easier. */
+    if (inRate == 0 || outRate == 0 || channelCount == 0)
+    {
+        converter = 0;
+    }
+
+    else if (2*inRate == outRate)
+    {
+        converter = new RESAMPLER_SincConvOneToTwoInt16(channelCount);
+    }
+
+    else if (3*inRate == outRate)
+    {
+        converter = new RESAMPLER_SincConvOneToThreeInt16(channelCount);
+    }
+
+    else if (3*inRate == 2*outRate)
+    {
+        converter = new RESAMPLER_SincConvTwoToThreeInt16(channelCount);
+    }
+
+	else if (160 * inRate == 147 * outRate)
+    {
+        converter = new RESAMPLER_SincConv44To48Int16(channelCount);
+    }
+
+    else if (inRate == 2 * outRate)
+    {
+        converter = new RESAMPLER_SincConvTwoToOneInt16(channelCount);
+    }
+
+    else if (inRate == 3 * outRate)
+    {
+        converter = new RESAMPLER_SincConvThreeToOneInt16(channelCount);
+    }
+
+	return converter;
+}
+
+bool RESAMPLER_RateConversionOutputDrivenInt16::SetQualityOutputDriven(int /* mode */)
+{
+    return true;
+}
+
+void RESAMPLER_RateConversionOutputDrivenInt16::EnableChannelOutputDriven(int /* channel */)
+{
+}
+
+void RESAMPLER_RateConversionOutputDrivenInt16::DisableChannelOutputDriven(int /* channel */)
+{
+}
+