Commit 1f85379f authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2165] Fix inclusion errors for audio recorder

parent 70ccd93d
...@@ -61,7 +61,6 @@ AC_CONFIG_FILES([Makefile]) ...@@ -61,7 +61,6 @@ AC_CONFIG_FILES([Makefile])
src/audio/codecs/Makefile \ src/audio/codecs/Makefile \
src/config/Makefile \ src/config/Makefile \
src/dbus/Makefile \ src/dbus/Makefile \
src/plug-in/audiorecorder/Makefile \
src/plug-in/Makefile \ src/plug-in/Makefile \
src/plug-in/test/Makefile \ src/plug-in/test/Makefile \
src/hooks/Makefile \ src/hooks/Makefile \
......
...@@ -93,7 +93,6 @@ libsflphone_la_LIBADD = \ ...@@ -93,7 +93,6 @@ libsflphone_la_LIBADD = \
./dbus/libdbus.la \ ./dbus/libdbus.la \
./config/libconfig.la \ ./config/libconfig.la \
./plug-in/libplugin.la \ ./plug-in/libplugin.la \
./plug-in/audiorecorder/libaudiorecorder.la \
./hooks/libhooks.la \ ./hooks/libhooks.la \
./history/libhistory.la ./history/libhistory.la
......
...@@ -12,6 +12,8 @@ libaudio_la_SOURCES = \ ...@@ -12,6 +12,8 @@ libaudio_la_SOURCES = \
audioloop.cpp \ audioloop.cpp \
ringbuffer.cpp \ ringbuffer.cpp \
mainbuffer.cpp \ mainbuffer.cpp \
audiorecord.cpp \
audiorecorder.cpp \
recordable.cpp \ recordable.cpp \
audiolayer.cpp \ audiolayer.cpp \
audiodevice.cpp \ audiodevice.cpp \
...@@ -28,9 +30,11 @@ noinst_HEADERS = \ ...@@ -28,9 +30,11 @@ noinst_HEADERS = \
audioloop.h \ audioloop.h \
common.h \ common.h \
ringbuffer.h \ ringbuffer.h \
mainbuffer.h \
audiorecord.h \
audiorecorder.h \
audiolayer.h \ audiolayer.h \
audiodevice.h \ audiodevice.h \
mainbuffer.h \
recordable.h \ recordable.h \
algorithm.h \ algorithm.h \
delaydetection.h \ delaydetection.h \
......
...@@ -4,5 +4,5 @@ noinst_LTLIBRARIES = libalsalayer.la ...@@ -4,5 +4,5 @@ noinst_LTLIBRARIES = libalsalayer.la
libalsalayer_la_SOURCES = alsalayer.cpp libalsalayer_la_SOURCES = alsalayer.cpp
noinst_HEADERS = alsalayer.h noinst_HEADERS = alsalayer.h
...@@ -37,20 +37,17 @@ ...@@ -37,20 +37,17 @@
#include "audiodevice.h" #include "audiodevice.h"
#include "ringbuffer.h" #include "ringbuffer.h"
#include "mainbuffer.h" #include "mainbuffer.h"
#include <cc++/thread.h> // for ost::Mutex
#include "dcblocker.h" #include "dcblocker.h"
#include "speexechocancel.h" #include "speexechocancel.h"
#include "echocancel.h" #include "echocancel.h"
#include <cc++/thread.h> // for ost::Mutex
/** /**
* @file audiolayer.h * @file audiolayer.h
* @brief Main sound class. Manages the data transfers between the application and the hardware. * @brief Main sound class. Manages the data transfers between the application and the hardware.
*/ */
class Recordable;
class ManagerImpl; class ManagerImpl;
class AudioLayer { class AudioLayer {
......
...@@ -36,10 +36,7 @@ ...@@ -36,10 +36,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <sstream> #include <sstream>
#include "plug-in/plugin.h" #include "global.h"
// #include "audiodsp.h"
// class AudioDSP;
using namespace std; using namespace std;
......
...@@ -44,8 +44,16 @@ AudioRecorder::AudioRecorder (AudioRecord *arec) ...@@ -44,8 +44,16 @@ AudioRecorder::AudioRecorder (AudioRecord *arec)
*/ */
void AudioRecorder::run (void) void AudioRecorder::run (void)
{ {
/*
while(true) {
SFLDataFormat buffer[10000]; _debug("Audiorecord");
sleep(1);
}
*/
// SFLDataFormat buffer[10000];
// int availBytes = mbuffer->availForGet(recorderId); // int availBytes = mbuffer->availForGet(recorderId);
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include "audiorecord.h" #include "audiorecord.h"
#include <string> #include <string>
class MainBuffer;
class AudioRecorder : public ost::Thread { class AudioRecorder : public ost::Thread {
public: public:
...@@ -50,10 +52,10 @@ class AudioRecorder : public ost::Thread { ...@@ -50,10 +52,10 @@ class AudioRecorder : public ost::Thread {
AudioRecorder (const AudioRecorder& ar); AudioRecorder (const AudioRecorder& ar);
AudioRecorder& operator=(const AudioRecorder& ar); AudioRecorder& operator=(const AudioRecorder& ar);
// MainBuffer *mbuffer;
std::string recorderId; std::string recorderId;
MainBuffer *mbuffer;
AudioRecord *arecord; AudioRecord *arecord;
}; };
......
...@@ -37,12 +37,10 @@ ...@@ -37,12 +37,10 @@
#include <cc++/thread.h> // for ost::Mutex #include <cc++/thread.h> // for ost::Mutex
#include <string> #include <string>
#include "../global.h" #include "global.h"
#include "../call.h" #include "call.h"
#include "ringbuffer.h" #include "ringbuffer.h"
typedef std::map<CallID, RingBuffer*> RingBufferMap; typedef std::map<CallID, RingBuffer*> RingBufferMap;
typedef std::set<CallID> CallIDSet; typedef std::set<CallID> CallIDSet;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include "recordable.h" #include "recordable.h"
#include "manager.h" #include "manager.h"
#include "mainbuffer.h"
Recordable::Recordable() : recorder(&recAudio) Recordable::Recordable() : recorder(&recAudio)
{ {
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
#ifndef RECORDABLE_H #ifndef RECORDABLE_H
#define RECORDABLE_H #define RECORDABLE_H
#include "../plug-in/audiorecorder/audiorecord.h" #include "audiorecord.h"
#include "../plug-in/audiorecorder/audiorecorder.h" #include "audiorecorder.h"
class Recordable { class Recordable {
...@@ -41,14 +41,30 @@ class Recordable { ...@@ -41,14 +41,30 @@ class Recordable {
~Recordable(); ~Recordable();
/**
* Return recording state (true/false)
*/
bool isRecording(){ return recAudio.isRecording(); } bool isRecording(){ return recAudio.isRecording(); }
/**
* This method must be implemented for this interface as calls and conferences
* have different behavior.
*/
virtual bool setRecording() = 0; virtual bool setRecording() = 0;
/**
* Stop recording
*/
void stopRecording(){ recAudio.stopRecording(); } void stopRecording(){ recAudio.stopRecording(); }
/**
* Init the recording file name according to path specified in configuration
*/
void initRecFileName(); void initRecFileName();
/**
* Set recording sampling rate.
*/
void setRecordingSmplRate(int smplRate); void setRecordingSmplRate(int smplRate);
virtual std::string getRecFileId() = 0; virtual std::string getRecFileId() = 0;
...@@ -64,11 +80,6 @@ class Recordable { ...@@ -64,11 +80,6 @@ class Recordable {
AudioRecorder recorder; AudioRecorder recorder;
private:
/** File name for his call : time YY-MM-DD */
// std::string _filename;
}; };
#endif #endif
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#include <cc++/thread.h> // for mutex #include <cc++/thread.h> // for mutex
#include <sstream> #include <sstream>
// #include "plug-in/audiorecorder/audiorecord.h"
#include "audio/recordable.h" #include "audio/recordable.h"
#define SIP_SCHEME "sip:" #define SIP_SCHEME "sip:"
......
include ../../globals.mak include ../../globals.mak
SUBDIRS=audiorecorder test SUBDIRS=test
noinst_LTLIBRARIES = libplugin.la noinst_LTLIBRARIES = libplugin.la
......
include $(top_srcdir)/globals.mak
noinst_LTLIBRARIES = libaudiorecorder.la
libaudiorecorder_la_SOURCES = \
audiorecord.cpp \
audiorecorder.cpp
\ No newline at end of file
/*
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 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.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#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 ", bufPointer_);
printf ("AudioDSP::getRMS() : %i ", data);
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 ", i);
rms += (float) (circBuffer_[i]*circBuffer_[i]);
}
rms = sqrt (rms / (float) bufferLength_);
// printf("AudioDSP::computeRMS() : RMS VALUE: %f ", rms);
return rms;
}
/*
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 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.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#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
Supports Markdown
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