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

[#2165] Fix inclusion errors for audio recorder

parent 70ccd93d
......@@ -61,7 +61,6 @@ AC_CONFIG_FILES([Makefile])
src/audio/codecs/Makefile \
src/config/Makefile \
src/dbus/Makefile \
src/plug-in/audiorecorder/Makefile \
src/plug-in/Makefile \
src/plug-in/test/Makefile \
src/hooks/Makefile \
......
......@@ -93,7 +93,6 @@ libsflphone_la_LIBADD = \
./dbus/libdbus.la \
./config/libconfig.la \
./plug-in/libplugin.la \
./plug-in/audiorecorder/libaudiorecorder.la \
./hooks/libhooks.la \
./history/libhistory.la
......
......@@ -12,6 +12,8 @@ libaudio_la_SOURCES = \
audioloop.cpp \
ringbuffer.cpp \
mainbuffer.cpp \
audiorecord.cpp \
audiorecorder.cpp \
recordable.cpp \
audiolayer.cpp \
audiodevice.cpp \
......@@ -28,9 +30,11 @@ noinst_HEADERS = \
audioloop.h \
common.h \
ringbuffer.h \
mainbuffer.h \
audiorecord.h \
audiorecorder.h \
audiolayer.h \
audiodevice.h \
mainbuffer.h \
recordable.h \
algorithm.h \
delaydetection.h \
......
......@@ -4,5 +4,5 @@ noinst_LTLIBRARIES = libalsalayer.la
libalsalayer_la_SOURCES = alsalayer.cpp
noinst_HEADERS = alsalayer.h
noinst_HEADERS = alsalayer.h
......@@ -37,20 +37,17 @@
#include "audiodevice.h"
#include "ringbuffer.h"
#include "mainbuffer.h"
#include <cc++/thread.h> // for ost::Mutex
#include "dcblocker.h"
#include "speexechocancel.h"
#include "echocancel.h"
#include <cc++/thread.h> // for ost::Mutex
/**
* @file audiolayer.h
* @brief Main sound class. Manages the data transfers between the application and the hardware.
*/
class Recordable;
class ManagerImpl;
class AudioLayer {
......
......@@ -36,10 +36,7 @@
#include <stdlib.h>
#include <sstream>
#include "plug-in/plugin.h"
// #include "audiodsp.h"
// class AudioDSP;
#include "global.h"
using namespace std;
......
......@@ -44,8 +44,16 @@ AudioRecorder::AudioRecorder (AudioRecord *arec)
*/
void AudioRecorder::run (void)
{
/*
while(true) {
SFLDataFormat buffer[10000];
_debug("Audiorecord");
sleep(1);
}
*/
// SFLDataFormat buffer[10000];
// int availBytes = mbuffer->availForGet(recorderId);
......
......@@ -35,6 +35,8 @@
#include "audiorecord.h"
#include <string>
class MainBuffer;
class AudioRecorder : public ost::Thread {
public:
......@@ -50,10 +52,10 @@ class AudioRecorder : public ost::Thread {
AudioRecorder (const AudioRecorder& ar);
AudioRecorder& operator=(const AudioRecorder& ar);
// MainBuffer *mbuffer;
std::string recorderId;
MainBuffer *mbuffer;
AudioRecord *arecord;
};
......
......@@ -37,12 +37,10 @@
#include <cc++/thread.h> // for ost::Mutex
#include <string>
#include "../global.h"
#include "../call.h"
#include "global.h"
#include "call.h"
#include "ringbuffer.h"
typedef std::map<CallID, RingBuffer*> RingBufferMap;
typedef std::set<CallID> CallIDSet;
......
......@@ -29,7 +29,6 @@
#include "recordable.h"
#include "manager.h"
#include "mainbuffer.h"
Recordable::Recordable() : recorder(&recAudio)
{
......
......@@ -30,8 +30,8 @@
#ifndef RECORDABLE_H
#define RECORDABLE_H
#include "../plug-in/audiorecorder/audiorecord.h"
#include "../plug-in/audiorecorder/audiorecorder.h"
#include "audiorecord.h"
#include "audiorecorder.h"
class Recordable {
......@@ -41,14 +41,30 @@ class Recordable {
~Recordable();
/**
* Return recording state (true/false)
*/
bool isRecording(){ return recAudio.isRecording(); }
/**
* This method must be implemented for this interface as calls and conferences
* have different behavior.
*/
virtual bool setRecording() = 0;
/**
* Stop recording
*/
void stopRecording(){ recAudio.stopRecording(); }
/**
* Init the recording file name according to path specified in configuration
*/
void initRecFileName();
/**
* Set recording sampling rate.
*/
void setRecordingSmplRate(int smplRate);
virtual std::string getRecFileId() = 0;
......@@ -64,11 +80,6 @@ class Recordable {
AudioRecorder recorder;
private:
/** File name for his call : time YY-MM-DD */
// std::string _filename;
};
#endif
......@@ -35,7 +35,6 @@
#include <cc++/thread.h> // for mutex
#include <sstream>
// #include "plug-in/audiorecorder/audiorecord.h"
#include "audio/recordable.h"
#define SIP_SCHEME "sip:"
......
include ../../globals.mak
SUBDIRS=audiorecorder test
SUBDIRS=test
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
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