Added support for Linear PCM data audio filtering
authorrahul varna <rahul.varna@samsung.com>
Thu, 21 Mar 2013 06:05:20 +0000 (15:05 +0900)
committerrahul varna <rahul.varna@samsung.com>
Thu, 21 Mar 2013 06:05:20 +0000 (15:05 +0900)
Signed-off-by: rahul varna <rahul.varna@samsung.com>
project/data/config.ini
project/res/Audio/PreProcessedAudioAMR.raw
project/src/Recorder/AudioRecorderForm.cpp
project/src/Recorder/VideoRecorderForm.cpp

index 9f816a6..806871e 100644 (file)
@@ -155,6 +155,7 @@ codec=0
 quality=-1
 PreProcessedAudioAAC=res/Audio/PreProcessedAudioAAC.raw
 PreProcessedAudioAMR=res/Audio/PreProcessedAudioAMR.raw
+PreProcessedAudioPCM=res/Audio/PreProcessedAudioPCM.raw
 
 #AudioDecoder
 count=6
index 0a20a24..051b627 100644 (file)
Binary files a/project/res/Audio/PreProcessedAudioAMR.raw and b/project/res/Audio/PreProcessedAudioAMR.raw differ
index b9845c7..8ed56fd 100644 (file)
@@ -481,12 +481,7 @@ AudioRecorderForm::ProcessAudioStream(AudioFrame& frame)
        r = GetLastResult();
        TryCatch(r == E_SUCCESS, , "[%s] Reading from file failed for size %d", GetErrorMessage(GetLastResult()), streamSize);
 
-       for (int i=0; i < streamSize; i++)
-       {
-               char sampleA = pStreamArray[i];
-               char sampleB = pByteArray[i];
-               pStreamArray[i] = (sampleA + sampleB - (sampleA * sampleB) / SHORT_MAX);
-       }
+       memcpy(pStreamArray, pByteArray, streamSize);
 
        AppLog("size %d, channel %d, sampleType %d, samplingRate %d", streamSize, frame.GetChannelType(), frame.GetSampleType(), frame.GetSamplingRate());
 
@@ -1642,11 +1637,12 @@ bool
 AudioRecorderForm::StartAudioRecording(void)
 {
        result r = E_SUCCESS;
+
        __filePath.Clear();
        __filePath.Append(Tizen::App::App::GetInstance()->GetAppRootPath());
        __filePath.Append(_pConfig->GetString(SECTION_NAME, String(L"filename")));
-
        __filePath.Append(L".");
+
        String strFileFormat;
        MediaContainerType audioFormatType = MEDIA_CONTAINER_NONE;
        CodecType audioCodecType = CODEC_NONE;
@@ -1688,6 +1684,10 @@ AudioRecorderForm::StartAudioRecording(void)
        {
                ReadAudioPreProcessedFile(String(L"PreProcessedAudioAMR"));
        }
+       else
+       {
+               ReadAudioPreProcessedFile(String(L"PreProcessedAudioPCM"));
+       }
 
        r = __pAudioRecorder->SetQuality(RecordingQuality(__qualityIndex));
        TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO),"[%s] __pAudioRecorder->SetQuality", GetErrorMessage(r));
index d9258d7..bead169 100644 (file)
@@ -1746,6 +1746,10 @@ VideoRecorderForm::InitCameraRecorder(void)
        {
                ReadAudioPreProcessedFile(String(L"PreProcessedAudioAMR"));
        }
+       else
+       {
+               ReadAudioPreProcessedFile(String(L"PreProcessedAudioPCM"));
+       }
 
        r = __pVideoRecorder->SetQuality(static_cast< RecordingQuality >(__qualityIndex));
        TryCatch(r == E_SUCCESS, ShowError(r, METHOD_FILE_LINENO), "[%s] __pVideoRecorder->SetQuality", GetErrorMessage(r));
@@ -1818,13 +1822,7 @@ VideoRecorderForm::ProcessAudioStream(AudioFrame& frame)
        r = GetLastResult();
        TryCatch(r == E_SUCCESS, , "[%s] Reading from file failed for size %d", GetErrorMessage(GetLastResult()), streamSize);
 
-       for (int i=0; i < streamSize; i++)
-       {
-               char sampleA = pStreamArray[i];
-               char sampleB = pByteArray[i];
-               pStreamArray[i] = (sampleA + sampleB - (sampleA * sampleB) / SHORT_MAX);
-       }
-
+       memcpy(pStreamArray, pByteArray, streamSize);
        AppLog("size %d, channel %d, sampleType %d, samplingRate %d", streamSize, frame.GetChannelType(), frame.GetSampleType(), frame.GetSamplingRate());
 
 CATCH: