Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
d8aebd60
Commit
d8aebd60
authored
Feb 02, 2009
by
Emmanuel Milou
Browse files
Restore mic adjust volume on ALSA layer
parent
5220536b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/audio/alsalayer.cpp
View file @
d8aebd60
...
...
@@ -143,6 +143,7 @@ AlsaLayer::getMic(void *buffer, int toCopy)
if
(
_CaptureHandle
)
{
res
=
read
(
buffer
,
toCopy
);
adjustVolume
(
buffer
,
toCopy
,
SFL_PCM_CAPTURE
);
}
return
res
;
}
...
...
@@ -651,3 +652,23 @@ void AlsaLayer::audioCallback (void)
//_debug("AL: Nb sample: %d char, [0]=%f [1]=%f [2]=%f\n", toPut, in[0], in[1], in[2]);
//_micRingBuffer.Put(in, toPut, micVolume);
}
void
*
AlsaLayer
::
adjustVolume
(
void
*
buffer
,
int
len
,
int
stream
)
{
int
vol
,
i
,
size
;
SFLDataFormat
*
src
=
NULL
;
(
stream
==
SFL_PCM_PLAYBACK
)
?
vol
=
_manager
->
getSpkrVolume
()
:
vol
=
_manager
->
getMicVolume
();
src
=
(
SFLDataFormat
*
)
buffer
;
if
(
vol
!=
100
)
{
size
=
len
/
sizeof
(
SFLDataFormat
);
for
(
i
=
0
;
i
<
size
;
i
++
){
src
[
i
]
=
src
[
i
]
*
vol
/
100
;
}
}
return
src
;
}
src/audio/alsalayer.h
View file @
d8aebd60
...
...
@@ -220,6 +220,8 @@ class AlsaLayer : public AudioLayer {
*/
int
read
(
void
*
buffer
,
int
toCopy
);
/**
* Recover from XRUN state for capture
* ALSA Library API
...
...
@@ -232,7 +234,9 @@ class AlsaLayer : public AudioLayer {
*/
void
handle_xrun_playback
(
void
);
/**
void
*
adjustVolume
(
void
*
buffer
,
int
len
,
int
stream
);
/**
* Handles to manipulate playback stream
* ALSA Library API
*/
...
...
src/audio/pulselayer.cpp
View file @
d8aebd60
...
...
@@ -142,7 +142,6 @@ PulseLayer::createStreams( pa_context* c )
record
=
new
AudioStream
(
c
,
CAPTURE_STREAM
,
CAPTURE_STREAM_NAME
,
_manager
->
getMicVolume
());
pa_stream_set_read_callback
(
record
->
pulseStream
()
,
audioCallback
,
this
);
//pa_stream_set_underflow_callback( record->pulseStream() , underflow , this);
//cache = new AudioStream(c, UPLOAD_STREAM, "Cache samples", _manager->getSpkrVolume());
pa_threaded_mainloop_signal
(
m
,
0
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment