diff --git a/src/audio/codecs/speexcodec.cpp b/src/audio/codecs/speexcodec.cpp index 1400e0c2069108bd2776015a21e13f4a26a468c7..c9a350fcdb3208b58296b01d96f5bb130de7342b 100644 --- a/src/audio/codecs/speexcodec.cpp +++ b/src/audio/codecs/speexcodec.cpp @@ -24,6 +24,7 @@ #include <speex/speex_preprocess.h> + class Speex : public AudioCodec{ public: Speex(int payload=0) @@ -47,21 +48,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 +73,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); } diff --git a/src/call.cpp b/src/call.cpp index 558ee81b8840d5ca7672ae9e45cee1c8d8f8ed0b..e3a4f43cce078937e76271b8316205e8de4d4f20 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -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"); } diff --git a/src/plug-in/audiorecorder/audiorecord.cpp b/src/plug-in/audiorecorder/audiorecord.cpp index cc0d25e4a8e2efbad89509dc2c3e3c6865126ca1..5e73d442db62a69cc449c199e7983fc8905977cb 100644 --- a/src/plug-in/audiorecorder/audiorecord.cpp +++ b/src/plug-in/audiorecorder/audiorecord.cpp @@ -54,32 +54,35 @@ 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; - - fileType_ = type; + std::string fName; + + fileType_ = type; 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); - } void AudioRecord::openFile(){ @@ -122,6 +125,8 @@ void AudioRecord::closeFile() { else if (fileType_ == FILE_WAV) this->closeWavFile(); + + } @@ -331,7 +336,7 @@ void AudioRecord::closeWavFile() _debug("AudioRecord:: Can't closeWavFile, a file has not yet been opened!\n"); return; } - + /* _debug("AudioRecord::closeWavFile() \n"); if ( fclose( fp ) != 0) @@ -344,7 +349,7 @@ void AudioRecord::closeWavFile() _debug("AudioRecord::closeWavFile() : could not open WAV file rb+!\n"); return; } - + */ SINT32 bytes = byteCounter_ * channels_; fseek(fp, 40, SEEK_SET); // jump to data length diff --git a/src/plug-in/audiorecorder/audiorecord.h b/src/plug-in/audiorecorder/audiorecord.h index e5104e8fb0fa214657632e2f0094b978f2aaf207..d0d75465e234b0773db68339ecccad0cf1050fd2 100644 --- a/src/plug-in/audiorecorder/audiorecord.h +++ b/src/plug-in/audiorecorder/audiorecord.h @@ -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)