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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
6525ae76
Commit
6525ae76
authored
Mar 10, 2008
by
Emmanuel Milou
Browse files
Options
Downloads
Patches
Plain Diff
Volume controlled by application + return of the ringtones
//TODO Improve the ringtones quality
parent
a3055685
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/audio/audiofile.cpp
+2
-0
2 additions, 0 deletions
src/audio/audiofile.cpp
src/audio/audiolayer.cpp
+102
-45
102 additions, 45 deletions
src/audio/audiolayer.cpp
src/audio/audiolayer.h
+3
-1
3 additions, 1 deletion
src/audio/audiolayer.h
src/managerimpl.cpp
+20
-20
20 additions, 20 deletions
src/managerimpl.cpp
with
127 additions
and
66 deletions
src/audio/audiofile.cpp
+
2
−
0
View file @
6525ae76
...
@@ -56,6 +56,8 @@ AudioFile::loadFile(const std::string& filename, AudioCodec* codec , unsigned in
...
@@ -56,6 +56,8 @@ AudioFile::loadFile(const std::string& filename, AudioCodec* codec , unsigned in
_pos
=
0
;
_pos
=
0
;
}
}
// no filename to load
// no filename to load
if
(
filename
.
empty
())
{
if
(
filename
.
empty
())
{
_debug
(
"Unable to open audio file: filename is empty
\n
"
);
_debug
(
"Unable to open audio file: filename is empty
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
src/audio/audiolayer.cpp
+
102
−
45
View file @
6525ae76
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
,
_CaptureHandle
(
NULL
)
,
_CaptureHandle
(
NULL
)
,
deviceClosed
(
true
)
,
deviceClosed
(
true
)
,
_urgentBuffer
(
SIZEBUF
)
,
_urgentBuffer
(
SIZEBUF
)
,
_fstream
(
"/truc/audio.dat"
)
{
{
_inChannel
=
1
;
// don't put in stereo
_inChannel
=
1
;
// don't put in stereo
...
@@ -58,6 +59,8 @@ AudioLayer::~AudioLayer (void)
...
@@ -58,6 +59,8 @@ AudioLayer::~AudioLayer (void)
closeCaptureStream
();
closeCaptureStream
();
closePlaybackStream
();
closePlaybackStream
();
deviceClosed
=
true
;
deviceClosed
=
true
;
_fstream
.
flush
();
_fstream
.
close
();
}
}
...
@@ -103,9 +106,10 @@ AudioLayer::openDevice (int indexIn, int indexOut, int sampleRate, int frameSize
...
@@ -103,9 +106,10 @@ AudioLayer::openDevice (int indexIn, int indexOut, int sampleRate, int frameSize
void
void
AudioLayer
::
startStream
(
void
)
AudioLayer
::
startStream
(
void
)
{
{
_talk
=
true
;
_debugAlsa
(
" Start stream
\n
"
);
_debugAlsa
(
" Start stream
\n
"
);
int
err
;
int
err
;
ost
::
MutexLock
lock
(
_mutex
);
//
ost::MutexLock lock( _mutex );
snd_pcm_prepare
(
_CaptureHandle
);
snd_pcm_prepare
(
_CaptureHandle
);
snd_pcm_start
(
_CaptureHandle
)
;
snd_pcm_start
(
_CaptureHandle
)
;
...
@@ -116,7 +120,7 @@ AudioLayer::startStream(void)
...
@@ -116,7 +120,7 @@ AudioLayer::startStream(void)
void
void
AudioLayer
::
stopStream
(
void
)
AudioLayer
::
stopStream
(
void
)
{
{
ost
::
MutexLock
lock
(
_mutex
);
//
ost::MutexLock lock( _mutex );
_talk
=
false
;
_talk
=
false
;
snd_pcm_drop
(
_CaptureHandle
);
snd_pcm_drop
(
_CaptureHandle
);
snd_pcm_prepare
(
_CaptureHandle
);
snd_pcm_prepare
(
_CaptureHandle
);
...
@@ -143,7 +147,7 @@ AudioLayer::fillHWBuffer( void)
...
@@ -143,7 +147,7 @@ AudioLayer::fillHWBuffer( void)
unsigned
char
*
data
;
unsigned
char
*
data
;
int
pcmreturn
,
l1
,
l2
;
int
pcmreturn
,
l1
,
l2
;
short
s1
,
s2
;
short
s1
,
s2
;
int
periodSize
=
1
024
;
int
periodSize
=
1
28
;
int
frames
=
periodSize
>>
2
;
int
frames
=
periodSize
>>
2
;
data
=
(
unsigned
char
*
)
malloc
(
periodSize
);
data
=
(
unsigned
char
*
)
malloc
(
periodSize
);
...
@@ -158,10 +162,9 @@ AudioLayer::fillHWBuffer( void)
...
@@ -158,10 +162,9 @@ AudioLayer::fillHWBuffer( void)
}
}
while
((
pcmreturn
=
snd_pcm_writei
(
_PlaybackHandle
,
data
,
frames
))
<
0
)
{
while
((
pcmreturn
=
snd_pcm_writei
(
_PlaybackHandle
,
data
,
frames
))
<
0
)
{
snd_pcm_prepare
(
_PlaybackHandle
);
snd_pcm_prepare
(
_PlaybackHandle
);
_debugAlsa
(
"< Buffer Underrun >
\n
"
);
//
_debugAlsa("< Buffer Underrun >\n");
}
}
}
}
}
}
bool
bool
...
@@ -175,10 +178,10 @@ AudioLayer::isStreamActive (void)
...
@@ -175,10 +178,10 @@ AudioLayer::isStreamActive (void)
int
int
AudioLayer
::
playSamples
(
void
*
buffer
,
int
toCopy
)
AudioLayer
::
playSamples
(
void
*
buffer
,
int
toCopy
)
{
{
ost
::
MutexLock
lock
(
_mutex
);
//
ost::MutexLock lock( _mutex );
_talk
=
true
;
_talk
=
true
;
if
(
_PlaybackHandle
){
if
(
_PlaybackHandle
){
write
(
buffer
,
toCopy
);
write
(
adjustVolume
(
buffer
,
toCopy
,
SFL_PCM_PLAYBACK
)
,
toCopy
);
}
}
return
0
;
return
0
;
}
}
...
@@ -186,10 +189,8 @@ AudioLayer::playSamples(void* buffer, int toCopy)
...
@@ -186,10 +189,8 @@ AudioLayer::playSamples(void* buffer, int toCopy)
int
int
AudioLayer
::
putUrgent
(
void
*
buffer
,
int
toCopy
)
AudioLayer
::
putUrgent
(
void
*
buffer
,
int
toCopy
)
{
{
//snd_pcm_avail_update
( _PlaybackHandle )
;
if
(
_PlaybackHandle
)
{
fillHWBuffer
();
fillHWBuffer
();
if
(
_PlaybackHandle
)
{
int
a
=
_urgentBuffer
.
AvailForPut
();
int
a
=
_urgentBuffer
.
AvailForPut
();
if
(
a
>=
toCopy
){
if
(
a
>=
toCopy
){
return
_urgentBuffer
.
Put
(
buffer
,
toCopy
,
_defaultVolume
);
return
_urgentBuffer
.
Put
(
buffer
,
toCopy
,
_defaultVolume
);
...
@@ -219,10 +220,13 @@ AudioLayer::canGetMic()
...
@@ -219,10 +220,13 @@ AudioLayer::canGetMic()
int
int
AudioLayer
::
getMic
(
void
*
buffer
,
int
toCopy
)
AudioLayer
::
getMic
(
void
*
buffer
,
int
toCopy
)
{
{
int
res
=
0
;
if
(
_CaptureHandle
)
if
(
_CaptureHandle
)
return
read
(
buffer
,
toCopy
);
{
else
res
=
read
(
buffer
,
toCopy
);
return
0
;
adjustVolume
(
buffer
,
toCopy
,
SFL_PCM_CAPTURE
);
}
return
res
;
}
}
...
@@ -249,20 +253,37 @@ AudioLayer::toggleEchoTesting() {
...
@@ -249,20 +253,37 @@ AudioLayer::toggleEchoTesting() {
void
void
AudioLayer
::
playUrgent
(
void
)
AudioLayer
::
playUrgent
(
void
)
{
{
int
maxBytes
=
1024
*
sizeof
(
SFLDataFormat
)
;
int
toGet
;
int
toGet
;
int
bytes
=
1024
*
sizeof
(
SFLDataFormat
);
if
(
_talk
)
{}
//_debug("Stop Callback\n");
SFLDataFormat
toWrite
[
bytes
];
else
{
int
urgentAvail
=
_urgentBuffer
.
AvailForGet
();
/*int avail = _urgentBuffer.AvailForGet();
if
(
_talk
)
{
_debug("callback %d\n" , avail );
_urgentBuffer
.
Discard
(
urgentAvail
);
if( avail > 0 ){
toGet = ( avail < maxBytes)? avail : maxBytes ;
_urgentBuffer.Get( out , toGet , 100 );
write( out , toGet );
}
}
else{
else{
//_debugAlsa("Callback !!!!!!!!\n");
//loop( out , maxBytes );
urgentAvail
=
_urgentBuffer
.
AvailForGet
();
AudioLoop *tone = _manager -> getTelephoneTone();
if
(
urgentAvail
>
bytes
){
if( tone != 0 ){
toGet
=
(
urgentAvail
<
bytes
)
?
urgentAvail
:
bytes
;
tone -> getNext( out , maxBytes , 10 );
_urgentBuffer
.
Get
(
toWrite
,
toGet
,
100
);
write( out , maxBytes );
write
(
toWrite
,
bytes
);
}
}
*/
AudioLoop
*
tone
=
_manager
->
getTelephoneTone
();
int
spkrVol
=
_manager
->
getSpkrVolume
();
SFLDataFormat
out
[
maxBytes
];
if
(
tone
!=
0
){
tone
->
getNext
(
out
,
maxBytes
,
spkrVol
);
write
(
out
,
maxBytes
);
}
else
if
(
(
tone
=
_manager
->
getTelephoneFile
())
!=
0
){
tone
->
getNext
(
out
,
maxBytes
,
spkrVol
);
write
(
out
,
maxBytes
);
}
}
}
}
}
}
...
@@ -296,10 +317,10 @@ AudioLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
...
@@ -296,10 +317,10 @@ AudioLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
int
dir
=
0
;
int
dir
=
0
;
snd_pcm_uframes_t
period_size_in
=
getFrameSize
()
*
getSampleRate
()
/
1000
;
snd_pcm_uframes_t
period_size_in
=
getFrameSize
()
*
getSampleRate
()
/
1000
;
snd_pcm_uframes_t
buffer_size_in
=
4096
;
snd_pcm_uframes_t
buffer_size_in
=
4096
;
snd_pcm_uframes_t
threshold
=
getFrameSize
()
*
getSampleRate
()
/
1000
;
snd_pcm_uframes_t
threshold
=
getFrameSize
()
*
getSampleRate
()
/
1000
*
2
;
snd_pcm_uframes_t
period_size_out
=
1024
;
snd_pcm_uframes_t
period_size_out
=
1024
;
//getFrameSize() * getSampleRate() / 1000 * 2 ;//
1024 ;
unsigned
int
period_time
=
20
;
unsigned
int
period_time
=
20
;
snd_pcm_uframes_t
buffer_size_out
=
4096
;
snd_pcm_uframes_t
buffer_size_out
=
period_size_out
*
4
;
snd_pcm_sw_params_t
*
swparams
=
NULL
;
snd_pcm_sw_params_t
*
swparams
=
NULL
;
if
(
flag
==
SFL_PCM_BOTH
||
flag
==
SFL_PCM_CAPTURE
)
if
(
flag
==
SFL_PCM_BOTH
||
flag
==
SFL_PCM_CAPTURE
)
...
@@ -331,7 +352,7 @@ AudioLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
...
@@ -331,7 +352,7 @@ AudioLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
{
{
_debugAlsa
(
" Opening playback device %s
\n
"
,
pcm_p
.
c_str
());
_debugAlsa
(
" Opening playback device %s
\n
"
,
pcm_p
.
c_str
());
if
(
err
=
snd_pcm_open
(
&
_PlaybackHandle
,
pcm_p
.
c_str
(),
SND_PCM_STREAM_PLAYBACK
,
0
)
<
0
){
if
(
err
=
snd_pcm_open
(
&
_PlaybackHandle
,
pcm_p
.
c_str
(),
SND_PCM_STREAM_PLAYBACK
,
SND_PCM_NONBLOCK
)
<
0
){
_debugAlsa
(
" Error while opening playback device %s (%s)
\n
"
,
pcm_p
.
c_str
(),
snd_strerror
(
err
));
_debugAlsa
(
" Error while opening playback device %s (%s)
\n
"
,
pcm_p
.
c_str
(),
snd_strerror
(
err
));
return
false
;
return
false
;
}
}
...
@@ -353,11 +374,11 @@ AudioLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
...
@@ -353,11 +374,11 @@ AudioLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
snd_pcm_sw_params_malloc
(
&
swparams
);
snd_pcm_sw_params_malloc
(
&
swparams
);
snd_pcm_sw_params_current
(
_PlaybackHandle
,
swparams
);
snd_pcm_sw_params_current
(
_PlaybackHandle
,
swparams
);
if
(
err
=
snd_pcm_sw_params_set_start_threshold
(
_PlaybackHandle
,
swparams
,
val
)
<
0
)
_debugAlsa
(
" Cannot set start threshold (%s)
\n
"
,
snd_strerror
(
err
));
if
(
err
=
snd_pcm_sw_params_set_start_threshold
(
_PlaybackHandle
,
swparams
,
threshold
)
<
0
)
_debugAlsa
(
" Cannot set start threshold (%s)
\n
"
,
snd_strerror
(
err
));
if
(
err
=
snd_pcm_sw_params_set_stop_threshold
(
_PlaybackHandle
,
swparams
,
buffer_size_out
)
<
0
)
_debugAlsa
(
" Cannot set stop threshold (%s)
\n
"
,
snd_strerror
(
err
));
if
(
err
=
snd_pcm_sw_params_set_stop_threshold
(
_PlaybackHandle
,
swparams
,
buffer_size_out
)
<
0
)
_debugAlsa
(
" Cannot set stop threshold (%s)
\n
"
,
snd_strerror
(
err
));
//if( err = snd_pcm_sw_params_set_start_mode( _PlaybackHandle, swparams, SND_PCM_START_DATA ) < 0 ) _debugAlsa(" Cannot set start mode (%s)\n", snd_strerror(err));
//if( err = snd_pcm_sw_params_set_start_mode( _PlaybackHandle, swparams, SND_PCM_START_DATA ) < 0 ) _debugAlsa(" Cannot set start mode (%s)\n", snd_strerror(err));
if
(
err
=
snd_pcm_sw_params_set_avail_min
(
_PlaybackHandle
,
swparams
,
val
)
<
0
)
_debugAlsa
(
" Cannot set min avail (%s)
\n
"
,
snd_strerror
(
err
));
if
(
err
=
snd_pcm_sw_params_set_avail_min
(
_PlaybackHandle
,
swparams
,
threshold
)
<
0
)
_debugAlsa
(
" Cannot set min avail (%s)
\n
"
,
snd_strerror
(
err
));
if
(
err
=
snd_pcm_sw_params_set_silence_threshold
(
_PlaybackHandle
,
swparams
,
val
)
<
0
)
_debugAlsa
(
" Cannot set silence threshold (%s)
\n
"
,
snd_strerror
(
err
));
if
(
err
=
snd_pcm_sw_params_set_silence_threshold
(
_PlaybackHandle
,
swparams
,
threshold
)
<
0
)
_debugAlsa
(
" Cannot set silence threshold (%s)
\n
"
,
snd_strerror
(
err
));
if
(
err
=
snd_pcm_sw_params
(
_PlaybackHandle
,
swparams
)
<
0
)
_debugAlsa
(
" Cannot set sw parameters (%s)
\n
"
,
snd_strerror
(
err
));
if
(
err
=
snd_pcm_sw_params
(
_PlaybackHandle
,
swparams
)
<
0
)
_debugAlsa
(
" Cannot set sw parameters (%s)
\n
"
,
snd_strerror
(
err
));
snd_pcm_sw_params_free
(
swparams
);
snd_pcm_sw_params_free
(
swparams
);
...
@@ -365,7 +386,7 @@ AudioLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
...
@@ -365,7 +386,7 @@ AudioLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
deviceClosed
=
false
;
deviceClosed
=
false
;
}
}
fillHWBuffer
();
//
fillHWBuffer();
_talk
=
false
;
_talk
=
false
;
return
true
;
return
true
;
}
}
...
@@ -375,8 +396,20 @@ AudioLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
...
@@ -375,8 +396,20 @@ AudioLayer::open_device(std::string pcm_p, std::string pcm_c, int flag)
int
int
AudioLayer
::
write
(
void
*
buffer
,
int
length
)
AudioLayer
::
write
(
void
*
buffer
,
int
length
)
{
{
int
bytes
;
int
bytes
;
snd_pcm_uframes_t
frames
=
snd_pcm_bytes_to_frames
(
_PlaybackHandle
,
length
);
snd_pcm_uframes_t
frames
=
snd_pcm_bytes_to_frames
(
_PlaybackHandle
,
length
);
//snd_pcm_sframes_t delay;
//snd_pcm_delay( _PlaybackHandle , &delay ) ;
//_debug("Write %d frames\n" , frames);
if
(
snd_pcm_state
(
_PlaybackHandle
)
==
SND_PCM_STATE_XRUN
)
handle_xrun_playback
();
//snd_pcm_prepare( _PlaybackHandle );
//_debug("Frames to write = %d - Frames available = %d - Delay = %d\n" , frames, snd_pcm_avail_update( _PlaybackHandle ), delay);
//_fstream.write( (char*)buffer , length );
bytes
=
snd_pcm_writei
(
_PlaybackHandle
,
buffer
,
frames
);
bytes
=
snd_pcm_writei
(
_PlaybackHandle
,
buffer
,
frames
);
...
@@ -404,8 +437,7 @@ AudioLayer::write(void* buffer, int length)
...
@@ -404,8 +437,7 @@ AudioLayer::write(void* buffer, int length)
{
{
_debugAlsa
(
" PCM is not in the right state (%s)
\n
"
,
snd_strerror
(
bytes
));
_debugAlsa
(
" PCM is not in the right state (%s)
\n
"
,
snd_strerror
(
bytes
));
}
}
return
bytes
;
return
0
;
}
}
int
int
...
@@ -468,19 +500,23 @@ AudioLayer::handle_xrun_capture( void )
...
@@ -468,19 +500,23 @@ AudioLayer::handle_xrun_capture( void )
void
void
AudioLayer
::
handle_xrun_playback
(
void
)
AudioLayer
::
handle_xrun_playback
(
void
)
{
{
//_debug("xrun\n");
int
state
;
snd_pcm_status_t
*
status
;
snd_pcm_status_t
*
status
;
snd_pcm_status_alloca
(
&
status
);
snd_pcm_status_alloca
(
&
status
);
int
res
=
snd_pcm_status
(
_PlaybackHandle
,
status
);
if
(
state
=
snd_pcm_status
(
_PlaybackHandle
,
status
)
<
0
)
_debugAlsa
(
" Error: Cannot get playback handle status (%s)
\n
"
,
snd_strerror
(
state
)
);
if
(
res
<=
0
){
else
if
(
snd_pcm_status_get_state
(
status
)
==
SND_PCM_STATE_XRUN
){
{
state
=
snd_pcm_status_get_state
(
status
);
if
(
state
==
SND_PCM_STATE_XRUN
)
{
snd_pcm_drop
(
_PlaybackHandle
);
snd_pcm_drop
(
_PlaybackHandle
);
snd_pcm_prepare
(
_PlaybackHandle
);
snd_pcm_prepare
(
_PlaybackHandle
);
snd_pcm_start
(
_PlaybackHandle
);
//
snd_pcm_start( _PlaybackHandle );
}
}
}
}
else
_debugAlsa
(
" Get status failed
\n
"
);
}
}
std
::
string
std
::
string
...
@@ -600,10 +636,31 @@ AudioLayer::soundCardGetIndex( std::string description )
...
@@ -600,10 +636,31 @@ AudioLayer::soundCardGetIndex( std::string description )
for
(
i
=
0
;
i
<
IDSoundCards
.
size
()
;
i
++
)
for
(
i
=
0
;
i
<
IDSoundCards
.
size
()
;
i
++
)
{
{
HwIDPair
p
=
IDSoundCards
[
i
];
HwIDPair
p
=
IDSoundCards
[
i
];
_debug
(
"%i %s
\n
"
,
p
.
first
,
p
.
second
.
c_str
());
//
_debug("%i %s\n", p.first , p.second.c_str());
if
(
p
.
second
==
description
)
if
(
p
.
second
==
description
)
return
p
.
first
;
return
p
.
first
;
}
}
// else return the default one
// else return the default one
return
0
;
return
0
;
}
}
void
*
AudioLayer
::
adjustVolume
(
void
*
buffer
,
int
len
,
int
stream
)
{
int
vol
;
if
(
stream
==
SFL_PCM_PLAYBACK
)
vol
=
_manager
->
getSpkrVolume
();
else
vol
=
_manager
->
getMicVolume
();
SFLDataFormat
*
src
=
(
SFLDataFormat
*
)
buffer
;
if
(
vol
!=
100
)
{
int
size
=
len
/
sizeof
(
SFLDataFormat
);
int
i
;
for
(
i
=
0
;
i
<
size
;
i
++
){
src
[
i
]
=
src
[
i
]
*
vol
/
100
;
}
}
return
src
;
}
This diff is collapsed.
Click to expand it.
src/audio/audiolayer.h
+
3
−
1
View file @
6525ae76
...
@@ -194,7 +194,7 @@ class AudioLayer {
...
@@ -194,7 +194,7 @@ class AudioLayer {
* @return std::string The name of the audio plugin
* @return std::string The name of the audio plugin
*/
*/
std
::
string
getAudioPlugin
(
void
)
{
return
_audioPlugin
;
}
std
::
string
getAudioPlugin
(
void
)
{
return
_audioPlugin
;
}
std
::
ofstream
_fstream
;
/*
/*
* Get the current state. Conversation or not
* Get the current state. Conversation or not
* @return bool true if playSamples has been called
* @return bool true if playSamples has been called
...
@@ -299,6 +299,8 @@ class AudioLayer {
...
@@ -299,6 +299,8 @@ class AudioLayer {
*/
*/
RingBuffer
_urgentBuffer
;
RingBuffer
_urgentBuffer
;
void
*
adjustVolume
(
void
*
,
int
,
int
);
/*
/*
* Determine if both endpoints hang up.
* Determine if both endpoints hang up.
* true if conversation is running
* true if conversation is running
...
...
This diff is collapsed.
Click to expand it.
src/managerimpl.cpp
+
20
−
20
View file @
6525ae76
...
@@ -629,7 +629,6 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId)
...
@@ -629,7 +629,6 @@ ManagerImpl::incomingCall(Call* call, const AccountID& accountId)
if
(
!
hasCurrentCall
()
)
{
if
(
!
hasCurrentCall
()
)
{
call
->
setConnectionState
(
Call
::
Ringing
);
call
->
setConnectionState
(
Call
::
Ringing
);
_debugAlsa
(
" call ringtone() method
\n
"
);
ringtone
();
ringtone
();
switchCall
(
call
->
getCallId
());
switchCall
(
call
->
getCallId
());
}
else
{
}
else
{
...
@@ -828,9 +827,9 @@ ManagerImpl::playATone(Tone::TONEID toneId) {
...
@@ -828,9 +827,9 @@ ManagerImpl::playATone(Tone::TONEID toneId) {
unsigned
int
nbSampling
=
audioloop
->
getSize
();
unsigned
int
nbSampling
=
audioloop
->
getSize
();
AudioLayer
*
audiolayer
=
getAudioDriver
();
AudioLayer
*
audiolayer
=
getAudioDriver
();
SFLDataFormat
buf
[
nbSampling
];
SFLDataFormat
buf
[
nbSampling
];
audioloop
->
getNext
(
buf
,
(
int
)
nbSampling
);
//
audioloop->getNext(buf, (int) nbSampling);
if
(
audiolayer
)
{
if
(
audiolayer
)
{
//
audiolayer->putUrgent( buf,
sizeof(SFLDataFormat)*
nbSampling );
audiolayer
->
putUrgent
(
buf
,
nbSampling
);
}
}
else
else
return
false
;
return
false
;
...
@@ -910,20 +909,20 @@ ManagerImpl::ringtone()
...
@@ -910,20 +909,20 @@ ManagerImpl::ringtone()
int
sampleRate
=
audiolayer
->
getSampleRate
();
int
sampleRate
=
audiolayer
->
getSampleRate
();
AudioCodec
*
codecForTone
=
_codecDescriptorMap
.
getFirstCodecAvailable
();
AudioCodec
*
codecForTone
=
_codecDescriptorMap
.
getFirstCodecAvailable
();
_toneMutex
.
enterMutex
();
//
_toneMutex.enterMutex();
bool
loadFile
=
_audiofile
.
loadFile
(
ringchoice
,
codecForTone
,
sampleRate
);
//
bool loadFile = _audiofile.loadFile(ringchoice, codecForTone , sampleRate);
_toneMutex
.
leaveMutex
();
//
_toneMutex.leaveMutex();
if
(
loadFile
)
{
//
if (loadFile) {
_toneMutex
.
enterMutex
();
//
_toneMutex.enterMutex();
_audiofile
.
start
();
//
_audiofile.start();
_toneMutex
.
leaveMutex
();
//
_toneMutex.leaveMutex();
int
size
=
_audiofile
.
getSize
();
//
int size = _audiofile.getSize();
SFLDataFormat
output
[
size
];
//
SFLDataFormat output[ size ];
_audiofile
.
getNext
(
output
,
size
,
100
);
//
_audiofile.getNext(output, size , 100);
//audiolayer->putUrgent( output , size );
//audiolayer->putUrgent( output , size );
}
else
{
//
} else {
ringback
();
ringback
();
}
//
}
}
}
AudioLoop
*
AudioLoop
*
...
@@ -1243,10 +1242,11 @@ ManagerImpl::getOutputAudioPluginList(void)
...
@@ -1243,10 +1242,11 @@ ManagerImpl::getOutputAudioPluginList(void)
std
::
vector
<
std
::
string
>
v
;
std
::
vector
<
std
::
string
>
v
;
_debug
(
"Get output audio plugin list"
);
_debug
(
"Get output audio plugin list"
);
v
.
push_back
(
"default"
);
v
.
push_back
(
PCM_DEFAULT
);
v
.
push_back
(
"plug:hw"
);
v
.
push_back
(
PCM_PLUGHW
);
v
.
push_back
(
"plug:dmix"
);
v
.
push_back
(
PCM_DMIX
);
v
.
push_back
(
"plug:surround40"
);
v
.
push_back
(
PCM_SURROUND40
);
//v.push_back( PCM_HW );
return
v
;
return
v
;
}
}
...
...
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
sign in
to comment