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 @@ #include #include "config.h" #include "audiohw.h" +#include "pcm_sampr.h" /** * 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) void audiohw_set_depth_3d(int value) { (void)value; } #endif -#if defined(HAVE_SAMPR_TYPE_REC) -unsigned int pcm_sampr_type_rec_to_play(int samplerate) +#ifdef HAVE_RECORDING +#if SAMPR_TYPE_REC != 0 +unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate) { return samplerate; } #endif +#endif /* HAVE_RECORDING */ #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) int mas_codec_readreg(int reg) { 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 @@ #define REC_FREQ_DEFAULT REC_FREQ_22 /* Default is not 44.1kHz */ #define REC_SAMPR_DEFAULT SAMPR_22 +/* because the samplerates don't match at each point, we must be able to + * tell PCM which set of rates to use. not needed if recording rates are + * a simple subset of playback rates and are equal values. */ +#define CONFIG_SAMPR_TYPES + /* Define bitmask of input sources - recordable bitmask can be defined explicitly if different */ #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]; #define SAMPR_TYPE_REC (0x01 << 24) #endif -unsigned int sampr_type_rec_to_play(unsigned int samplerate); +unsigned int pcm_sampr_type_rec_to_play(unsigned int samplerate); #else /* ndef CONFIG_SAMPR_TYPES */ 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) unsigned int type = samplerate & SAMPR_TYPE_MASK; samplerate &= ~SAMPR_TYPE_MASK; -#ifdef SAMPR_TYPE_REC +#ifdef HAVE_RECORDING +#if SAMPR_TYPE_REC != 0 /* For now, supported targets have direct conversion when configured with * CONFIG_SAMPR_TYPES. * Some hypothetical target with independent rates would need slightly @@ -375,6 +376,7 @@ void pcm_set_frequency(unsigned int samplerate) if (type == SAMPR_TYPE_REC) samplerate = pcm_sampr_type_rec_to_play(samplerate); #endif +#endif /* HAVE_RECORDING */ #endif /* CONFIG_SAMPR_TYPES */ index = round_value_to_list32(samplerate, hw_freq_sampr,