2
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 Savoir-Faire Linux Inc.
3
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 3 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
* Additional permission under GNU GPL version 3 section 7:
21
* If you modify this program, or any covered work, by linking or
22
* combining it with the OpenSSL project's OpenSSL library (or a
23
* modified version of that library), containing parts covered by the
24
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
25
* grants you additional permission to convey the resulting work.
26
* Corresponding Source for a non-source form of such a combination
27
* shall include the source code for the parts of OpenSSL used as well
28
* as that of the covered work.
31
#ifndef _AUDIO_RECORD_H
32
#define _AUDIO_RECORD_H
39
#include "plug-in/plugin.h"
40
// #include "audiodsp.h"
46
typedef std::string CallID;
57
void setSndSamplingRate(int smplRate);
59
void setRecordingOption(FILE_TYPE type, SOUND_FORMAT format, int sndSmplRate, std::string path);
61
void initFileName( std::string peerNumber );
64
* Check if no otehr file is opened, then create a new one
65
* @param fileName A string containing teh file (with/without extension)
66
* @param type The sound file format (FILE_RAW, FILE_WAVE)
67
* @param format Internal sound format (INT16 / INT32)
72
* Close the opend recording file. If wave: cout the number of byte
77
* Check if a file is already opened
82
* Check if a file already exist
87
* Check recording state
103
* Record a chunk of data in an internal buffer
104
* @param buffer The data chunk to be recorded
105
* @param nSamples Number of samples (number of bytes) to be recorded
107
void recSpkrData(SFLDataFormat* buffer, int nSamples);
110
* Record a chunk of data in an internal buffer
111
* @param buffer The data chunk to be recorded
112
* @param nSamples Number of samples (number of bytes) to be recorded
114
void recMicData(SFLDataFormat* buffer, int nSamples);
117
* Record a chunk of data in an openend file
118
* @param buffer The data chunk to be recorded
119
* @param nSamples Number of samples (number of bytes) to be recorded
121
void recData(SFLDataFormat* buffer, int nSamples);
124
* Record a chunk of data in an openend file, Mix two differnet buffer
125
* @param buffer_1 The first data chunk to be recorded
126
* @param buffer_2 The second data chunk to be recorded
127
* @param nSamples_1 Number of samples (number of bytes) of buffer_1
128
* @param nSamples_2 Number of samples (number of bytes) of buffer_2
130
void recData(SFLDataFormat* buffer_1, SFLDataFormat* buffer_2, int nSamples_1, int nSamples_2);
136
* Create name file according to current date
138
void createFilename();
141
* Set the header for raw files
146
* Set the header for wave files
151
* Open an existing raw file, used when the call is set on hold
153
bool openExistingRawFile();
156
* Open an existing wav file, used when the call is set on hold
158
bool openExistingWavFile();
161
* Compute the number of byte recorded and close the file
167
* Pointer to the recorded file
169
FILE *fp; //file pointer
172
* File format (RAW / WAVE)
177
* Sound format (SINT16/SINT32)
179
SOUND_FORMAT sndFormat_;
187
* Number of byte recorded
189
unsigned long byteCounter_;
197
* number of samples recorded for mic buffer
202
* number of samples recorded for speaker buffer
207
* Maximum number of samples
214
bool recordingEnabled_;
217
* Buffer used for mixing two channels
219
SFLDataFormat* mixBuffer_;
222
* Buffer used to copy mic info
224
SFLDataFormat* micBuffer_;
227
* Buffer used to copy spkr info
229
SFLDataFormat* spkBuffer_;
232
* Filename for this recording
234
char fileName_[8192];
237
* Path for this recording
239
std::string savePath_;
243
#endif // _AUDIO_RECORD_H