From 7a83c0dd387df4ff566c86febbed3bcfe0c0ce98 Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandre.savard@savoirfairelinux.net> Date: Wed, 21 Oct 2009 10:15:25 -0400 Subject: [PATCH] [#2333] Fix ALSA ringtone --- sflphone-common/src/audio/alsa/alsalayer.cpp | 2 +- .../src/audio/pulseaudio/pulselayer.cpp | 3 +-- sflphone-common/src/managerimpl.cpp | 15 ++++++--------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sflphone-common/src/audio/alsa/alsalayer.cpp b/sflphone-common/src/audio/alsa/alsalayer.cpp index 97d3bf53f7..fcd22045b2 100644 --- a/sflphone-common/src/audio/alsa/alsalayer.cpp +++ b/sflphone-common/src/audio/alsa/alsalayer.cpp @@ -862,7 +862,7 @@ void AlsaLayer::audioCallback (void) } else if (file_tone != 0) { out = (SFLDataFormat*) malloc (maxBytes * sizeof (SFLDataFormat)); - tone->getNext (out, toGet, spkrVolume); + file_tone->getNext(out, toGet, spkrVolume); write (out , maxBytes); free(out); diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp index c1712d6409..2ce375a3ca 100644 --- a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp +++ b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp @@ -485,9 +485,8 @@ void PulseLayer::writeToSpeaker (void) toGet = framesPerBuffer; toPlay = ( (int) (toGet * sizeof (SFLDataFormat)) > framesPerBuffer) ? framesPerBuffer : toGet * sizeof (SFLDataFormat); - _debug("toPlay: %i\n", toPlay); out = (SFLDataFormat*) pa_xmalloc (toPlay); - file_tone->getNext (out, toPlay/2 , 100); + file_tone->getNext(out, toPlay/2 , 100); pa_stream_write (playback->pulseStream(), out, toPlay, NULL, 0, PA_SEEK_RELATIVE); pa_xfree (out); diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index f700f63513..5491f2fe9d 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -2030,10 +2030,11 @@ bool ManagerImpl::playATone (Tone::TONEID toneId) audiolayer = getAudioDriver(); - if (audiolayer) + + if (audiolayer) { audiolayer->startStream(); - - audiolayer->flushUrgent(); + audiolayer->flushUrgent(); + } if (_telephoneTone != 0) { _toneMutex.enterMutex(); @@ -2168,12 +2169,8 @@ ManagerImpl::ringtone() _audiofile.start(); _toneMutex.leaveMutex(); - if (CHECK_INTERFACE (layer, ALSA)) { - //ringback(); - - } else { - audiolayer->startStream(); - } + audiolayer->startStream(); + } else { ringback(); } -- GitLab