Skip to content
Snippets Groups Projects
Commit 53bdc99a authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Merge branch 'recording' of git+ssh://repos-sflphone-git@sflphone.org/~/sflphone into recording

parents eead478c 0166930d
Branches
Tags
No related merge requests found
...@@ -715,6 +715,7 @@ create_recording_settings () ...@@ -715,6 +715,7 @@ create_recording_settings ()
gtk_table_attach( GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); 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); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
// folder chooser button // folder chooser button
folderChooser = gtk_file_chooser_button_new(_("Select a folder"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); folderChooser = gtk_file_chooser_button_new(_("Select a folder"), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER( folderChooser) , gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER( folderChooser) ,
......
...@@ -32,7 +32,9 @@ ...@@ -32,7 +32,9 @@
#include <map> #include <map>
#include <vector> #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 float float32;
typedef short int16; typedef short int16;
......
...@@ -1029,6 +1029,7 @@ ManagerImpl::initConfigFile ( bool load_user_value ) ...@@ -1029,6 +1029,7 @@ ManagerImpl::initConfigFile ( bool load_user_value )
fill_config_str(RING_CHOICE, DFT_RINGTONE); fill_config_str(RING_CHOICE, DFT_RINGTONE);
fill_config_int(VOLUME_SPKR, DFT_VOL_SPKR_STR); fill_config_int(VOLUME_SPKR, DFT_VOL_SPKR_STR);
fill_config_int(VOLUME_MICRO, DFT_VOL_MICRO_STR); fill_config_int(VOLUME_MICRO, DFT_VOL_MICRO_STR);
fill_config_str(RECORD_PATH,DFT_RECORD_PATH);
section = PREFERENCES; section = PREFERENCES;
fill_config_str(ZONE_TONE, DFT_ZONE); fill_config_str(ZONE_TONE, DFT_ZONE);
......
/*
* 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;
}
/*
* 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
...@@ -431,6 +431,8 @@ void AudioRecord::recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int ...@@ -431,6 +431,8 @@ void AudioRecord::recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int
mixBuffer_[k] = (buffer_1[k]+buffer_2[k])/2; mixBuffer_[k] = (buffer_1[k]+buffer_2[k])/2;
dsp.getRMS(mixBuffer_[k]);
if ( fwrite(&buffer_1[k], 2, 1, fp) != 1) if ( fwrite(&buffer_1[k], 2, 1, fp) != 1)
_debug("AudioRecord: Could not record data!\n"); _debug("AudioRecord: Could not record data!\n");
else { else {
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
#include <sstream> #include <sstream>
#include "plug-in/plugin.h" #include "plug-in/plugin.h"
#include "audiodsp.h"
// class AudioDSP;
using namespace std; using namespace std;
typedef std::string CallID; typedef std::string CallID;
...@@ -183,6 +187,11 @@ protected: ...@@ -183,6 +187,11 @@ protected:
std::string savePath_; std::string savePath_;
/**
* AudioDSP test (compute RMS value)
*/
AudioDSP dsp;
}; };
#endif // _AUDIO_RECORD_H #endif // _AUDIO_RECORD_H
...@@ -93,6 +93,7 @@ ...@@ -93,6 +93,7 @@
#define DFT_AUDIO_MANAGER "1" /** Default audio manager */ #define DFT_AUDIO_MANAGER "1" /** Default audio manager */
#define DFT_SIP_PORT "5060" #define DFT_SIP_PORT "5060"
#define DFT_STUN_ENABLE "0" #define DFT_STUN_ENABLE "0"
#define DFT_RECORD_PATH HOMEDIR
#ifdef USE_ZEROCONF #ifdef USE_ZEROCONF
#define CONFIG_ZEROCONF_DEFAULT_STR "1" /** Default Zero configuration networking module value */ #define CONFIG_ZEROCONF_DEFAULT_STR "1" /** Default Zero configuration networking module value */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment