summaryrefslogtreecommitdiff
path: root/firmware/pcm_mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/pcm_mixer.c')
-rw-r--r--firmware/pcm_mixer.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/firmware/pcm_mixer.c b/firmware/pcm_mixer.c
index 85d31ade70..cddff431ec 100644
--- a/firmware/pcm_mixer.c
+++ b/firmware/pcm_mixer.c
@@ -60,9 +60,6 @@ static size_t next_size = 0; /* Size of buffer to play next time */
60/* Descriptors for all available channels */ 60/* Descriptors for all available channels */
61static struct mixer_channel channels[PCM_MIXER_NUM_CHANNELS] IBSS_ATTR; 61static struct mixer_channel channels[PCM_MIXER_NUM_CHANNELS] IBSS_ATTR;
62 62
63/* History for channel peaks */
64static struct pcm_peaks channel_peaks[PCM_MIXER_NUM_CHANNELS];
65
66/* Packed pointer array of all playing (active) channels in "channels" array */ 63/* Packed pointer array of all playing (active) channels in "channels" array */
67static struct mixer_channel * active_channels[PCM_MIXER_NUM_CHANNELS+1] IBSS_ATTR; 64static struct mixer_channel * active_channels[PCM_MIXER_NUM_CHANNELS+1] IBSS_ATTR;
68 65
@@ -389,21 +386,14 @@ const void * mixer_channel_get_buffer(enum pcm_mixer_channel channel, int *count
389 386
390/* Calculate peak values for channel */ 387/* Calculate peak values for channel */
391void mixer_channel_calculate_peaks(enum pcm_mixer_channel channel, 388void mixer_channel_calculate_peaks(enum pcm_mixer_channel channel,
392 int *left, int *right) 389 struct pcm_peaks *peaks)
393{ 390{
394 struct mixer_channel *chan = &channels[channel];
395 struct pcm_peaks *peaks = &channel_peaks[channel];
396 int count; 391 int count;
397 const void *addr = mixer_channel_get_buffer(channel, &count); 392 const void *addr = mixer_channel_get_buffer(channel, &count);
398 393
399 pcm_do_peak_calculation(peaks, chan->status == CHANNEL_PLAYING, 394 pcm_do_peak_calculation(peaks,
395 channels[channel].status == CHANNEL_PLAYING,
400 addr, count); 396 addr, count);
401
402 if (left)
403 *left = peaks->val[0];
404
405 if (right)
406 *right = peaks->val[1];
407} 397}
408 398
409/* Adjust channel pointer by a given offset to support movable buffers */ 399/* Adjust channel pointer by a given offset to support movable buffers */