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/erosqlinux_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/erosqlinux_codec.c')
-rw-r--r-- | firmware/drivers/audio/erosqlinux_codec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/drivers/audio/erosqlinux_codec.c b/firmware/drivers/audio/erosqlinux_codec.c index deb3bb4b87..9336083d58 100644 --- a/firmware/drivers/audio/erosqlinux_codec.c +++ b/firmware/drivers/audio/erosqlinux_codec.c | |||
@@ -56,6 +56,8 @@ static void hw_close(void) | |||
56 | close(fd_hw); | 56 | close(fd_hw); |
57 | } | 57 | } |
58 | 58 | ||
59 | static int muted = -1; | ||
60 | |||
59 | void audiohw_mute(int mute) | 61 | void audiohw_mute(int mute) |
60 | { | 62 | { |
61 | logf("mute %d", mute); | 63 | logf("mute %d", mute); |
@@ -70,6 +72,7 @@ void audiohw_mute(int mute) | |||
70 | last_ps = 0; | 72 | last_ps = 0; |
71 | erosq_get_outputs(); | 73 | erosq_get_outputs(); |
72 | } | 74 | } |
75 | muted = mute; | ||
73 | } | 76 | } |
74 | 77 | ||
75 | int erosq_get_outputs(void) { | 78 | int erosq_get_outputs(void) { |
@@ -95,7 +98,7 @@ int erosq_get_outputs(void) { | |||
95 | 98 | ||
96 | void erosq_set_output(int ps) | 99 | void erosq_set_output(int ps) |
97 | { | 100 | { |
98 | if (!inited) return; | 101 | if (!inited || muted) return; |
99 | 102 | ||
100 | if (last_ps != ps) | 103 | if (last_ps != ps) |
101 | { | 104 | { |
@@ -119,7 +122,7 @@ void audiohw_preinit(void) | |||
119 | void audiohw_postinit(void) | 122 | void audiohw_postinit(void) |
120 | { | 123 | { |
121 | logf("hw postinit"); | 124 | logf("hw postinit"); |
122 | erosq_set_output(erosq_get_outputs()); /* Unmute */ | 125 | erosq_get_outputs(); // Unmutes |
123 | } | 126 | } |
124 | 127 | ||
125 | void audiohw_close(void) | 128 | void audiohw_close(void) |