summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/recorder/recording.c43
-rw-r--r--firmware/export/audio.h1
2 files changed, 22 insertions, 22 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 0ab894604c..0af31c7f9d 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -601,37 +601,36 @@ static bool check_dir(char *folder)
601 return true; 601 return true;
602} 602}
603 603
604/* the list below must match enum audio_sources in audio.h */
605static const char* const prestr[] =
606{
607#ifdef HAVE_MIC_IN
608 "R_MIC_",
609#endif
610#ifdef HAVE_LINE_REC
611 "R_LINE_",
612#endif
613#ifdef HAVE_SPDIF_IN
614 "R_SPDIF_",
615#endif
616#ifdef HAVE_FMRADIO_REC
617 "R_FM_",
618#endif
619};
620
604char *rec_create_filename(char *buffer) 621char *rec_create_filename(char *buffer)
605{ 622{
606 char ext[16]; 623 char ext[16];
607 char *pref = "R_"; 624 const char *pref = "R_";
608 625
609 strcpy(buffer,global_settings.rec_directory); 626 strcpy(buffer,global_settings.rec_directory);
610 if (!check_dir(buffer)) 627 if (!check_dir(buffer))
611 return NULL; 628 return NULL;
612 629
613 switch(global_settings.rec_source) 630 if((global_settings.rec_source > AUDIO_SRC_PLAYBACK) &&
631 (global_settings.rec_source < AUDIO_NUM_SOURCES))
614 { 632 {
615#ifdef HAVE_MIC_IN 633 pref = prestr[global_settings.rec_source];
616 case AUDIO_SRC_MIC:
617 pref = "R_MIC_";
618 break;
619#endif
620#ifdef HAVE_LINE_REC
621 case AUDIO_SRC_LINEIN:
622 pref = "R_LINE_";
623 break;
624#endif
625#ifdef HAVE_FMRADIO_REC
626 case AUDIO_SRC_FMRADIO:
627 pref = "R_FM_";
628 break;
629#endif
630#ifdef HAVE_SPDIF_IN
631 case AUDIO_SRC_SPDIF:
632 pref = "R_SPDIF_";
633 break;
634#endif
635 } 634 }
636 635
637 snprintf(ext, sizeof(ext), ".%s", 636 snprintf(ext, sizeof(ext), ".%s",
diff --git a/firmware/export/audio.h b/firmware/export/audio.h
index 933076537e..b55c46a573 100644
--- a/firmware/export/audio.h
+++ b/firmware/export/audio.h
@@ -129,6 +129,7 @@ enum rec_channel_modes
129#define CHN_CAP_ALL (CHN_CAP_STEREO | CHN_CAP_MONO) 129#define CHN_CAP_ALL (CHN_CAP_STEREO | CHN_CAP_MONO)
130#endif /* CONFIG_CODEC == SWCODEC */ 130#endif /* CONFIG_CODEC == SWCODEC */
131 131
132/* the enums below must match prestr[] in recording.c */
132enum audio_sources 133enum audio_sources
133{ 134{
134 AUDIO_SRC_PLAYBACK = -1, /* Virtual source */ 135 AUDIO_SRC_PLAYBACK = -1, /* Virtual source */