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
ea419fec
Commit
ea419fec
authored
May 13, 2010
by
Alexandre Savard
Browse files
[#1962] Instantiate ringtone audio stream in pulseaudio
parent
529b2eff
Changes
6
Hide whitespace changes
Inline
Side-by-side
sflphone-common/src/audio/audiolayer.h
View file @
ea419fec
...
...
@@ -33,8 +33,6 @@
#include
"algorithm.h"
#define FRAME_PER_BUFFER 160
/**
* @file audiolayer.h
* @brief Main sound class. Manages the data transfers between the application and the hardware.
...
...
sflphone-common/src/audio/pulseaudio/audiostream.cpp
View file @
ea419fec
...
...
@@ -210,6 +210,17 @@ AudioStream::createStream (pa_context* c)
pa_stream_connect_record
(
s
,
NULL
,
attributes
,
(
pa_stream_flags_t
)
(
PA_STREAM_ADJUST_LATENCY
|
PA_STREAM_AUTO_TIMING_UPDATE
));
pa_threaded_mainloop_unlock
(
_mainloop
);
}
else
if
(
_streamType
==
RINGTONE_STREAM
)
{
attributes
->
maxlength
=
(
uint32_t
)
-
1
;
attributes
->
tlength
=
pa_usec_to_bytes
(
100
*
PA_USEC_PER_MSEC
,
&
_sample_spec
);
attributes
->
prebuf
=
0
;
attributes
->
minreq
=
(
uint32_t
)
-
1
;
pa_threaded_mainloop_lock
(
_mainloop
);
pa_stream_connect_playback
(
s
,
NULL
,
attributes
,
(
pa_stream_flags_t
)
(
PA_STREAM_NOFLAGS
),
NULL
,
NULL
);
pa_threaded_mainloop_unlock
(
_mainloop
);
}
else
if
(
_streamType
==
UPLOAD_STREAM
)
{
pa_stream_connect_upload
(
s
,
1024
);
}
else
{
...
...
sflphone-common/src/audio/pulseaudio/audiostream.h
View file @
ea419fec
...
...
@@ -35,6 +35,7 @@
enum
STREAM_TYPE
{
PLAYBACK_STREAM
,
CAPTURE_STREAM
,
RINGTONE_STREAM
,
UPLOAD_STREAM
};
...
...
sflphone-common/src/audio/pulseaudio/pulselayer.cpp
View file @
ea419fec
...
...
@@ -73,8 +73,9 @@ PulseLayer::PulseLayer (ManagerImpl* manager)
:
AudioLayer
(
manager
,
PULSEAUDIO
)
,
context
(
NULL
)
,
m
(
NULL
)
,
playback
()
,
record
()
,
playback
(
NULL
)
,
record
(
NULL
)
,
ringtone
(
NULL
)
{
_urgentRingBuffer
.
createReadPointer
();
dcblocker
=
new
DcBlocker
();
...
...
@@ -278,6 +279,18 @@ bool PulseLayer::createStreams (pa_context* c)
// pa_stream_set_moved_callback(record->pulseStream(), stream_moved_callback, this);
delete
recordParam
;
PulseLayerType
*
ringtoneParam
=
new
PulseLayerType
();
ringtoneParam
->
context
=
c
;
ringtoneParam
->
type
=
RINGTONE_STREAM
;
ringtoneParam
->
description
=
RINGTONE_STREAM_NAME
;
ringtoneParam
->
volume
=
_manager
->
getSpkrVolume
();
ringtoneParam
->
mainloop
=
m
;
ringtone
=
new
AudioStream
(
ringtoneParam
,
_audioSampleRate
);
ringtone
->
connectStream
();
pa_stream_set_write_callback
(
ringtone
->
pulseStream
(),
playback_callback
,
this
);
delete
ringtoneParam
;
pa_threaded_mainloop_signal
(
m
,
0
);
flushMain
();
...
...
sflphone-common/src/audio/pulseaudio/pulselayer.h
View file @
ea419fec
...
...
@@ -31,8 +31,9 @@
#include
<stdlib.h>
#define PLAYBACK_STREAM_NAME "SFLphone out"
#define CAPTURE_STREAM_NAME "SFLphone in"
#define PLAYBACK_STREAM_NAME "SFLphone playback"
#define CAPTURE_STREAM_NAME "SFLphone capture"
#define RINGTONE_STREAM_NAME "SFLphone ringtone"
class
RingBuffer
;
class
ManagerImpl
;
...
...
@@ -200,6 +201,11 @@ class PulseLayer : public AudioLayer {
*/
AudioStream
*
record
;
/**
* A special stream object to handle specific playback stream for ringtone
*/
AudioStream
*
ringtone
;
/** Sample rate converter object */
SamplerateConverter
*
_converter
;
...
...
sflphone-common/src/managerimpl.cpp
View file @
ea419fec
...
...
@@ -1950,7 +1950,7 @@ void ManagerImpl::notificationIncomingCall (void) {
if
(
audiolayer
!=
0
)
{
samplerate
=
audiolayer
->
getSampleRate
();
frequency
<<
"440/"
<<
FRAME_PER_BUFFER
;
frequency
<<
"440/"
<<
160
;
Tone
tone
(
frequency
.
str
(),
samplerate
);
nbSampling
=
tone
.
getSize
();
SFLDataFormat
buf
[
nbSampling
];
...
...
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