Commit c135b1c2 authored by Julien Bonjean's avatar Julien Bonjean

[#2402] Code indent

parent 92ebaec0
This diff is collapsed.
......@@ -2,17 +2,17 @@
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 Savoir-Faire Linux Inc.
* Author: Alexandre Bourget <alexandre.bourget@savoirfairelinux.com>
* Author: Yan Morin <yan.morin@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.
......@@ -39,24 +39,25 @@ class Account;
* @file accountcreator.h
* @brief Create protocol-specific account
*/
class AccountCreator{
public:
~AccountCreator();
/**
* Public account type
*/
enum AccountType {SIP_ACCOUNT, SIP_DIRECT_IP_ACCOUNT, IAX_ACCOUNT };
/**
* Create a new account or null
* @param type type of the account
* @param accountID accountID (must be unique for each account)
*/
static Account* createAccount(AccountType type, AccountID accountID);
class AccountCreator
{
public:
~AccountCreator();
/**
* Public account type
*/
enum AccountType {SIP_ACCOUNT, SIP_DIRECT_IP_ACCOUNT, IAX_ACCOUNT };
/**
* Create a new account or null
* @param type type of the account
* @param accountID accountID (must be unique for each account)
*/
static Account* createAccount (AccountType type, AccountID accountID);
private:
/** Hidden constructor */
AccountCreator();
private:
/** Hidden constructor */
AccountCreator();
};
#endif
......@@ -35,45 +35,46 @@
/**
* \class Algorithm
*
*
* Abstract interface used to implement audio processing algorithm
*/
class Algorithm {
class Algorithm
{
public:
public:
virtual void reset(void) = 0;
virtual void reset (void) = 0;
/**
* Put data to be processed
*/
virtual void putData(SFLDataFormat *inputData, int nbBytes) = 0;
/**
* Put data to be processed
*/
virtual void putData (SFLDataFormat *inputData, int nbBytes) = 0;
/**
*
*/
virtual int getData(SFLDataFormat *outputData) = 0;
/**
*
*/
virtual int getData (SFLDataFormat *outputData) = 0;
/**
* Class implementing this interface must define this function
* for audio processing that require synchronization between spkrdata and
*/
virtual void process(SFLDataFormat *inputData, int nbBytes) = 0;
/**
* Class implementing this interface must define this function
* for audio processing that require synchronization between spkrdata and
*/
virtual void process (SFLDataFormat *inputData, int nbBytes) = 0;
/**
* Class implementing this interface must define this function
* for audio processing that require synchronization between spkrdata and
*/
virtual int process(SFLDataFormat *inputData, SFLDataFormat *outputData, int nbBytes) = 0;
/**
* Class implementing this interface must define this function
* for audio processing that require synchronization between spkrdata and
*/
virtual int process (SFLDataFormat *inputData, SFLDataFormat *outputData, int nbBytes) = 0;
/**
* Class implementing this interface must define this function
* for audio processing that require synchronization between spkr and mic
* \param micData
* \param spkrData
* \param outputData
*/
virtual void process(SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes) = 0;
/**
* Class implementing this interface must define this function
* for audio processing that require synchronization between spkr and mic
* \param micData
* \param spkrData
* \param outputData
*/
virtual void process (SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes) = 0;
};
......
This diff is collapsed.
......@@ -6,12 +6,12 @@
* 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.
......@@ -40,57 +40,66 @@
* @brief Container device for attribute storage
* Have almost only get/set method
*/
class AudioDevice {
public:
/**
* Constructor
* @param id Identifier
* @param name Name
*/
AudioDevice(int id, const std::string& name);
/**
* Destructor
*/
~AudioDevice();
/** Default sample rate */
const static double DEFAULT_RATE;
/**
* Read accessor to the ID
* @return int The ID of the audiodevice
*/
int getId() { return _id; }
/**
* Read accessor to the name
* @return std::string& A string description
*/
const std::string& getName() {return _name; }
/**
* Write accessor to the sample rate
* @param rate The sample rate
*/
void setRate(double rate) { _rate = rate;}
/**
* Read accessor to the sample rate
* @return double The sample rate
*/
double getRate() { return _rate; }
private:
/** Integer id of the device, can not be 0 */
int _id;
/** Name of the device */
std::string _name;
/** Default rate in Hz, like 8000.0, default is AudioDevice::DEFAULT_RATE */
double _rate;
class AudioDevice
{
public:
/**
* Constructor
* @param id Identifier
* @param name Name
*/
AudioDevice (int id, const std::string& name);
/**
* Destructor
*/
~AudioDevice();
/** Default sample rate */
const static double DEFAULT_RATE;
/**
* Read accessor to the ID
* @return int The ID of the audiodevice
*/
int getId() {
return _id;
}
/**
* Read accessor to the name
* @return std::string& A string description
*/
const std::string& getName() {
return _name;
}
/**
* Write accessor to the sample rate
* @param rate The sample rate
*/
void setRate (double rate) {
_rate = rate;
}
/**
* Read accessor to the sample rate
* @return double The sample rate
*/
double getRate() {
return _rate;
}
private:
/** Integer id of the device, can not be 0 */
int _id;
/** Name of the device */
std::string _name;
/** Default rate in Hz, like 8000.0, default is AudioDevice::DEFAULT_RATE */
double _rate;
};
#endif // _AUDIO_DEVICE_H_
......
This diff is collapsed.
......@@ -2,9 +2,9 @@
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 Savoir-Faire Linux Inc.
* Author: Yan Morin <yan.morin@savoirfairelinux.com>
*
* Inspired by tonegenerator of
* Inspired by tonegenerator of
* Laurielle Lea <laurielle.lea@savoirfairelinux.com> (2004)
*
*
* 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
......@@ -41,60 +41,65 @@
* @brief Loop on a sound file
*/
class AudioLoop {
public:
/**
* Constructor
*/
AudioLoop();
/**
* Virtual destructor
*/
virtual ~AudioLoop();
/**
* Get the next fragment of the tone
* the function change the intern position, and will loop
* @param output The data buffer
* @param nb of int16 to send
* @param volume The volume
* @return the number of int16 sent (nb*2)
*/
int getNext(SFLDataFormat* output, int nb, short volume=100);
/**
* Reset the pointer position
*/
void reset() { _pos = 0; }
/**
* Accessor to the size of the buffer
* @return unsigned int The size
*/
unsigned int getSize() { return _size; }
protected:
/** The data buffer */
SFLDataFormat* _buffer;
/** Number of int16 inside the buffer, not the delay */
int _size;
/** current position, set to 0, when initialize */
int _pos;
/** Sample rate */
int _sampleRate;
private:
// Copy Constructor
AudioLoop(const AudioLoop& rh);
// Assignment Operator
AudioLoop& operator=( const AudioLoop& rh);
class AudioLoop
{
public:
/**
* Constructor
*/
AudioLoop();
/**
* Virtual destructor
*/
virtual ~AudioLoop();
/**
* Get the next fragment of the tone
* the function change the intern position, and will loop
* @param output The data buffer
* @param nb of int16 to send
* @param volume The volume
* @return the number of int16 sent (nb*2)
*/
int getNext (SFLDataFormat* output, int nb, short volume=100);
/**
* Reset the pointer position
*/
void reset() {
_pos = 0;
}
/**
* Accessor to the size of the buffer
* @return unsigned int The size
*/
unsigned int getSize() {
return _size;
}
protected:
/** The data buffer */
SFLDataFormat* _buffer;
/** Number of int16 inside the buffer, not the delay */
int _size;
/** current position, set to 0, when initialize */
int _pos;
/** Sample rate */
int _sampleRate;
private:
// Copy Constructor
AudioLoop (const AudioLoop& rh);
// Assignment Operator
AudioLoop& operator= (const AudioLoop& rh);
};
#endif // __AUDIOLOOP_H__
......
......@@ -35,59 +35,62 @@
#include "algorithm.h"
/**
* Process audio buffers using specified at instantiation which may be
* Process audio buffers using specified at instantiation which may be
* changed dynamically at runtime.
*/
class AudioProcessing {
class AudioProcessing
{
public:
public:
/**
* The constructor for this class
*/
AudioProcessing(Algorithm *_algo);
/**
* The constructor for this class
*/
AudioProcessing (Algorithm *_algo);
~AudioProcessing(void);
~AudioProcessing (void);
/**
* Set a new algorithm to process audio. Algorithm must be a subclass of abstract class Algorithm
*/
void setAlgorithm(Algorithm *_algo) { _algorithm = _algo; }
/**
* Set a new algorithm to process audio. Algorithm must be a subclass of abstract class Algorithm
*/
void setAlgorithm (Algorithm *_algo) {
_algorithm = _algo;
}
/**
* Reset parameters for the algorithm
*/
void resetAlgorithm();
/**
* Reset parameters for the algorithm
*/
void resetAlgorithm();
/**
* Put data in internal buffer
*/
void putData(SFLDataFormat *inputData, int nbBytes);
/**
* Put data in internal buffer
*/
void putData (SFLDataFormat *inputData, int nbBytes);
/**
* Get data from internal buffer
*/
int getData(SFLDataFormat *outputData);
/**
* Get data from internal buffer
*/
int getData (SFLDataFormat *outputData);
/**
* Process some audio data
*/
void processAudio(SFLDataFormat *inputData, int nbBytes);
/**
* Process some audio data
*/
void processAudio (SFLDataFormat *inputData, int nbBytes);
/**
* Process some audio data
*/
int processAudio(SFLDataFormat *inputData, SFLDataFormat *outputData, int nbBytes);
/**
* Process some audio data
*/
int processAudio (SFLDataFormat *inputData, SFLDataFormat *outputData, int nbBytes);
/**
* Process some audio data.
*/
void processAudio(SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes);
/**
* Process some audio data.
*/
void processAudio (SFLDataFormat *micData, SFLDataFormat *spkrData, SFLDataFormat *outputData, int nbBytes);
private:
private:
Algorithm *_algorithm;
Algorithm *_algorithm;
};
......
......@@ -45,196 +45,196 @@ typedef std::string CallID;
class AudioRecord
{
public:
AudioRecord();
~AudioRecord();
void setSndSamplingRate(int smplRate);
void setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path);
void initFileName( std::string peerNumber );
/**
* Check if no otehr file is opened, then create a new one
* @param fileName A string containing teh file (with/without extension)
* @param type The sound file format (FILE_RAW, FILE_WAVE)
* @param format Internal sound format (INT16 / INT32)
*/
void openFile();
/**
* Close the opend recording file. If wave: cout the number of byte
*/
void closeFile();
/**
* Check if a file is already opened
*/
bool isOpenFile();
/**
* Check if a file already exist
*/
bool isFileExist();
/**
* Check recording state
*/
bool isRecording();
/**
* Set recording flag
*/
bool setRecording();
/**
* Stop recording flag
*/
void stopRecording();
/**
* Record a chunk of data in an internal buffer
* @param buffer The data chunk to be recorded
* @param nSamples Number of samples (number of bytes) to be recorded
*/
void recSpkrData(SFLDataFormat* buffer, int nSamples);
/**
* Record a chunk of data in an internal buffer
* @param buffer The data chunk to be recorded
* @param nSamples Number of samples (number of bytes) to be recorded
*/
void recMicData(SFLDataFormat* buffer, int nSamples);
/**
* Record a chunk of data in an openend file
* @param buffer The data chunk to be recorded
* @param nSamples Number of samples (number of bytes) to be recorded
*/
void recData(SFLDataFormat* buffer, int nSamples);
/**
* Record a chunk of data in an openend file, Mix two differnet buffer
* @param buffer_1 The first data chunk to be recorded
* @param buffer_2 The second data chunk to be recorded
* @param nSamples_1 Number of samples (number of bytes) of buffer_1
* @param nSamples_2 Number of samples (number of bytes) of buffer_2
*/
void recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int nSamples_1, int nSamples_2);
protected:
/**
* Create name file according to current date
*/
void createFilename();
/**
* Set the header for raw files
*/
bool setRawFile();
/**
* Set the header for wave files
*/
bool setWavFile();
/**
* Open an existing raw file, used when the call is set on hold
*/
bool openExistingRawFile();
/**
* Open an existing wav file, used when the call is set on hold
*/
bool openExistingWavFile();
/**
* Compute the number of byte recorded and close the file
*/
void closeWavFile();
/**
* Pointer to the recorded file
*/
FILE *fp; //file pointer
/**
* File format (RAW / WAVE)
*/
FILE_TYPE fileType_;
/**
* Sound format (SINT16/SINT32)
*/
SOUND_FORMAT sndFormat_;
/**
* Number of channels
*/
int channels_;
/**
* Number of byte recorded
*/
unsigned long byteCounter_;
/**
* Sampling rate
*/
int sndSmplRate_;
/**
* number of samples recorded for mic buffer
*/
int nbSamplesMic_;
/**
* number of samples recorded for speaker buffer
*/
int nbSamplesSpk_;
/**
* Maximum number of samples
*/
int nbSamplesMax_;
/**
* Recording flage
*/
bool recordingEnabled_;
/**
* Buffer used for mixing two channels
*/
SFLDataFormat* mixBuffer_;
/**
* Buffer used to copy mic info
*/
SFLDataFormat* micBuffer_;
/**
* Buffer used to copy spkr info
*/
SFLDataFormat* spkBuffer_;
/**
* Filename for this recording
*/
char fileName_[8192];
/**
* Path for this recording
*/
std::string savePath_;
public:
AudioRecord();