summaryrefslogtreecommitdiff
path: root/orkbasecxx/BatchProcessing.cpp
diff options
context:
space:
mode:
authorGerald Begumisa <ben_g@users.sourceforge.net>2008-12-18 08:07:04 +0000
committerGerald Begumisa <ben_g@users.sourceforge.net>2008-12-18 08:07:04 +0000
commit3f5c1d9c9358eb6d7a1f2c75b49446303157fcd4 (patch)
tree8bce4fff04918d60ed8bed2669f9c21220556d80 /orkbasecxx/BatchProcessing.cpp
parent960e134a00df44a2cb3eda87f2d7dcde9fb5156e (diff)
Added AudioGain filter that allows gain to be increased or reduced on all channels or a per-channel basis. Therefore 3 configuration parameters have been added, which are AudioGain, AudioGainChannel1 and AudioGainChannel2. These parameters take values in Db. Setting the AudioGain applies the gain to both channels. While setting AudioGainChannel1 and AudioGainChannel2 applies gain to channel 1 and channel 2 respectively.
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@587 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkbasecxx/BatchProcessing.cpp')
-rw-r--r--orkbasecxx/BatchProcessing.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/orkbasecxx/BatchProcessing.cpp b/orkbasecxx/BatchProcessing.cpp
index 02c73df..e82a248 100644
--- a/orkbasecxx/BatchProcessing.cpp
+++ b/orkbasecxx/BatchProcessing.cpp
@@ -162,6 +162,7 @@ void BatchProcessing::ThreadHandler(void *args)
FilterRef decoder1;
FilterRef decoder2;
FilterRef decoder;
+ FilterRef audiogain;
std::bitset<RTP_PAYLOAD_TYPE_MAX> seenRtpPayloadTypes;
std::vector<FilterRef> decoders1;
@@ -181,6 +182,15 @@ void BatchProcessing::ThreadHandler(void *args)
size_t numSamplesS2 = 0;
size_t numSamplesOut = 0;
+ CStdString filterName("AudioGain");
+
+ audiogain = FilterRegistry::instance()->GetNewFilter(filterName);
+ if(audiogain.get() == NULL)
+ {
+ debug = "Could not instanciate AudioGain filter";
+ throw(debug);
+ }
+
while(fileRef->ReadChunkMono(chunkRef))
{
// ############ HACK
@@ -190,6 +200,7 @@ void BatchProcessing::ThreadHandler(void *args)
// ############ HACK
AudioChunkDetails details = *chunkRef->GetDetails();
+
decoder.reset();
if(details.m_rtpPayloadType < -1 || details.m_rtpPayloadType >= RTP_PAYLOAD_TYPE_MAX)
@@ -280,6 +291,10 @@ void BatchProcessing::ThreadHandler(void *args)
filter->AudioChunkIn(tmpChunkRef);
filter->AudioChunkOut(tmpChunkRef);
}
+
+ audiogain->AudioChunkIn(tmpChunkRef);
+ audiogain->AudioChunkOut(tmpChunkRef);
+
outFileRef->WriteChunk(tmpChunkRef);
if(tmpChunkRef.get())
{
@@ -325,11 +340,16 @@ void BatchProcessing::ThreadHandler(void *args)
filter->AudioChunkIn(stopChunk);
filter->AudioChunkOut(tmpChunkRef);
+ audiogain->AudioChunkIn(tmpChunkRef);
+ audiogain->AudioChunkOut(tmpChunkRef);
+
while(tmpChunkRef.get())
{
outFileRef->WriteChunk(tmpChunkRef);
numSamplesOut += tmpChunkRef->GetNumSamples();
filter->AudioChunkOut(tmpChunkRef);
+ audiogain->AudioChunkIn(tmpChunkRef);
+ audiogain->AudioChunkOut(tmpChunkRef);
}
}