summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/audio/sdl.c7
-rw-r--r--firmware/export/config/sansac200.h5
-rw-r--r--firmware/export/pcm_sampr.h2
-rw-r--r--firmware/pcm.c4
4 files changed, 14 insertions, 4 deletions
diff --git a/firmware/drivers/audio/sdl.c b/firmware/drivers/audio/sdl.c
index f4c622d7a6..7d6d7452df 100644
--- a/firmware/drivers/audio/sdl.c
+++ b/firmware/drivers/audio/sdl.c
@@ -22,6 +22,7 @@
22#include <SDL_audio.h> 22#include <SDL_audio.h>
23#include "config.h" 23#include "config.h"
24#include "audiohw.h" 24#include "audiohw.h"
25#include "pcm_sampr.h"
25 26
26/** 27/**
27 * Audio Hardware api. Make them do nothing as we cannot properly simulate with 28 * Audio Hardware api. Make them do nothing as we cannot properly simulate with
@@ -162,10 +163,12 @@ void audiohw_set_eq_band_width(unsigned int band, int value)
162void audiohw_set_depth_3d(int value) 163void audiohw_set_depth_3d(int value)
163 { (void)value; } 164 { (void)value; }
164#endif 165#endif
165#if defined(HAVE_SAMPR_TYPE_REC) 166#ifdef HAVE_RECORDING
166unsigned int pcm_sampr_type_rec_to_play(int samplerate) 167#if SAMPR_TYPE_REC != 0
168unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate)
167 { return samplerate; } 169 { return samplerate; }
168#endif 170#endif
171#endif /* HAVE_RECORDING */
169#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 172#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
170int mas_codec_readreg(int reg) 173int mas_codec_readreg(int reg)
171{ 174{
diff --git a/firmware/export/config/sansac200.h b/firmware/export/config/sansac200.h
index 6c05ba5a1c..3240af43f2 100644
--- a/firmware/export/config/sansac200.h
+++ b/firmware/export/config/sansac200.h
@@ -16,6 +16,11 @@
16#define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */ 16#define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */
17#define REC_SAMPR_DEFAULT SAMPR_22 17#define REC_SAMPR_DEFAULT SAMPR_22
18 18
19/* because the samplerates don't match at each point, we must be able to
20 * tell PCM which set of rates to use. not needed if recording rates are
21 * a simple subset of playback rates and are equal values. */
22#define CONFIG_SAMPR_TYPES
23
19/* Define bitmask of input sources - recordable bitmask can be defined 24/* Define bitmask of input sources - recordable bitmask can be defined
20 explicitly if different */ 25 explicitly if different */
21#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO) 26#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_FMRADIO)
diff --git a/firmware/export/pcm_sampr.h b/firmware/export/pcm_sampr.h
index c46e3ea9e2..62bfd0068b 100644
--- a/firmware/export/pcm_sampr.h
+++ b/firmware/export/pcm_sampr.h
@@ -324,7 +324,7 @@ extern const unsigned long rec_freq_sampr[REC_NUM_FREQ];
324#define SAMPR_TYPE_REC (0x01 << 24) 324#define SAMPR_TYPE_REC (0x01 << 24)
325#endif 325#endif
326 326
327unsigned int sampr_type_rec_to_play(unsigned int samplerate); 327unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate);
328 328
329#else /* ndef CONFIG_SAMPR_TYPES */ 329#else /* ndef CONFIG_SAMPR_TYPES */
330 330
diff --git a/firmware/pcm.c b/firmware/pcm.c
index 72fe23cb16..76a0ea2777 100644
--- a/firmware/pcm.c
+++ b/firmware/pcm.c
@@ -367,7 +367,8 @@ void pcm_set_frequency(unsigned int samplerate)
367 unsigned int type = samplerate & SAMPR_TYPE_MASK; 367 unsigned int type = samplerate & SAMPR_TYPE_MASK;
368 samplerate &= ~SAMPR_TYPE_MASK; 368 samplerate &= ~SAMPR_TYPE_MASK;
369 369
370#ifdef SAMPR_TYPE_REC 370#ifdef HAVE_RECORDING
371#if SAMPR_TYPE_REC != 0
371 /* For now, supported targets have direct conversion when configured with 372 /* For now, supported targets have direct conversion when configured with
372 * CONFIG_SAMPR_TYPES. 373 * CONFIG_SAMPR_TYPES.
373 * Some hypothetical target with independent rates would need slightly 374 * Some hypothetical target with independent rates would need slightly
@@ -375,6 +376,7 @@ void pcm_set_frequency(unsigned int samplerate)
375 if (type == SAMPR_TYPE_REC) 376 if (type == SAMPR_TYPE_REC)
376 samplerate = pcm_sampr_type_rec_to_play(samplerate); 377 samplerate = pcm_sampr_type_rec_to_play(samplerate);
377#endif 378#endif
379#endif /* HAVE_RECORDING */
378#endif /* CONFIG_SAMPR_TYPES */ 380#endif /* CONFIG_SAMPR_TYPES */
379 381
380 index = round_value_to_list32(samplerate, hw_freq_sampr, 382 index = round_value_to_list32(samplerate, hw_freq_sampr,