diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2007-08-02 18:45:38 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2007-08-02 18:45:38 +0000 |
commit | c21abddaae1102087afdad5dcc0531ce6c6add1f (patch) | |
tree | a41dec5c56c6c0aff1ff67b16ff2db11e661b6d0 /apps/recorder | |
parent | 83c003dbcc90679a0e39d5903970dbe804eef91f (diff) |
Even more optimizing for the recording name change...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14148 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/recording.c | 43 |
1 files changed, 21 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) return true; } +/* the list below must match enum audio_sources in audio.h */ +static const char* const prestr[] = +{ +#ifdef HAVE_MIC_IN + "R_MIC_", +#endif +#ifdef HAVE_LINE_REC + "R_LINE_", +#endif +#ifdef HAVE_SPDIF_IN + "R_SPDIF_", +#endif +#ifdef HAVE_FMRADIO_REC + "R_FM_", +#endif +}; + char *rec_create_filename(char *buffer) { char ext[16]; - char *pref = "R_"; + const char *pref = "R_"; strcpy(buffer,global_settings.rec_directory); if (!check_dir(buffer)) return NULL; - switch(global_settings.rec_source) + if((global_settings.rec_source > AUDIO_SRC_PLAYBACK) && + (global_settings.rec_source < AUDIO_NUM_SOURCES)) { -#ifdef HAVE_MIC_IN - case AUDIO_SRC_MIC: - pref = "R_MIC_"; - break; -#endif -#ifdef HAVE_LINE_REC - case AUDIO_SRC_LINEIN: - pref = "R_LINE_"; - break; -#endif -#ifdef HAVE_FMRADIO_REC - case AUDIO_SRC_FMRADIO: - pref = "R_FM_"; - break; -#endif -#ifdef HAVE_SPDIF_IN - case AUDIO_SRC_SPDIF: - pref = "R_SPDIF_"; - break; -#endif + pref = prestr[global_settings.rec_source]; } snprintf(ext, sizeof(ext), ".%s", |