Patchwork ] audio: previous audio buffer should be flushed

login
register
mail settings
Submitter munkyu.im
Date Aug. 28, 2012, 7:42 a.m.
Message ID <1346139726-14886-1-git-send-email-munkyu.im@samsung.com>
Download mbox | patch
Permalink /patch/180362/
State New
Headers show

Comments

munkyu.im - Aug. 28, 2012, 7:42 a.m.
Winwave audio backend has problem with pausing and restart audio out.
Unlike other backends, Winwave pausing API does not flush audio buffer.
As a result, the previous audio data are playedin front of
user expected sound when user restart audio.
So changes it to waveOutReset()

Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
---
 audio/winwaveaudio.c |   12 +++---------
 1 files changed, 3 insertions(+), 9 deletions(-)
malc - Aug. 28, 2012, 3:12 p.m.
On Tue, 28 Aug 2012, munkyu.im wrote:

> Winwave audio backend has problem with pausing and restart audio out.
> Unlike other backends, Winwave pausing API does not flush audio buffer.
> As a result, the previous audio data are playedin front of
> user expected sound when user restart audio.
> So changes it to waveOutReset()
> 
> Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
> ---
>  audio/winwaveaudio.c |   12 +++---------
>  1 files changed, 3 insertions(+), 9 deletions(-)
> 

Thanks, applied with some cosmetics changes to the commit message.

Patch

diff --git a/audio/winwaveaudio.c b/audio/winwaveaudio.c
index 663abb9..72babbf 100644
--- a/audio/winwaveaudio.c
+++ b/audio/winwaveaudio.c
@@ -349,21 +349,15 @@  static int winwave_ctl_out (HWVoiceOut *hw, int cmd, ...)
             else {
                 hw->poll_mode = 0;
             }
-            if (wave->paused) {
-                mr = waveOutRestart (wave->hwo);
-                if (mr != MMSYSERR_NOERROR) {
-                    winwave_logerr (mr, "waveOutRestart");
-                }
-                wave->paused = 0;
-            }
+            wave->paused = 0;
         }
         return 0;
 
     case VOICE_DISABLE:
         if (!wave->paused) {
-            mr = waveOutPause (wave->hwo);
+            mr = waveOutReset (wave->hwo);
             if (mr != MMSYSERR_NOERROR) {
-                winwave_logerr (mr, "waveOutPause");
+                winwave_logerr (mr, "waveOutReset");
             }
             else {
                 wave->paused = 1;