aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/includes/Audio/audio_in.h7
-rw-r--r--src/common/includes/Audio/tone.h4
-rw-r--r--src/common/src/Audio/tone.c19
3 files changed, 19 insertions, 11 deletions
diff --git a/src/common/includes/Audio/audio_in.h b/src/common/includes/Audio/audio_in.h
index d2e8378..97a0f29 100644
--- a/src/common/includes/Audio/audio_in.h
+++ b/src/common/includes/Audio/audio_in.h
@@ -35,7 +35,6 @@ void audio_in_initialize(void);
/* Enable or disable the audio input */
void audio_in_enable(int enable);
-// After calling this function, *buffer will point to new audio data.
-// Returns the number of times filling the internal buffer failed.
-int32_t audio_in_get_buffer(int16_t **buffer /*of length AUDIO_IN_BUF_LEN*/ );
-
+/* The audio input layer must call tone_detect_push_sample() to
+ * send the samples
+ */
diff --git a/src/common/includes/Audio/tone.h b/src/common/includes/Audio/tone.h
index 272fcb9..e88cae2 100644
--- a/src/common/includes/Audio/tone.h
+++ b/src/common/includes/Audio/tone.h
@@ -43,7 +43,7 @@ int tone_fax_status(void);
/* Must be called by task to do the analysis */
void tone_do_analysis(void);
-/* Push a sample from the ADC ISR */
-void tone_detect_push_sample_from_irq(const uint16_t sample);
+/* Push a sample from the ADC ISR or Pulseaudio task */
+void tone_detect_push_sample(const uint16_t sample, int is_irq);
#endif
diff --git a/src/common/src/Audio/tone.c b/src/common/src/Audio/tone.c
index b8bebf8..9298b15 100644
--- a/src/common/src/Audio/tone.c
+++ b/src/common/src/Audio/tone.c
@@ -238,7 +238,7 @@ void tone_detector_enable(int enable)
}
}
-void tone_detect_push_sample_from_irq(const uint16_t sample)
+void tone_detect_push_sample(const uint16_t sample, int is_irq)
{
num_samples_analysed++;
@@ -273,10 +273,19 @@ void tone_detect_push_sample_from_irq(const uint16_t sample)
}
BaseType_t require_context_switch = 0;
- int success = xQueueSendToBackFromISR(
- m_squared_queue,
- &m_squared,
- &require_context_switch);
+ int success;
+ if (is_irq) {
+ success = xQueueSendToBackFromISR(
+ m_squared_queue,
+ &m_squared,
+ &require_context_switch);
+ }
+ else {
+ success = xQueueSendToBack(
+ m_squared_queue,
+ &m_squared,
+ 0);
+ }
if (success == pdFALSE) {
lost_results++;