Commit 666e8e7a authored by Alexandre Savard's avatar Alexandre Savard
Browse files

Small cleanup

parent f1d3ffe8
......@@ -30,6 +30,7 @@
#include <dlfcn.h>
#include <iostream>
#include <sstream>
#include <speex/speex_preprocess.h>
#include "../global.h"
#include "../manager.h"
......
......@@ -21,7 +21,7 @@
#include "audiocodec.h"
#include <cstdio>
#include <speex/speex.h>
#include <speex/speex_preprocess.h>
class Speex : public AudioCodec{
......@@ -47,21 +47,10 @@ public:
Speex& operator=(const Speex&);
void initSpeex() {
int temp = 1;
int temp10 = 10;
int db = -10;
int *enable;
enable = &temp;
int *quality;
quality = &temp10;
int *complex;
complex = &temp10;
int *attenuation;
attenuation = &db;
int enable = 1;
int quality = 10;
int complex = 10;
int attenuation = -10;
/*
if (_clockRate < 16000 ) {
......@@ -83,20 +72,20 @@ public:
// Init the encoder struct
speex_bits_init(&_speex_enc_bits);
_speex_enc_state = speex_encoder_init(_speexModePtr);
speex_encoder_ctl(_speex_enc_state, SPEEX_SET_VAD, enable);
speex_encoder_ctl(_speex_enc_state, SPEEX_SET_DTX, enable);
speex_encoder_ctl(_speex_enc_state, SPEEX_SET_VBR_QUALITY, quality);
speex_encoder_ctl(_speex_enc_state, SPEEX_SET_COMPLEXITY, complex);
speex_encoder_ctl(_speex_enc_state, SPEEX_SET_VAD, &enable);
speex_encoder_ctl(_speex_enc_state, SPEEX_SET_DTX, &enable);
speex_encoder_ctl(_speex_enc_state, SPEEX_SET_VBR_QUALITY, &quality);
speex_encoder_ctl(_speex_enc_state, SPEEX_SET_COMPLEXITY, &complex);
// Init the decoder struct
speex_decoder_ctl(_speex_dec_state, SPEEX_GET_FRAME_SIZE, &_speex_frame_size);
// Init the preprocess struct
_preprocess_state = speex_preprocess_state_init(_speex_frame_size,_clockRate);
speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_DENOISE, enable);
speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, attenuation);
speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_VAD, enable);
speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_AGC, enable);
speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_DENOISE, &enable);
speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &attenuation);
speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_VAD, &enable);
speex_preprocess_ctl(_preprocess_state, SPEEX_PREPROCESS_SET_AGC, &enable);
}
......
......@@ -41,7 +41,7 @@ Call::Call(const CallID& id, Call::CallType type)
FILE_TYPE fileType = FILE_WAV;
SOUND_FORMAT soundFormat = INT16;
recAudio.setRecordingOption(fileType,soundFormat,44100, Manager::instance().getConfigString (AUDIO, RECORD_PATH));
recAudio.setRecordingOption(fileType,soundFormat,44100, Manager::instance().getConfigString (AUDIO, RECORD_PATH),id);
_debug("CALL::Constructor for this clss is called \n");
}
......
......@@ -54,7 +54,7 @@ void AudioRecord::setSndSamplingRate(int smplRate){
sndSmplRate_ = smplRate;
}
void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path){
void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path, std::string id){
std::string fName;
......@@ -62,23 +62,25 @@ void AudioRecord::setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sn
sndFormat_ = format;
channels_ = 1;
sndSmplRate_ = sndSmplRate;
call_id_ = id;
fName = fileName_;
fName.append("-"+call_id_);
if (fileType_ == FILE_RAW){
if ( strstr(fileName_, ".raw") == NULL){
printf("AudioRecord::openFile::concatenate .raw file extension: name : %s \n", fileName_);
strcat(fileName_, ".raw");
fName.append(".raw");
}
}
else if (fileType_ == FILE_WAV){
if ( strstr(fileName_, ".wav") == NULL){
printf("AudioRecord::openFile::concatenate .wav file extension: name : %s \n", fileName_);
strcat(fileName_, ".wav");
fName.append(".wav");
}
}
fName = fileName_;
savePath_ = path + "/";
savePath_.append(fName);
}
......
......@@ -43,7 +43,7 @@ public:
void setSndSamplingRate(int smplRate);
void setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path);
void setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path, std::string id);
/**
* Check if no otehr file is opened, then create a new one
......@@ -186,6 +186,7 @@ protected:
*/
std::string savePath_;
std::string call_id_;
/**
* AudioDSP test (compute RMS value)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment