diff --git a/sflphone-gtk/src/configwindow.c b/sflphone-gtk/src/configwindow.c index e45fe4d0b1b96e0a0b8ccba4bee433737409569d..d71e79ed1016fed5112f025c7e89a63d4281711a 100644 --- a/sflphone-gtk/src/configwindow.c +++ b/sflphone-gtk/src/configwindow.c @@ -714,6 +714,7 @@ create_recording_settings () label = gtk_label_new_with_mnemonic(_("_Destination folder")); gtk_table_attach( GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + // folder chooser button folderChooser = gtk_file_chooser_button_new(_("Select a folder"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); diff --git a/src/global.h b/src/global.h index 6dfe9a1e1ba3c2a34eb2231a15f4b222ca033085..553fe6c161aef231e75f1fa08dcfcc5da70e55c4 100644 --- a/src/global.h +++ b/src/global.h @@ -32,7 +32,9 @@ #include <map> #include <vector> -#define SFLPHONED_VERSION "0.9.2-4" /** Version number */ +#define SFLPHONED_VERSION "0.9.3-1" /** Version number */ + +#define HOMEDIR (getenv ("HOME")) /** Home directory */ typedef float float32; typedef short int16; diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index 5a7a73e1ee1b9c06af22f59ce1a3144cb42567ba..7a98835bace3e7b923e73aae58c80ebd22052105 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -1029,6 +1029,7 @@ ManagerImpl::initConfigFile ( bool load_user_value ) fill_config_str(RING_CHOICE, DFT_RINGTONE); fill_config_int(VOLUME_SPKR, DFT_VOL_SPKR_STR); fill_config_int(VOLUME_MICRO, DFT_VOL_MICRO_STR); + fill_config_str(RECORD_PATH,DFT_RECORD_PATH); section = PREFERENCES; fill_config_str(ZONE_TONE, DFT_ZONE); diff --git a/src/plug-in/audiorecorder/audiodsp.cpp b/src/plug-in/audiorecorder/audiodsp.cpp new file mode 100644 index 0000000000000000000000000000000000000000..50bab4251436e49d9f0812f2dab1a4614559b2b7 --- /dev/null +++ b/src/plug-in/audiorecorder/audiodsp.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2008 Savoir-Faire Linux inc. + * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "audiodsp.h" + +AudioDSP::AudioDSP() +{ + + bufPointer_ = 0; + bufferLength_ = 1024; + circBuffer_ = new float[bufferLength_]; + +} + + +AudioDSP::~AudioDSP() +{ + + delete[] circBuffer_; + +} + + +float AudioDSP::getRMS(int data) +{ + printf("AudioDSP::getRMS() : bufPointer_ %i \n ", bufPointer_); + circBuffer_[bufPointer_++] = (float)data; + + if(bufPointer_ >= bufferLength_) + bufPointer_ = 0; + + return computeRMS(); +} + + +float AudioDSP::computeRMS() +{ + + rms = 0.0; + + + for(int i = 0; i < bufferLength_; i++){ + printf("AudioDSP::computeRMS() : i_ %i \n ", i); + rms += (float)(circBuffer_[i]*circBuffer_[i]); + } + rms = sqrt(rms / (float)bufferLength_); + + printf("AudioDSP::computeRMS() : RMS VALUE: %f \n", rms); + return rms; + +} diff --git a/src/plug-in/audiorecorder/audiodsp.h b/src/plug-in/audiorecorder/audiodsp.h new file mode 100644 index 0000000000000000000000000000000000000000..c99093a22011e5655bda8161a9182d84699b5901 --- /dev/null +++ b/src/plug-in/audiorecorder/audiodsp.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2008 Savoir-Faire Linux inc. + * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _AUDIO_DSP_H +#define _AUDIO_DSP_H + +#include <math.h> +#include <iostream> +#include <string.h> +#include <stdlib.h> +#include <sstream> + +class AudioDSP +{ + +public: + + AudioDSP(); + + ~AudioDSP(); + + /** + * Return rms value + */ + float getRMS(int data); + +protected: + + /** + * Compute Rms value + */ + float computeRMS(); + + /** + * Internal buffer pointer + */ + int bufPointer_; + + /** + * Internal buffer length + */ + int bufferLength_; + + /** + * Internal buffer to compute RMS + */ + float* circBuffer_; + + /** + * Variable to compute RMS value + */ + float rms; + +}; + +#endif // _AUDIO_DSP_H diff --git a/src/plug-in/audiorecorder/audiorecord.cpp b/src/plug-in/audiorecorder/audiorecord.cpp index 40c624278f6b6b4bc29ad76dc2ea809a8e21f1cd..2755770cf99c0b7ce4f8e9837f92a81199d88426 100644 --- a/src/plug-in/audiorecorder/audiorecord.cpp +++ b/src/plug-in/audiorecorder/audiorecord.cpp @@ -430,6 +430,8 @@ void AudioRecord::recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int for (int k=0; k<nSamples_1; k++){ mixBuffer_[k] = (buffer_1[k]+buffer_2[k])/2; + + dsp.getRMS(mixBuffer_[k]); if ( fwrite(&buffer_1[k], 2, 1, fp) != 1) _debug("AudioRecord: Could not record data!\n"); diff --git a/src/plug-in/audiorecorder/audiorecord.h b/src/plug-in/audiorecorder/audiorecord.h index 68b5436afb77b5646d0b98a5c1028c306003cfa9..e5104e8fb0fa214657632e2f0094b978f2aaf207 100644 --- a/src/plug-in/audiorecorder/audiorecord.h +++ b/src/plug-in/audiorecorder/audiorecord.h @@ -26,6 +26,10 @@ #include <sstream> #include "plug-in/plugin.h" +#include "audiodsp.h" + +// class AudioDSP; + using namespace std; typedef std::string CallID; @@ -182,7 +186,12 @@ protected: */ std::string savePath_; - + + /** + * AudioDSP test (compute RMS value) + */ + AudioDSP dsp; + }; #endif // _AUDIO_RECORD_H diff --git a/src/user_cfg.h b/src/user_cfg.h index 6b94dc9e877a6afa972fd14de6cf60fafbda2d71..fea650490eb60e5e34d77339b086c5610442ab47 100644 --- a/src/user_cfg.h +++ b/src/user_cfg.h @@ -24,7 +24,7 @@ #include <stdlib.h> -#define HOMEDIR (getenv ("HOME")) /** Home directory */ +#define HOMEDIR (getenv ("HOME")) /** Home directory */ #define DIR_SEPARATOR_CH '/' /** Directory separator string */ #define DIR_SEPARATOR_STR "/" /** Directory separator char */ @@ -92,7 +92,8 @@ #define DFT_EXPIRE_VALUE "180" /** Default expire value for registration */ #define DFT_AUDIO_MANAGER "1" /** Default audio manager */ #define DFT_SIP_PORT "5060" -#define DFT_STUN_ENABLE "0" +#define DFT_STUN_ENABLE "0" +#define DFT_RECORD_PATH HOMEDIR #ifdef USE_ZEROCONF #define CONFIG_ZEROCONF_DEFAULT_STR "1" /** Default Zero configuration networking module value */