diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-10-12 09:29:21 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-12 13:40:37 +0000 |
commit | 141e91ef1fc5ce6c487988c29c00e57fa6e52fb6 (patch) | |
tree | 96a29cb38a833565e099ce3b00016bb653695699 /firmware/drivers/audio/xduoolinux_codec.c | |
parent | 9ad30869b86dd827fbbf56a67122d662a51514f5 (diff) | |
download | rockbox-141e91ef1fc5ce6c487988c29c00e57fa6e52fb6.tar.gz rockbox-141e91ef1fc5ce6c487988c29c00e57fa6e52fb6.zip |
Hosted PCM: Rework auto-muting code a bit
* If AUDIOHW_MUTE_ON_PAUSE, no meaningful change
* Unconditionally unmute on playback start
* xduoox3ii: Mute on sample rate change
* rocker/xduoo: Stay muted after startup
This avoids the nasty "pop" on startup, without doing
the full mute-on-pause stuff that causes unacceptable
dropouts on the X3ii.
Change-Id: I2e3ee0bb8094e288f37a0acada86a80016ce5cac
Diffstat (limited to 'firmware/drivers/audio/xduoolinux_codec.c')
-rw-r--r-- | firmware/drivers/audio/xduoolinux_codec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/drivers/audio/xduoolinux_codec.c b/firmware/drivers/audio/xduoolinux_codec.c index b114b1bbc9..59ef562d0a 100644 --- a/firmware/drivers/audio/xduoolinux_codec.c +++ b/firmware/drivers/audio/xduoolinux_codec.c | |||
@@ -55,6 +55,8 @@ static void hw_close(void) | |||
55 | close(fd_hw); | 55 | close(fd_hw); |
56 | } | 56 | } |
57 | 57 | ||
58 | static int muted = -1; | ||
59 | |||
58 | void audiohw_mute(int mute) | 60 | void audiohw_mute(int mute) |
59 | { | 61 | { |
60 | logf("mute %d", mute); | 62 | logf("mute %d", mute); |
@@ -69,6 +71,7 @@ void audiohw_mute(int mute) | |||
69 | last_ps = 0; | 71 | last_ps = 0; |
70 | xduoo_get_outputs(); | 72 | xduoo_get_outputs(); |
71 | } | 73 | } |
74 | muted = mute; | ||
72 | } | 75 | } |
73 | 76 | ||
74 | int xduoo_get_outputs(void){ | 77 | int xduoo_get_outputs(void){ |
@@ -102,7 +105,7 @@ int xduoo_get_outputs(void){ | |||
102 | 105 | ||
103 | void xduoo_set_output(int ps) | 106 | void xduoo_set_output(int ps) |
104 | { | 107 | { |
105 | if (!inited) return; | 108 | if (!inited || muted) return; |
106 | 109 | ||
107 | if (last_ps != ps) | 110 | if (last_ps != ps) |
108 | { | 111 | { |
@@ -128,7 +131,7 @@ void audiohw_postinit(void) | |||
128 | // const char * const codec_pmdown = "/sys/devices/platform/ingenic-x3ii.0/x3ii-ak4490-i2s/pmdown_time"; // in ms, defaults 5000 | 131 | // const char * const codec_pmdown = "/sys/devices/platform/ingenic-x3ii.0/x3ii-ak4490-i2s/pmdown_time"; // in ms, defaults 5000 |
129 | 132 | ||
130 | logf("hw postinit"); | 133 | logf("hw postinit"); |
131 | xduoo_set_output(xduoo_get_outputs()); /* Unmute */ | 134 | // xduoo_get_outputs(); // Unmute happens upon playback. |
132 | } | 135 | } |
133 | 136 | ||
134 | void audiohw_close(void) | 137 | void audiohw_close(void) |