From a4bfe37c6cdcc2e70b2b6d5d486531fa2986370b Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Thu, 11 May 2006 22:55:24 +0000 Subject: Optical S/PDIF recording and monitoring for Iriver H1x0. Removed unsupported recording options on Iriver. Sample rate displayed in recording screen reflects the real S/PDIF sample rate when doing S/PDIF recording. Testing would be appreciated. Thanks to Jens Arnold for fixing the DMA hang issue. Will reset settings! git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9916 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/recording.c | 23 +++++++++++++++++++---- apps/settings.c | 6 +++++- apps/sound_menu.c | 20 +++++++++++++++----- 3 files changed, 39 insertions(+), 10 deletions(-) (limited to 'apps') diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index cf361eea76..854e979ade 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c @@ -577,6 +577,11 @@ bool recording_screen(void) #endif talk_buffer_steal(); /* will use the mp3 buffer */ +#ifdef HAVE_SPDIF_POWER + /* Tell recording whether we want S/PDIF power enabled at all times */ + audio_set_spdif_power_setting(global_settings.spdif_enable); +#endif + audio_set_recording_options(global_settings.rec_frequency, global_settings.rec_quality, global_settings.rec_source, @@ -1011,6 +1016,7 @@ bool recording_screen(void) unsigned int dseconds, dhours, dminutes; unsigned long num_recorded_bytes; int pos = 0; + char spdif_sfreq[8]; update_countdown = 5; last_seconds = seconds; @@ -1259,12 +1265,21 @@ bool recording_screen(void) 2+PM_HEIGHT, true); } } - +/* Can't measure S/PDIF sample rate on Archos yet */ +#if CONFIG_CODEC != MAS3587F && defined(HAVE_SPDIF_IN) + if (global_settings.rec_source == SOURCE_SPDIF) + snprintf(spdif_sfreq, 8, "%dHz", audio_get_spdif_sample_rate()); +#else + (void)spdif_sfreq; +#endif snprintf(buf, 32, "%s %s", +#if CONFIG_CODEC != MAS3587F && defined(HAVE_SPDIF_IN) + global_settings.rec_source == SOURCE_SPDIF ? + spdif_sfreq : +#endif freq_str[global_settings.rec_frequency], - global_settings.rec_channels? - str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO)); - + global_settings.rec_channels ? + str(LANG_CHANNEL_MONO) : str(LANG_CHANNEL_STEREO)); FOR_NB_SCREENS(i) screens[i].puts(0, 5+PM_HEIGHT, buf); diff --git a/apps/settings.c b/apps/settings.c index ad1ec70c07..ccf0acd8f9 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -94,7 +94,7 @@ const char rec_base_directory[] = REC_BASE_DIR; #include "dsp.h" #endif -#define CONFIG_BLOCK_VERSION 41 +#define CONFIG_BLOCK_VERSION 42 #define CONFIG_BLOCK_SIZE 512 #define RTC_BLOCK_SIZE 44 @@ -504,7 +504,11 @@ static const struct bit_entry hd_bits[] = "off,00:05,00:10,00:15,00:30,01:00,01:14,01:20,02:00,04:00,06:00,08:00,10:00,12:00,18:00,24:00" }, {1, S_O(rec_channels), 0, "rec channels", "stereo,mono" }, {4, S_O(rec_mic_gain), 4, "rec mic gain", NULL }, +#ifdef HAVE_SPDIF_IN + {2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" }, +#else {1, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line" }, +#endif {3, S_O(rec_frequency), 0, /* 0=44.1kHz */ "rec frequency", "44,48,32,22,24,16" }, {4, S_O(rec_left_gain), 2, /* 0dB */ diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 1d389f30de..d3377a3efa 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c @@ -302,6 +302,8 @@ static bool recsource(void) sizeof(names)/sizeof(struct opt_items), NULL ); } +/* To be removed when we add support for sample rates and channel settings */ +#ifndef HAVE_UDA1380 static bool recfrequency(void) { static const struct opt_items names[] = { @@ -327,12 +329,11 @@ static bool recchannels(void) &global_settings.rec_channels, INT, names, 2, NULL ); } +#endif +#if CONFIG_CODEC == MAS3587F static bool recquality(void) { -#ifdef HAVE_UDA1380 - (void)recquality(); -#endif return set_int(str(LANG_RECORDING_QUALITY), "", UNIT_INT, &global_settings.rec_quality, NULL, 1, 0, 7, NULL ); @@ -343,7 +344,7 @@ static bool receditable(void) return set_bool(str(LANG_RECORDING_EDITABLE), &global_settings.rec_editable); } - +#endif static bool rectimesplit(void) { @@ -901,20 +902,29 @@ bool recording_menu(bool no_source) struct menu_item items[13]; bool result; -#ifndef HAVE_UDA1380 +#if CONFIG_CODEC == MAS3587F items[i].desc = ID2P(LANG_RECORDING_QUALITY); items[i++].function = recquality; #endif +/* We don't support frequency selection for UDA1380 yet. Let it just stay at + the default 44100 Hz. */ +#ifndef HAVE_UDA1380 items[i].desc = ID2P(LANG_RECORDING_FREQUENCY); items[i++].function = recfrequency; +#endif if(!no_source) { items[i].desc = ID2P(LANG_RECORDING_SOURCE); items[i++].function = recsource; } +/* We don't support other configurations than stereo yet either */ +#ifndef HAVE_UDA1380 items[i].desc = ID2P(LANG_RECORDING_CHANNELS); items[i++].function = recchannels; +#endif +#if CONFIG_CODEC == MAS3587F items[i].desc = ID2P(LANG_RECORDING_EDITABLE); items[i++].function = receditable; +#endif items[i].desc = ID2P(LANG_RECORD_TIMESPLIT); items[i++].function = rectimesplit; items[i].desc = ID2P(LANG_RECORD_PRERECORD_TIME); -- cgit v1.2.3