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
477ec6f4
Commit
477ec6f4
authored
16 years ago
by
alexandresavard
Browse files
Options
Downloads
Patches
Plain Diff
Overload AudioRecord::recData to get mic and speaker data mixed
parent
f1b2fd9b
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/audio/audiortp.cpp
+1
-1
1 addition, 1 deletion
src/audio/audiortp.cpp
src/plug-in/audiorecorder/audiorecord.cpp
+43
-0
43 additions, 0 deletions
src/plug-in/audiorecorder/audiorecord.cpp
src/plug-in/audiorecorder/audiorecord.h
+20
-1
20 additions, 1 deletion
src/plug-in/audiorecorder/audiorecord.h
with
64 additions
and
2 deletions
src/audio/audiortp.cpp
+
1
−
1
View file @
477ec6f4
...
@@ -437,7 +437,7 @@ AudioRtpRTX::run () {
...
@@ -437,7 +437,7 @@ AudioRtpRTX::run () {
receiveSessionForSpkr
(
countTime
);
receiveSessionForSpkr
(
countTime
);
// Let's wait for the next transmit cycle
// Let's wait for the next transmit cycle
recAudio
.
recData
(
spkrDataConverted
,
_nSamplesSpkr
);
recAudio
.
recData
(
spkrDataConverted
,
micData
,
_nSamplesSpkr
,
_nSamplesMic
);
Thread
::
sleep
(
TimerPort
::
getTimer
());
Thread
::
sleep
(
TimerPort
::
getTimer
());
TimerPort
::
incTimer
(
_layerFrameSize
);
// 'frameSize' ms
TimerPort
::
incTimer
(
_layerFrameSize
);
// 'frameSize' ms
...
...
This diff is collapsed.
Click to expand it.
src/plug-in/audiorecorder/audiorecord.cpp
+
43
−
0
View file @
477ec6f4
...
@@ -180,3 +180,46 @@ void AudioRecord::recData(SFLDataFormat* buffer, int nSamples) {
...
@@ -180,3 +180,46 @@ void AudioRecord::recData(SFLDataFormat* buffer, int nSamples) {
return
;
return
;
}
}
void
AudioRecord
::
recData
(
SFLDataFormat
*
buffer_1
,
SFLDataFormat
*
buffer_2
,
int
nSamples_1
,
int
nSamples_2
)
{
if
(
fp
==
0
){
_debug
(
"AudioRecord: Can't record data, a file has not yet been opened!
\n
"
);
return
;
}
mixBuffer_
=
new
SFLDataFormat
[
nSamples_1
];
// int size = nSamples * (sizeof(SFLDataFormat));
// int size = sizeof(buffer);
// int count = sizeof(buffer) / sizeof(SFLDataFormat);
// printf("AudioRecord : sizeof(buffer) : %d \n",size);
// printf("AudioRecord : sizeof(buffer) / sizeof(SFLDataFormat) : %d \n",count);
// printf("AudioRecord : nSamples : %d \n",nSamples);
// printf("AudioRecord : buffer: %x : ", buffer);
if
(
sndFormat_
==
INT16
)
{
// TODO change INT16 to SINT16
for
(
int
k
=
0
;
k
<
nSamples_1
;
k
++
){
mixBuffer_
[
k
]
=
(
buffer_1
[
k
]
+
buffer_2
[
k
])
/
2
;
if
(
fwrite
(
&
buffer_1
[
k
],
2
,
1
,
fp
)
!=
1
)
_debug
(
"AudioRecord: Could not record data!
\n
"
);
else
{
// printf("Buffer : %x \n",*buffer);
fflush
(
fp
);
// _debug("Flushing!\n");
}
}
}
byteCounter_
+=
(
unsigned
long
)(
nSamples_1
*
sizeof
(
SFLDataFormat
));
delete
[]
mixBuffer_
;
return
;
}
This diff is collapsed.
Click to expand it.
src/plug-in/audiorecorder/audiorecord.h
+
20
−
1
View file @
477ec6f4
...
@@ -75,7 +75,16 @@ public:
...
@@ -75,7 +75,16 @@ public:
* @param buffer The data chunk to be recorded
* @param buffer The data chunk to be recorded
* @param nSamples Number of samples (number of bytes) to be recorded
* @param nSamples Number of samples (number of bytes) to be recorded
*/
*/
void
recData
(
SFLDataFormat
*
buffer
,
int
nSamples
);
// TODO ad the data to rec
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:
protected:
...
@@ -94,6 +103,11 @@ protected:
...
@@ -94,6 +103,11 @@ protected:
*/
*/
void
closeWavFile
();
void
closeWavFile
();
/**
* Given two buffers, return one mixed audio buffer
*/
void
mixBuffers
(
SFLDataFormat
*
buffer_1
,
SFLDataFormat
*
buffer_2
,
int
nSamples_1
,
int
nSamples_2
);
/**
/**
* Pointer to the recorded file
* Pointer to the recorded file
*/
*/
...
@@ -124,4 +138,9 @@ protected:
...
@@ -124,4 +138,9 @@ protected:
*/
*/
int
sndSmplRate_
;
int
sndSmplRate_
;
/**
* Buffer used for mixing two channels
*/
SFLDataFormat
*
mixBuffer_
;
};
};
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