Skip to content

Instantly share code, notes, and snippets.

@pawitp
Last active March 12, 2017 03:47
Show Gist options
  • Select an option

  • Save pawitp/7945188 to your computer and use it in GitHub Desktop.

Select an option

Save pawitp/7945188 to your computer and use it in GitHub Desktop.
From 2f4a77028dffc2312946641be87e9d6cacdecd0a Mon Sep 17 00:00:00 2001
From: Pawit Pornkitprasan <[email protected]>
Date: Fri, 13 Dec 2013 21:37:01 +0700
Subject: [PATCH] AudioMixer: fix artifact on 2 short sounds
On the I9082, when 2 short sounds are played simultaneously, there will be artifact
on the speaker due to the buffer not being cleared.
Change-Id: I8a325175e8e326a638c7f29987ae272ae8af6b66
---
services/audioflinger/AudioMixer.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/services/audioflinger/AudioMixer.cpp b/services/audioflinger/AudioMixer.cpp
index 95f7381..bd40948 100644
--- a/services/audioflinger/AudioMixer.cpp
+++ b/services/audioflinger/AudioMixer.cpp
@@ -1128,8 +1128,13 @@ void AudioMixer::process__genericNoResampling(state_t* state, int64_t pts)
t.in = t.buffer.raw;
// t.in == NULL can happen if the track was flushed just after having
// been enabled for mixing.
- if (t.in == NULL)
+ if (t.in == NULL) {
enabledTracks &= ~(1<<i);
+
+ // We need to clear buffer here or there will be strange artifact
+ // on I9082's speaker
+ memset(t.mainBuffer, 0, state->frameCount);
+ }
}
e0 = enabledTracks;
--
1.8.3.4 (Apple Git-47)
@pawitp
Copy link
Author

pawitp commented Jul 14, 2014

Change log: removed AudioMixer patch as it's already included

@laddycc
Copy link

laddycc commented Feb 21, 2016

how to patch sir need tutorial

@Vladislav4KZ
Copy link

How to put patch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment