diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-10-12 11:09:55 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-10-12 15:33:32 +0000 |
commit | 078c34e951049741cd6681e0219561eec67e071b (patch) | |
tree | 734edf13fae68177e832d9869061777eb424d481 /firmware/target | |
parent | 01dc81cd943719dc0ba380774b332f6c2ee0d67e (diff) | |
download | rockbox-078c34e951049741cd6681e0219561eec67e071b.tar.gz rockbox-078c34e951049741cd6681e0219561eec67e071b.zip |
hosted: More PCM muting work
* Track mute state, only call hw if actual change is needed
* Don't unmute in audiohw_postinit()
* sample rate tracking fixes
* erosq: Don't start up muted
Change-Id: I004f787a4b7ea73c16b6ec9818ec29a12c89f46b
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/hosted/pcm-alsa.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/firmware/target/hosted/pcm-alsa.c b/firmware/target/hosted/pcm-alsa.c index 428902b82e..db86a790d2 100644 --- a/firmware/target/hosted/pcm-alsa.c +++ b/firmware/target/hosted/pcm-alsa.c | |||
@@ -454,7 +454,6 @@ void cleanup(void) | |||
454 | snd_pcm_close(handle); | 454 | snd_pcm_close(handle); |
455 | } | 455 | } |
456 | 456 | ||
457 | |||
458 | void pcm_play_dma_init(void) | 457 | void pcm_play_dma_init(void) |
459 | { | 458 | { |
460 | int err; | 459 | int err; |
@@ -533,9 +532,6 @@ static void pcm_dma_apply_settings_nolock(void) | |||
533 | /* Sony NWZ linux driver uses a nonstandard mecanism to set the sampling rate */ | 532 | /* Sony NWZ linux driver uses a nonstandard mecanism to set the sampling rate */ |
534 | audiohw_set_frequency(pcm_sampr); | 533 | audiohw_set_frequency(pcm_sampr); |
535 | #endif | 534 | #endif |
536 | #ifdef AUDIOHW_MUTE_ON_SRATE_CHANGE | ||
537 | audiohw_mute(false); | ||
538 | #endif | ||
539 | /* (Will be unmuted by pcm resuming) */ | 535 | /* (Will be unmuted by pcm resuming) */ |
540 | } | 536 | } |
541 | } | 537 | } |
@@ -564,7 +560,7 @@ void pcm_play_dma_stop(void) | |||
564 | snd_pcm_nonblock(handle, 0); | 560 | snd_pcm_nonblock(handle, 0); |
565 | snd_pcm_drain(handle); | 561 | snd_pcm_drain(handle); |
566 | snd_pcm_nonblock(handle, 1); | 562 | snd_pcm_nonblock(handle, 1); |
567 | last_sample_rate = 0; | 563 | // last_sample_rate = 0; |
568 | #ifdef AUDIOHW_MUTE_ON_PAUSE | 564 | #ifdef AUDIOHW_MUTE_ON_PAUSE |
569 | audiohw_mute(true); | 565 | audiohw_mute(true); |
570 | #endif | 566 | #endif |
@@ -579,7 +575,7 @@ void pcm_play_dma_start(const void *addr, size_t size) | |||
579 | pcm_data = addr; | 575 | pcm_data = addr; |
580 | pcm_size = size; | 576 | pcm_size = size; |
581 | 577 | ||
582 | #if !defined(AUDIOHW_MUTE_ON_PAUSE) || !defined(AUDIOHW_MUTE_ON_SRATE_CHANGE) | 578 | #if !defined(AUDIOHW_MUTE_ON_PAUSE) && defined(AUDIOHW_MUTE_ON_SRATE_CHANGE) |
583 | audiohw_mute(false); | 579 | audiohw_mute(false); |
584 | #endif | 580 | #endif |
585 | 581 | ||
@@ -615,7 +611,7 @@ void pcm_play_dma_start(const void *addr, size_t size) | |||
615 | logf("Start error: %s\n", snd_strerror(err)); | 611 | logf("Start error: %s\n", snd_strerror(err)); |
616 | return; | 612 | return; |
617 | } | 613 | } |
618 | #ifdef AUDIOHW_MUTE_ON_PAUSE | 614 | #if defined(AUDIOHW_MUTE_ON_PAUSE) |
619 | audiohw_mute(false); | 615 | audiohw_mute(false); |
620 | #endif | 616 | #endif |
621 | if (err == 0) | 617 | if (err == 0) |
@@ -652,6 +648,10 @@ const void * pcm_play_dma_get_peak_buffer(int *count) | |||
652 | void pcm_play_dma_postinit(void) | 648 | void pcm_play_dma_postinit(void) |
653 | { | 649 | { |
654 | audiohw_postinit(); | 650 | audiohw_postinit(); |
651 | |||
652 | #ifdef AUDIOHW_NEEDS_INITIAL_UNMUTE | ||
653 | audiohw_mute(false); | ||
654 | #endif | ||
655 | } | 655 | } |
656 | 656 | ||
657 | void pcm_set_mixer_volume(int volume) | 657 | void pcm_set_mixer_volume(int volume) |