diff options
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/pcm-internal.h | 7 | ||||
-rw-r--r-- | firmware/export/pcm.h | 12 | ||||
-rw-r--r-- | firmware/export/pcm_mixer.h | 2 |
3 files changed, 12 insertions, 9 deletions
diff --git a/firmware/export/pcm-internal.h b/firmware/export/pcm-internal.h index abe3fe08dc..397cf6832f 100644 --- a/firmware/export/pcm-internal.h +++ b/firmware/export/pcm-internal.h | |||
@@ -29,13 +29,6 @@ | |||
29 | ({ (start) = (void *)(((uintptr_t)(start) + 3) & ~3); \ | 29 | ({ (start) = (void *)(((uintptr_t)(start) + 3) & ~3); \ |
30 | (size) &= ~3; }) | 30 | (size) &= ~3; }) |
31 | 31 | ||
32 | struct pcm_peaks | ||
33 | { | ||
34 | long period; | ||
35 | long tick; | ||
36 | uint16_t val[2]; | ||
37 | }; | ||
38 | |||
39 | void pcm_do_peak_calculation(struct pcm_peaks *peaks, bool active, | 32 | void pcm_do_peak_calculation(struct pcm_peaks *peaks, bool active, |
40 | const void *addr, int count); | 33 | const void *addr, int count); |
41 | 34 | ||
diff --git a/firmware/export/pcm.h b/firmware/export/pcm.h index df82c6092d..608129c078 100644 --- a/firmware/export/pcm.h +++ b/firmware/export/pcm.h | |||
@@ -21,7 +21,7 @@ | |||
21 | #ifndef PCM_PLAYBACK_H | 21 | #ifndef PCM_PLAYBACK_H |
22 | #define PCM_PLAYBACK_H | 22 | #define PCM_PLAYBACK_H |
23 | 23 | ||
24 | #include <string.h> /* size_t */ | 24 | #include <sys/types.h> /* size_t, uint32_t */ |
25 | #include "config.h" | 25 | #include "config.h" |
26 | 26 | ||
27 | enum pcm_dma_status | 27 | enum pcm_dma_status |
@@ -71,6 +71,16 @@ void pcm_play_data(pcm_play_callback_type get_more, | |||
71 | pcm_status_callback_type status_cb, | 71 | pcm_status_callback_type status_cb, |
72 | const void *start, size_t size); | 72 | const void *start, size_t size); |
73 | 73 | ||
74 | /* Kept internally for global PCM and used by mixer's verion of peak | ||
75 | calculation */ | ||
76 | struct pcm_peaks | ||
77 | { | ||
78 | uint32_t left; /* Left peak value */ | ||
79 | uint32_t right; /* Right peak value */ | ||
80 | long period; /* For tracking calling period */ | ||
81 | long tick; /* Last tick called */ | ||
82 | }; | ||
83 | |||
74 | void pcm_calculate_peaks(int *left, int *right); | 84 | void pcm_calculate_peaks(int *left, int *right); |
75 | const void* pcm_get_peak_buffer(int* count); | 85 | const void* pcm_get_peak_buffer(int* count); |
76 | size_t pcm_get_bytes_waiting(void); | 86 | size_t pcm_get_bytes_waiting(void); |
diff --git a/firmware/export/pcm_mixer.h b/firmware/export/pcm_mixer.h index 5d8deb2bbf..f6d212d8e0 100644 --- a/firmware/export/pcm_mixer.h +++ b/firmware/export/pcm_mixer.h | |||
@@ -111,7 +111,7 @@ const void * mixer_channel_get_buffer(enum pcm_mixer_channel channel, int *count | |||
111 | 111 | ||
112 | /* Calculate peak values for channel */ | 112 | /* Calculate peak values for channel */ |
113 | void mixer_channel_calculate_peaks(enum pcm_mixer_channel channel, | 113 | void mixer_channel_calculate_peaks(enum pcm_mixer_channel channel, |
114 | int *left, int *right); | 114 | struct pcm_peaks *peaks); |
115 | 115 | ||
116 | /* Adjust channel pointer by a given offset to support movable buffers */ | 116 | /* Adjust channel pointer by a given offset to support movable buffers */ |
117 | void mixer_adjust_channel_address(enum pcm_mixer_channel channel, | 117 | void mixer_adjust_channel_address(enum pcm_mixer_channel channel, |