Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
fb2671d0
Commit
fb2671d0
authored
12 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
* #9897: audiorecord: cleanup, removed unused methods
parent
23193485
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
daemon/src/audio/audiorecord.cpp
+6
-66
6 additions, 66 deletions
daemon/src/audio/audiorecord.cpp
daemon/src/audio/audiorecord.h
+1
-26
1 addition, 26 deletions
daemon/src/audio/audiorecord.h
daemon/src/fileutils.cpp
+1
-1
1 addition, 1 deletion
daemon/src/fileutils.cpp
with
8 additions
and
93 deletions
daemon/src/audio/audiorecord.cpp
+
6
−
66
View file @
fb2671d0
...
...
@@ -80,8 +80,8 @@ void AudioRecord::setRecordingOption(FILE_TYPE type, int sndSmplRate, const std:
std
::
stringstream
s
;
std
::
string
filePath
;
// use HOME directory if path is empty,
n
or does not exist
if
(
path
.
empty
()
||
!
fileutils
::
check_dir
(
path
.
c_str
()))
{
// use HOME directory if path is empty, or
if path
does not exist
if
(
path
.
empty
()
||
!
fileutils
::
check_dir
(
path
.
c_str
()))
{
s
<<
getenv
(
"HOME"
);
filePath
=
s
.
str
();
}
...
...
@@ -124,8 +124,6 @@ bool AudioRecord::openFile()
{
bool
result
=
false
;
DEBUG
(
"AudioRecord: Open file()"
);
if
(
not
fileExists
())
{
DEBUG
(
"AudioRecord: Filename does not exist, creating one"
);
byteCounter_
=
0
;
...
...
@@ -170,24 +168,14 @@ bool AudioRecord::isRecording() const
return
recordingEnabled_
;
}
bool
AudioRecord
::
setRecording
()
void
AudioRecord
::
setRecording
()
{
if
(
isOpenFile
())
{
if
(
!
recordingEnabled_
)
{
DEBUG
(
"AudioRecording: Start recording"
);
recordingEnabled_
=
true
;
}
else
{
DEBUG
(
"AudioRecording: Stop recording"
);
recordingEnabled_
=
false
;
}
recordingEnabled_
=
!
recordingEnabled_
;
}
else
{
openFile
();
recordingEnabled_
=
true
;
// once opend file, start recording
}
// WARNING: Unused return value
return
true
;
}
void
AudioRecord
::
stopRecording
()
...
...
@@ -198,12 +186,8 @@ void AudioRecord::stopRecording()
void
AudioRecord
::
createFilename
()
{
time_t
rawtime
;
struct
tm
*
timeinfo
;
rawtime
=
time
(
NULL
);
timeinfo
=
localtime
(
&
rawtime
);
time_t
rawtime
=
time
(
NULL
);
struct
tm
*
timeinfo
=
localtime
(
&
rawtime
);
std
::
stringstream
out
;
...
...
@@ -408,27 +392,6 @@ void AudioRecord::closeWavFile()
WARN
(
"AudioRecord: Error: can't close file"
);
}
void
AudioRecord
::
recSpkrData
(
SFLDataFormat
*
buffer
,
int
nSamples
)
{
if
(
recordingEnabled_
)
{
nbSamplesMic_
=
nSamples
;
for
(
int
i
=
0
;
i
<
nbSamplesMic_
;
i
++
)
micBuffer_
[
i
]
=
buffer
[
i
];
}
}
void
AudioRecord
::
recMicData
(
SFLDataFormat
*
buffer
,
int
nSamples
)
{
if
(
recordingEnabled_
)
{
nbSamplesSpk_
=
nSamples
;
for
(
int
i
=
0
;
i
<
nbSamplesSpk_
;
i
++
)
spkBuffer_
[
i
]
=
buffer
[
i
];
}
}
void
AudioRecord
::
recData
(
SFLDataFormat
*
buffer
,
int
nSamples
)
{
if
(
recordingEnabled_
)
{
...
...
@@ -445,26 +408,3 @@ void AudioRecord::recData(SFLDataFormat* buffer, int nSamples)
}
}
}
void
AudioRecord
::
recData
(
SFLDataFormat
*
buffer_1
,
SFLDataFormat
*
buffer_2
,
int
nSamples_1
,
int
/*nSamples_2*/
)
{
if
(
recordingEnabled_
)
{
if
(
fileHandle_
==
0
)
{
DEBUG
(
"AudioRecord: Can't record data, a file has not yet been opened!"
);
return
;
}
for
(
int
k
=
0
;
k
<
nSamples_1
;
k
++
)
{
mixBuffer_
[
k
]
=
(
buffer_1
[
k
]
+
buffer_2
[
k
]);
if
(
fwrite
(
&
mixBuffer_
[
k
],
2
,
1
,
fileHandle_
)
!=
1
)
WARN
(
"AudioRecord: Could not record data!"
);
else
fflush
(
fileHandle_
);
}
byteCounter_
+=
(
unsigned
long
)(
nSamples_1
*
sizeof
(
SFLDataFormat
));
}
}
This diff is collapsed.
Click to expand it.
daemon/src/audio/audiorecord.h
+
1
−
26
View file @
fb2671d0
...
...
@@ -90,28 +90,13 @@ class AudioRecord {
/**
* Set recording flag
*/
bool
setRecording
();
void
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
...
...
@@ -119,16 +104,6 @@ class AudioRecord {
*/
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
:
/**
...
...
This diff is collapsed.
Click to expand it.
daemon/src/fileutils.cpp
+
1
−
1
View file @
fb2671d0
...
...
@@ -45,7 +45,7 @@ bool check_dir(const char *path)
{
DIR
*
dir
=
opendir
(
path
);
if
(
!
dir
)
{
// doesn't exist
if
(
!
dir
)
{
// doesn't exist
if
(
mkdir
(
path
,
0755
)
!=
0
)
{
// couldn't create the dir
perror
(
path
);
return
false
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment