From 8f659ae8d3845b40ff93ebfa3692f7b2302e6c7e Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sun, 20 May 2007 20:26:36 +0000 Subject: Use bitmasks to define which inputs are available. Makes it easier to remove old assumptions of which are available. Inspired by e200 being unique in having FM Radio and Mic but no Line. Doesn't remove the assumption that Mic is available or that one of Mic and/or Line is available just to avoid excessive #ifdef'ing until needed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13448 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/audio.h | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'firmware/export/audio.h') diff --git a/firmware/export/audio.h b/firmware/export/audio.h index ebcb316cd9..a0da846215 100644 --- a/firmware/export/audio.h +++ b/firmware/export/audio.h @@ -127,32 +127,37 @@ enum rec_channel_modes #define CHN_CAP_ALL (CHN_CAP_STEREO | CHN_CAP_MONO) #endif /* CONFIG_CODEC == SWCODEC */ -/* audio sources */ enum audio_sources { - AUDIO_SRC_PLAYBACK = -1, /* for audio playback (default) */ - AUDIO_SRC_MIC, /* monitor mic */ - AUDIO_SRC_LINEIN, /* monitor line in */ -#ifdef HAVE_SPDIF_IN - AUDIO_SRC_SPDIF, /* monitor spdif */ -#endif -#if defined(HAVE_FMRADIO_IN) || CONFIG_TUNER - AUDIO_SRC_FMRADIO, /* monitor fm radio */ -#endif - /* define new audio sources above this line */ - AUDIO_SOURCE_LIST_END, - /* AUDIO_SRC_FMRADIO must be declared #if CONFIG_TUNER but is not in - the list of recordable sources. HAVE_FMRADIO_IN implies CONFIG_TUNER. */ -#if defined(HAVE_FMRADIO_IN) || (CONFIG_TUNER == 0) - AUDIO_NUM_SOURCES = AUDIO_SOURCE_LIST_END, -#else - AUDIO_NUM_SOURCES = AUDIO_SOURCE_LIST_END-1, -#endif - AUDIO_SRC_MAX = AUDIO_NUM_SOURCES-1 + AUDIO_SRC_PLAYBACK = -1, /* Virtual source */ + HAVE_MIC_IN_(AUDIO_SRC_MIC,) + HAVE_LINE_IN_(AUDIO_SRC_LINEIN,) + HAVE_SPDIF_IN_(AUDIO_SRC_SPDIF,) + HAVE_FMRADIO_IN_(AUDIO_SRC_FMRADIO,) + AUDIO_NUM_SOURCES, + AUDIO_SRC_MAX = AUDIO_NUM_SOURCES-1, + AUDIO_SRC_DEFAULT = AUDIO_SRC_PLAYBACK }; +#ifdef HAVE_RECORDING +/* Recordable source implies it has the input as well */ + +/* For now there's no restrictions on any targets with which inputs + are recordable so define them as equivalent - if they do differ, + special handling is needed right now. */ +enum rec_sources +{ + __REC_SRC_FIRST = -1, + HAVE_MIC_REC_(REC_SRC_MIC,) + HAVE_LINE_REC_(REC_SRC_LINEIN,) + HAVE_SPDIF_REC_(REC_SRC_SPDIF,) + HAVE_FMRADIO_REC_(REC_SRC_FMRADIO,) + REC_NUM_SOURCES +}; +#endif /* HAVE_RECORDING */ + #if CONFIG_CODEC == SWCODEC -/* selects an audio source for recording or playback */ +/* selects a source to monitor for recording or playback */ #define SRCF_PLAYBACK 0x0000 /* default */ #define SRCF_RECORDING 0x1000 #if CONFIG_TUNER -- cgit v1.2.3