Fix broken audio stats when audio is muted.

This commit is contained in:
Jared Boone 2016-01-10 11:34:06 -08:00
parent 4ea84301c6
commit eb5b2d7d30
3 changed files with 9 additions and 3 deletions

View File

@ -54,8 +54,14 @@ void BasebandProcessor::fill_audio_buffer(const buffer_s16_t& audio) {
feed_audio_stats(audio); feed_audio_stats(audio);
} }
void BasebandProcessor::mute_audio() { void BasebandProcessor::mute_audio(const buffer_s16_t& audio) {
i2s::i2s0::tx_mute(); i2s::i2s0::tx_mute();
for(size_t i=0; i<audio.count; i++) {
audio.p[i] = 0;
}
feed_audio_stats(audio);
} }
void BasebandProcessor::feed_audio_stats(const buffer_s16_t& audio) { void BasebandProcessor::feed_audio_stats(const buffer_s16_t& audio) {

View File

@ -44,7 +44,7 @@ protected:
void feed_channel_stats(const buffer_c16_t& channel); void feed_channel_stats(const buffer_c16_t& channel);
void fill_audio_buffer(const buffer_s16_t& audio); void fill_audio_buffer(const buffer_s16_t& audio);
void mute_audio(); void mute_audio(const buffer_s16_t& audio);
private: private:
ChannelStatsCollector channel_stats; ChannelStatsCollector channel_stats;

View File

@ -52,7 +52,7 @@ void NarrowbandFMAudio::execute(const buffer_c8_t& buffer) {
if( audio_present ) { if( audio_present ) {
fill_audio_buffer(audio); fill_audio_buffer(audio);
} else { } else {
mute_audio(); mute_audio(audio);
} }
} }