2003-05-03 02:40:09 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Linus Nielsen Feltzing
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2003-05-03 02:40:09 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdbool.h>
|
2007-03-16 14:40:40 +00:00
|
|
|
#include <stdlib.h>
|
2003-05-03 02:40:09 +00:00
|
|
|
#include "settings.h"
|
|
|
|
#include "button.h"
|
|
|
|
#include "status.h"
|
2007-03-16 14:40:40 +00:00
|
|
|
#include "thread.h"
|
2005-04-04 12:36:06 +00:00
|
|
|
#include "audio.h"
|
2004-01-05 22:46:54 +00:00
|
|
|
#include "mp3_playback.h"
|
2003-05-04 02:23:18 +00:00
|
|
|
#include "ctype.h"
|
|
|
|
#include "file.h"
|
2009-02-10 23:43:37 +00:00
|
|
|
#include "general.h"
|
2003-05-04 02:23:18 +00:00
|
|
|
#include "errno.h"
|
2010-05-06 21:04:40 +00:00
|
|
|
#include "string-extra.h"
|
2003-05-04 02:23:18 +00:00
|
|
|
#include "system.h"
|
|
|
|
#include "radio.h"
|
|
|
|
#include "menu.h"
|
|
|
|
#include "misc.h"
|
|
|
|
#include "keyboard.h"
|
|
|
|
#include "screens.h"
|
2003-11-05 09:46:08 +00:00
|
|
|
#include "peakmeter.h"
|
|
|
|
#include "lang.h"
|
2003-11-06 00:47:47 +00:00
|
|
|
#include "font.h"
|
2003-11-20 00:33:43 +00:00
|
|
|
#include "sound_menu.h"
|
2007-10-02 21:04:10 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
2003-11-20 00:33:43 +00:00
|
|
|
#include "recording.h"
|
2007-10-02 21:04:10 +00:00
|
|
|
#endif
|
2009-12-01 17:54:40 +00:00
|
|
|
#ifdef IPOD_ACCESSORY_PROTOCOL
|
|
|
|
#include "iap.h"
|
|
|
|
#endif
|
2010-05-12 10:38:00 +00:00
|
|
|
#include "appevents.h"
|
2004-03-19 22:15:53 +00:00
|
|
|
#include "talk.h"
|
2004-10-15 21:41:46 +00:00
|
|
|
#include "tuner.h"
|
2004-10-17 08:53:18 +00:00
|
|
|
#include "power.h"
|
2005-04-01 14:09:41 +00:00
|
|
|
#include "sound.h"
|
2005-11-13 21:03:53 +00:00
|
|
|
#include "screen_access.h"
|
|
|
|
#include "splash.h"
|
2005-11-19 14:54:41 +00:00
|
|
|
#include "yesno.h"
|
2005-11-20 01:02:14 +00:00
|
|
|
#include "buttonbar.h"
|
2006-04-02 12:23:08 +00:00
|
|
|
#include "tree.h"
|
|
|
|
#include "dir.h"
|
2006-09-22 12:18:58 +00:00
|
|
|
#include "action.h"
|
2007-02-27 09:06:30 +00:00
|
|
|
#include "list.h"
|
|
|
|
#include "menus/exported_menus.h"
|
2007-03-01 11:14:46 +00:00
|
|
|
#include "root_menu.h"
|
2008-05-29 11:13:46 +00:00
|
|
|
#include "viewport.h"
|
2010-05-12 10:38:00 +00:00
|
|
|
#include "skin_engine/skin_engine.h"
|
|
|
|
#include "statusbar-skinned.h"
|
2010-05-16 11:13:42 +00:00
|
|
|
#include "buffering.h"
|
2010-05-26 04:59:39 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
#include "playback.h"
|
|
|
|
#endif
|
2010-07-06 15:10:11 +00:00
|
|
|
#include "presets.h"
|
2003-05-03 02:40:09 +00:00
|
|
|
|
2007-02-18 08:46:12 +00:00
|
|
|
#if CONFIG_TUNER
|
2003-05-03 02:40:09 +00:00
|
|
|
|
2004-10-10 17:12:43 +00:00
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
2006-09-22 12:18:58 +00:00
|
|
|
#define FM_RECORD
|
|
|
|
#define FM_PRESET_ADD
|
|
|
|
#define FM_PRESET_ACTION
|
|
|
|
#define FM_PRESET
|
2006-09-23 11:05:13 +00:00
|
|
|
#define FM_MODE
|
2005-11-29 15:10:07 +00:00
|
|
|
|
2005-12-15 01:11:19 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
|
2006-09-22 12:18:58 +00:00
|
|
|
#define FM_PRESET
|
2006-09-23 11:05:13 +00:00
|
|
|
#define FM_MODE
|
2006-09-23 12:22:01 +00:00
|
|
|
#define FM_NEXT_PRESET
|
|
|
|
#define FM_PREV_PRESET
|
2005-11-29 15:10:07 +00:00
|
|
|
|
2007-11-11 16:00:33 +00:00
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H10_PAD
|
|
|
|
#define FM_PRESET
|
|
|
|
#define FM_MODE
|
|
|
|
|
2007-03-16 23:02:39 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD)
|
2006-09-22 12:18:58 +00:00
|
|
|
#define FM_PRESET
|
2006-09-23 11:05:13 +00:00
|
|
|
#define FM_MODE
|
2007-03-16 14:40:40 +00:00
|
|
|
/* This should be removeable if the whole tuning thing is sorted out since
|
|
|
|
proper tuning quiets the screen almost entirely in that extreme measures
|
|
|
|
have to be taken to hear any interference. */
|
|
|
|
#define HAVE_NOISY_IDLE_MODE
|
2006-09-22 12:18:58 +00:00
|
|
|
|
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
|
|
|
#define FM_RECORD_DBLPRE
|
|
|
|
#define FM_RECORD
|
2010-06-18 22:14:45 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || (CONFIG_KEYPAD == SANSA_C200_PAD) ||\
|
|
|
|
(CONFIG_KEYPAD == SANSA_FUZE_PAD) || (CONFIG_KEYPAD == SANSA_CLIP_PAD)
|
2010-05-12 10:38:00 +00:00
|
|
|
#define FM_MENU
|
2008-08-03 22:47:33 +00:00
|
|
|
#define FM_PRESET
|
2010-05-12 10:38:00 +00:00
|
|
|
#define FM_STOP
|
2007-06-06 19:23:48 +00:00
|
|
|
#define FM_MODE
|
2010-05-12 10:38:00 +00:00
|
|
|
#define FM_EXIT
|
|
|
|
#define FM_PLAY
|
2008-12-09 20:48:04 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD)
|
|
|
|
#define FM_PRESET
|
|
|
|
#define FM_MODE
|
2009-03-21 00:13:20 +00:00
|
|
|
|
2009-12-15 20:51:41 +00:00
|
|
|
#elif (CONFIG_KEYPAD == COWON_D2_PAD)
|
2010-05-12 10:38:00 +00:00
|
|
|
#define FM_MENU
|
2009-03-21 00:13:20 +00:00
|
|
|
#define FM_PRESET
|
2010-05-12 10:38:00 +00:00
|
|
|
#define FM_STOP
|
|
|
|
#define FM_MODE
|
|
|
|
#define FM_EXIT
|
|
|
|
#define FM_PLAY
|
2009-12-01 17:54:40 +00:00
|
|
|
|
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == IPOD_1G2G_PAD)
|
2010-05-12 10:38:00 +00:00
|
|
|
#define FM_MENU
|
|
|
|
#define FM_STOP
|
|
|
|
#define FM_EXIT
|
|
|
|
#define FM_PLAY
|
2009-12-01 17:54:40 +00:00
|
|
|
#define FM_MODE
|
|
|
|
|
2010-11-02 12:15:39 +00:00
|
|
|
#elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
|
|
|
|
#define FM_MENU
|
|
|
|
#define FM_STOP
|
|
|
|
#define FM_EXIT
|
|
|
|
#define FM_PLAY
|
|
|
|
#define FM_MODE
|
|
|
|
#define FM_STOP
|
|
|
|
|
2004-10-10 17:12:43 +00:00
|
|
|
#endif
|
|
|
|
|
2010-05-17 15:03:59 +00:00
|
|
|
/* presets.c needs these so keep unstatic or redo the whole thing! */
|
|
|
|
int curr_freq; /* current frequency in Hz */
|
|
|
|
|
2010-07-06 15:10:11 +00:00
|
|
|
static bool radio_menu(void);
|
2010-05-17 15:03:59 +00:00
|
|
|
|
|
|
|
int radio_mode = RADIO_SCAN_MODE;
|
2007-03-29 01:55:47 +00:00
|
|
|
static int search_dir = 0;
|
2003-05-03 02:40:09 +00:00
|
|
|
|
2010-03-31 19:59:50 +00:00
|
|
|
static int radio_status = FMRADIO_OFF;
|
2008-08-03 22:47:33 +00:00
|
|
|
static bool in_screen = false;
|
2007-02-08 10:36:49 +00:00
|
|
|
|
2006-04-02 12:23:08 +00:00
|
|
|
|
2010-03-31 19:59:50 +00:00
|
|
|
static void radio_off(void);
|
2003-05-04 02:23:18 +00:00
|
|
|
|
2010-05-12 10:38:00 +00:00
|
|
|
bool radio_scan_mode(void)
|
|
|
|
{
|
|
|
|
return radio_mode == RADIO_SCAN_MODE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool radio_is_stereo(void)
|
|
|
|
{
|
|
|
|
return tuner_get(RADIO_STEREO) && !global_settings.fm_force_mono;
|
|
|
|
}
|
|
|
|
int radio_current_frequency(void)
|
|
|
|
{
|
|
|
|
return curr_freq;
|
|
|
|
}
|
|
|
|
|
2006-04-02 12:23:08 +00:00
|
|
|
/* Function to manipulate all yesno dialogues.
|
|
|
|
This function needs the output text as an argument. */
|
2010-05-17 15:03:59 +00:00
|
|
|
bool yesno_pop(const char* text)
|
2006-04-02 12:23:08 +00:00
|
|
|
{
|
|
|
|
int i;
|
2008-04-26 09:30:24 +00:00
|
|
|
const char *lines[]={text};
|
|
|
|
const struct text_message message={lines, 1};
|
2006-04-02 12:23:08 +00:00
|
|
|
bool ret = (gui_syncyesno_run(&message,NULL,NULL)== YESNO_YES);
|
|
|
|
FOR_NB_SCREENS(i)
|
2008-05-29 11:13:46 +00:00
|
|
|
screens[i].clear_viewport();
|
2006-04-02 12:23:08 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-10-15 21:41:46 +00:00
|
|
|
void radio_init(void)
|
2003-05-09 00:14:59 +00:00
|
|
|
{
|
2007-03-16 14:40:40 +00:00
|
|
|
tuner_init();
|
2010-03-31 19:59:50 +00:00
|
|
|
radio_off();
|
2010-05-17 15:03:59 +00:00
|
|
|
#ifdef HAVE_ALBUMART
|
|
|
|
radioart_init(false);
|
2010-05-16 11:13:42 +00:00
|
|
|
#endif
|
2004-07-05 14:30:17 +00:00
|
|
|
}
|
2003-05-09 00:14:59 +00:00
|
|
|
|
2005-11-19 19:23:44 +00:00
|
|
|
int get_radio_status(void)
|
|
|
|
{
|
2007-02-08 10:36:49 +00:00
|
|
|
return radio_status;
|
2006-08-28 22:38:41 +00:00
|
|
|
}
|
|
|
|
|
2008-08-03 22:47:33 +00:00
|
|
|
bool in_radio_screen(void)
|
|
|
|
{
|
|
|
|
return in_screen;
|
|
|
|
}
|
2007-02-08 10:36:49 +00:00
|
|
|
|
2008-08-03 22:47:33 +00:00
|
|
|
/* TODO: Move some more of the control functionality to firmware
|
|
|
|
and clean up the mess */
|
2007-06-06 19:23:48 +00:00
|
|
|
|
2006-08-28 22:38:41 +00:00
|
|
|
/* secret flag for starting paused - prevents unmute */
|
|
|
|
#define FMRADIO_START_PAUSED 0x8000
|
|
|
|
void radio_start(void)
|
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
const struct fm_region_data *fmr;
|
2006-08-28 22:38:41 +00:00
|
|
|
bool start_paused;
|
|
|
|
|
2007-02-08 10:36:49 +00:00
|
|
|
if(radio_status == FMRADIO_PLAYING)
|
2006-08-28 22:38:41 +00:00
|
|
|
return;
|
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
fmr = &fm_region_data[global_settings.fm_region];
|
2007-03-16 14:40:40 +00:00
|
|
|
|
2007-02-08 10:36:49 +00:00
|
|
|
start_paused = radio_status & FMRADIO_START_PAUSED;
|
2006-08-28 22:38:41 +00:00
|
|
|
/* clear flag before any yielding */
|
2007-02-08 10:36:49 +00:00
|
|
|
radio_status &= ~FMRADIO_START_PAUSED;
|
2006-08-28 22:38:41 +00:00
|
|
|
|
2007-02-08 10:36:49 +00:00
|
|
|
if(radio_status == FMRADIO_OFF)
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_power(true);
|
2006-08-28 22:38:41 +00:00
|
|
|
|
2008-08-03 22:47:33 +00:00
|
|
|
curr_freq = global_status.last_frequency * fmr->freq_step + fmr->freq_min;
|
2006-08-28 22:38:41 +00:00
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_SLEEP, 0); /* wake up the tuner */
|
2007-06-06 19:23:48 +00:00
|
|
|
|
2007-02-08 10:36:49 +00:00
|
|
|
if(radio_status == FMRADIO_OFF)
|
2006-08-28 22:38:41 +00:00
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
#ifdef HAVE_RADIO_REGION
|
|
|
|
tuner_set(RADIO_REGION, global_settings.fm_region);
|
2006-10-12 19:27:00 +00:00
|
|
|
#endif
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_FORCE_MONO, global_settings.fm_force_mono);
|
2006-08-28 22:38:41 +00:00
|
|
|
}
|
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_FREQUENCY, curr_freq);
|
|
|
|
|
|
|
|
#ifdef HAVE_RADIO_MUTE_TIMEOUT
|
2006-08-28 22:38:41 +00:00
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
unsigned long mute_timeout = current_tick + HZ;
|
|
|
|
if (radio_status != FMRADIO_OFF)
|
|
|
|
{
|
|
|
|
/* paused */
|
|
|
|
mute_timeout += HZ;
|
|
|
|
}
|
|
|
|
|
|
|
|
while(!tuner_get(RADIO_STEREO) && !tuner_get(RADIO_TUNED))
|
|
|
|
{
|
|
|
|
if(TIME_AFTER(current_tick, mute_timeout))
|
|
|
|
break;
|
|
|
|
yield();
|
|
|
|
}
|
2006-08-28 22:38:41 +00:00
|
|
|
}
|
2007-07-14 11:20:31 +00:00
|
|
|
#endif
|
2006-08-28 22:38:41 +00:00
|
|
|
|
|
|
|
/* keep radio from sounding initially */
|
|
|
|
if(!start_paused)
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_MUTE, 0);
|
2006-08-28 22:38:41 +00:00
|
|
|
|
2007-02-08 10:36:49 +00:00
|
|
|
radio_status = FMRADIO_PLAYING;
|
2006-08-28 22:38:41 +00:00
|
|
|
} /* radio_start */
|
|
|
|
|
|
|
|
void radio_pause(void)
|
|
|
|
{
|
2007-02-08 10:36:49 +00:00
|
|
|
if(radio_status == FMRADIO_PAUSED)
|
2006-08-28 22:38:41 +00:00
|
|
|
return;
|
|
|
|
|
2007-02-08 10:36:49 +00:00
|
|
|
if(radio_status == FMRADIO_OFF)
|
2006-08-28 22:38:41 +00:00
|
|
|
{
|
2008-08-03 22:47:33 +00:00
|
|
|
radio_status |= FMRADIO_START_PAUSED;
|
2006-08-28 22:38:41 +00:00
|
|
|
radio_start();
|
|
|
|
}
|
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_MUTE, 1);
|
2010-05-24 20:12:10 +00:00
|
|
|
/* For si4700: 2==this is really 'pause'. other tuners treat it
|
|
|
|
* like 'bool'. */
|
|
|
|
tuner_set(RADIO_SLEEP, 2);
|
2006-08-28 22:38:41 +00:00
|
|
|
|
2007-02-08 10:36:49 +00:00
|
|
|
radio_status = FMRADIO_PAUSED;
|
2006-08-28 22:38:41 +00:00
|
|
|
} /* radio_pause */
|
|
|
|
|
2010-03-31 19:59:50 +00:00
|
|
|
static void radio_off(void)
|
2006-08-28 22:38:41 +00:00
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_MUTE, 1);
|
|
|
|
tuner_set(RADIO_SLEEP, 1); /* low power mode, if available */
|
2007-02-08 10:36:49 +00:00
|
|
|
radio_status = FMRADIO_OFF;
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_power(false); /* status update, power off if avail. */
|
2010-03-31 19:59:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void radio_stop(void)
|
|
|
|
{
|
|
|
|
if(radio_status == FMRADIO_OFF)
|
|
|
|
return;
|
|
|
|
|
|
|
|
radio_off();
|
2006-08-28 22:38:41 +00:00
|
|
|
} /* radio_stop */
|
2003-05-09 00:14:59 +00:00
|
|
|
|
2003-12-19 01:24:02 +00:00
|
|
|
bool radio_hardware_present(void)
|
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
return tuner_get(RADIO_PRESENT);
|
2003-12-19 01:24:02 +00:00
|
|
|
}
|
|
|
|
|
2007-03-16 14:40:40 +00:00
|
|
|
/* Keep freq on the grid for the current region */
|
2010-05-17 15:03:59 +00:00
|
|
|
int snap_freq_to_grid(int freq)
|
2007-03-16 14:40:40 +00:00
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
const struct fm_region_data * const fmr =
|
|
|
|
&fm_region_data[global_settings.fm_region];
|
2007-03-16 14:40:40 +00:00
|
|
|
|
|
|
|
/* Range clamp if out of range or just round to nearest */
|
|
|
|
if (freq < fmr->freq_min)
|
|
|
|
freq = fmr->freq_min;
|
|
|
|
else if (freq > fmr->freq_max)
|
|
|
|
freq = fmr->freq_max;
|
|
|
|
else
|
|
|
|
freq = (freq - fmr->freq_min + fmr->freq_step/2) /
|
|
|
|
fmr->freq_step * fmr->freq_step + fmr->freq_min;
|
|
|
|
|
|
|
|
return freq;
|
|
|
|
}
|
|
|
|
|
2010-05-17 15:03:59 +00:00
|
|
|
void remember_frequency(void)
|
2004-07-12 13:28:44 +00:00
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
const struct fm_region_data * const fmr =
|
|
|
|
&fm_region_data[global_settings.fm_region];
|
2007-03-16 14:40:40 +00:00
|
|
|
global_status.last_frequency = (curr_freq - fmr->freq_min)
|
|
|
|
/ fmr->freq_step;
|
2007-01-24 02:19:22 +00:00
|
|
|
status_save();
|
2004-07-12 13:28:44 +00:00
|
|
|
}
|
|
|
|
|
2007-03-16 14:40:40 +00:00
|
|
|
/* Step to the next or previous frequency */
|
|
|
|
static int step_freq(int freq, int direction)
|
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
const struct fm_region_data * const fmr =
|
|
|
|
&fm_region_data[global_settings.fm_region];
|
2007-03-16 14:40:40 +00:00
|
|
|
|
|
|
|
freq += direction*fmr->freq_step;
|
|
|
|
|
|
|
|
/* Wrap first or snapping to grid will not let us on the band extremes */
|
|
|
|
if (freq > fmr->freq_max)
|
|
|
|
freq = direction > 0 ? fmr->freq_min : fmr->freq_max;
|
|
|
|
else if (freq < fmr->freq_min)
|
|
|
|
freq = direction < 0 ? fmr->freq_max : fmr->freq_min;
|
|
|
|
else
|
|
|
|
freq = snap_freq_to_grid(freq);
|
|
|
|
|
|
|
|
return freq;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Step to the next or previous station */
|
2010-05-17 15:03:59 +00:00
|
|
|
void next_station(int direction)
|
2007-03-16 14:40:40 +00:00
|
|
|
{
|
|
|
|
if (direction != 0 && radio_mode != RADIO_SCAN_MODE)
|
|
|
|
{
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_next(direction);
|
2007-03-16 14:40:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
curr_freq = step_freq(curr_freq, direction);
|
|
|
|
|
|
|
|
if (radio_status == FMRADIO_PLAYING)
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_MUTE, 1);
|
2007-03-16 14:40:40 +00:00
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_FREQUENCY, curr_freq);
|
2007-03-16 14:40:40 +00:00
|
|
|
|
|
|
|
if (radio_status == FMRADIO_PLAYING)
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_MUTE, 0);
|
2007-03-16 14:40:40 +00:00
|
|
|
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_set_current(preset_find(curr_freq));
|
2007-03-16 14:40:40 +00:00
|
|
|
remember_frequency();
|
|
|
|
}
|
2006-04-02 12:23:08 +00:00
|
|
|
|
2007-03-29 01:55:47 +00:00
|
|
|
/* Ends an in-progress search */
|
|
|
|
static void end_search(void)
|
|
|
|
{
|
|
|
|
if (search_dir != 0 && radio_status == FMRADIO_PLAYING)
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_MUTE, 0);
|
2007-03-29 01:55:47 +00:00
|
|
|
search_dir = 0;
|
|
|
|
}
|
|
|
|
|
2007-11-07 02:14:28 +00:00
|
|
|
/* Speak a frequency. */
|
2010-05-17 15:03:59 +00:00
|
|
|
void talk_freq(int freq, bool enqueue)
|
2007-11-07 02:14:28 +00:00
|
|
|
{
|
|
|
|
freq /= 10000;
|
|
|
|
talk_number(freq / 100, enqueue);
|
|
|
|
talk_id(LANG_POINT, true);
|
|
|
|
talk_number(freq % 100 / 10, true);
|
|
|
|
if (freq % 10)
|
|
|
|
talk_number(freq % 10, true);
|
|
|
|
}
|
|
|
|
|
2010-02-20 21:32:31 +00:00
|
|
|
|
2010-09-19 08:17:08 +00:00
|
|
|
void radio_screen(void)
|
2003-05-03 02:40:09 +00:00
|
|
|
{
|
|
|
|
bool done = false;
|
2007-03-16 14:40:40 +00:00
|
|
|
int button;
|
|
|
|
int i;
|
|
|
|
bool stereo = false, last_stereo = false;
|
2010-08-16 12:07:46 +00:00
|
|
|
int update_type = 0;
|
2003-11-06 00:47:47 +00:00
|
|
|
bool screen_freeze = false;
|
2007-03-16 14:40:40 +00:00
|
|
|
bool keep_playing = false;
|
2007-11-07 02:14:28 +00:00
|
|
|
bool talk = false;
|
2007-03-16 14:40:40 +00:00
|
|
|
#ifdef FM_RECORD_DBLPRE
|
|
|
|
int lastbutton = BUTTON_NONE;
|
|
|
|
unsigned long rec_lastclick = 0;
|
|
|
|
#endif
|
|
|
|
#if CONFIG_CODEC != SWCODEC
|
|
|
|
int timeout = current_tick + HZ/10;
|
2003-11-20 00:33:43 +00:00
|
|
|
unsigned int last_seconds = 0;
|
2010-06-21 16:53:00 +00:00
|
|
|
#if !defined(SIMULATOR)
|
2010-05-12 10:59:20 +00:00
|
|
|
unsigned int seconds = 0;
|
2006-11-06 18:07:30 +00:00
|
|
|
struct audio_recording_options rec_options;
|
2010-06-21 16:53:00 +00:00
|
|
|
#endif /* SIMULATOR */
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif /* CONFIG_CODEC != SWCODEC */
|
|
|
|
#ifndef HAVE_NOISY_IDLE_MODE
|
2006-03-07 11:49:06 +00:00
|
|
|
int button_timeout = current_tick + (2*HZ);
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif
|
|
|
|
|
2006-08-28 22:38:41 +00:00
|
|
|
/* change status to "in screen" */
|
2007-02-08 10:36:49 +00:00
|
|
|
in_screen = true;
|
2006-08-28 22:38:41 +00:00
|
|
|
|
2010-05-17 15:03:59 +00:00
|
|
|
if(radio_preset_count() <= 0)
|
2006-04-02 12:23:08 +00:00
|
|
|
{
|
|
|
|
radio_load_presets(global_settings.fmr_file);
|
|
|
|
}
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_get_global_state()->id3 = NULL;
|
2010-05-16 11:13:42 +00:00
|
|
|
#ifdef HAVE_ALBUMART
|
2010-05-17 15:03:59 +00:00
|
|
|
radioart_init(true);
|
2010-05-16 11:13:42 +00:00
|
|
|
#endif
|
2008-08-03 22:47:33 +00:00
|
|
|
|
|
|
|
if(radio_status == FMRADIO_OFF)
|
2006-08-28 22:38:41 +00:00
|
|
|
audio_stop();
|
2010-05-16 11:13:42 +00:00
|
|
|
|
2007-03-07 09:16:20 +00:00
|
|
|
#ifndef SIMULATOR
|
2006-08-28 22:38:41 +00:00
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2010-09-19 08:17:08 +00:00
|
|
|
rec_create_directory();
|
2006-04-30 23:18:21 +00:00
|
|
|
audio_init_recording(talk_get_bufsize());
|
2003-05-03 02:40:09 +00:00
|
|
|
|
2004-07-06 12:17:14 +00:00
|
|
|
sound_settings_apply();
|
2003-11-20 00:33:43 +00:00
|
|
|
/* Yes, we use the D/A for monitoring */
|
|
|
|
peak_meter_playback(true);
|
2003-05-03 02:40:09 +00:00
|
|
|
|
2010-05-09 13:01:59 +00:00
|
|
|
peak_meter_enable(true);
|
2004-03-19 22:15:53 +00:00
|
|
|
|
2006-11-06 18:07:30 +00:00
|
|
|
rec_init_recording_options(&rec_options);
|
|
|
|
rec_options.rec_source = AUDIO_SRC_LINEIN;
|
|
|
|
rec_set_recording_options(&rec_options);
|
2003-11-20 00:33:43 +00:00
|
|
|
|
2006-08-28 22:38:41 +00:00
|
|
|
audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
|
|
|
|
sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
|
2006-07-21 08:42:28 +00:00
|
|
|
|
2006-08-28 22:38:41 +00:00
|
|
|
#endif /* CONFIG_CODEC != SWCODEC */
|
|
|
|
#endif /* ndef SIMULATOR */
|
2005-08-13 17:35:02 +00:00
|
|
|
|
2006-08-28 22:38:41 +00:00
|
|
|
/* turn on radio */
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2010-05-26 04:51:24 +00:00
|
|
|
/* This should be done before touching audio settings */
|
|
|
|
while (!audio_is_thread_ready())
|
|
|
|
sleep(0);
|
|
|
|
|
2007-06-08 23:42:04 +00:00
|
|
|
audio_set_input_source(AUDIO_SRC_FMRADIO,
|
|
|
|
(radio_status == FMRADIO_PAUSED) ?
|
|
|
|
SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING);
|
2006-08-28 22:38:41 +00:00
|
|
|
#else
|
2007-02-08 10:36:49 +00:00
|
|
|
if (radio_status == FMRADIO_OFF)
|
2006-08-28 22:38:41 +00:00
|
|
|
radio_start();
|
2004-07-02 07:43:49 +00:00
|
|
|
#endif
|
2004-07-12 13:28:44 +00:00
|
|
|
|
2010-08-16 12:07:46 +00:00
|
|
|
if(radio_preset_count() < 1 && yesno_pop(ID2P(LANG_FM_FIRST_AUTOSCAN)))
|
2010-07-06 15:10:11 +00:00
|
|
|
presets_scan(NULL);
|
2008-08-03 22:47:33 +00:00
|
|
|
|
2010-10-17 11:24:36 +00:00
|
|
|
fms_fix_displays(FMS_ENTER);
|
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
skin_update(FM_SCREEN, i, SKIN_REFRESH_ALL);
|
|
|
|
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_set_current(preset_find(curr_freq));
|
2010-05-17 15:03:59 +00:00
|
|
|
if(radio_current_preset() != -1)
|
2005-11-13 21:03:53 +00:00
|
|
|
radio_mode = RADIO_PRESET_MODE;
|
2003-11-06 00:47:47 +00:00
|
|
|
|
2007-03-16 14:40:40 +00:00
|
|
|
#ifndef HAVE_NOISY_IDLE_MODE
|
2005-09-29 11:19:55 +00:00
|
|
|
cpu_idle_mode(true);
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif
|
|
|
|
|
2003-05-03 02:40:09 +00:00
|
|
|
while(!done)
|
|
|
|
{
|
2007-03-16 14:40:40 +00:00
|
|
|
if(search_dir != 0)
|
2003-05-03 02:40:09 +00:00
|
|
|
{
|
2007-03-16 14:40:40 +00:00
|
|
|
curr_freq = step_freq(curr_freq, search_dir);
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2003-05-03 02:40:09 +00:00
|
|
|
|
2007-07-14 11:20:31 +00:00
|
|
|
if(tuner_set(RADIO_SCAN_FREQUENCY, curr_freq))
|
2003-05-04 02:23:18 +00:00
|
|
|
{
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_set_current(preset_find(curr_freq));
|
2004-07-12 13:28:44 +00:00
|
|
|
remember_frequency();
|
2007-03-16 14:40:40 +00:00
|
|
|
end_search();
|
2007-11-07 02:14:28 +00:00
|
|
|
talk = true;
|
2003-05-04 02:23:18 +00:00
|
|
|
}
|
2007-03-16 14:40:40 +00:00
|
|
|
trigger_cpu_boost();
|
2003-05-03 02:40:09 +00:00
|
|
|
}
|
|
|
|
|
2010-08-16 12:07:46 +00:00
|
|
|
if (!update_type)
|
2007-11-20 03:44:25 +00:00
|
|
|
{
|
|
|
|
cancel_cpu_boost();
|
|
|
|
}
|
|
|
|
|
2010-08-16 12:07:46 +00:00
|
|
|
button = fms_do_button_loop(update_type>0);
|
2007-03-16 14:40:40 +00:00
|
|
|
|
|
|
|
#ifndef HAVE_NOISY_IDLE_MODE
|
2006-09-22 12:18:58 +00:00
|
|
|
if (button != ACTION_NONE)
|
2006-03-07 11:49:06 +00:00
|
|
|
{
|
|
|
|
cpu_idle_mode(false);
|
|
|
|
button_timeout = current_tick + (2*HZ);
|
|
|
|
}
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif
|
2003-05-03 02:40:09 +00:00
|
|
|
switch(button)
|
|
|
|
{
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_FM_STOP:
|
2006-08-28 22:38:41 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
|
2005-04-04 12:36:06 +00:00
|
|
|
if(audio_status() == AUDIO_STATUS_RECORD)
|
2003-11-20 00:33:43 +00:00
|
|
|
{
|
2005-04-04 12:36:06 +00:00
|
|
|
audio_stop();
|
2003-11-20 00:33:43 +00:00
|
|
|
}
|
|
|
|
else
|
2004-07-02 07:43:49 +00:00
|
|
|
#endif
|
2003-11-20 00:33:43 +00:00
|
|
|
{
|
|
|
|
done = true;
|
2010-07-06 15:10:11 +00:00
|
|
|
if(presets_have_changed())
|
2006-04-02 12:23:08 +00:00
|
|
|
{
|
2007-08-06 13:08:36 +00:00
|
|
|
if(yesno_pop(ID2P(LANG_FM_SAVE_CHANGES)))
|
2006-04-02 12:23:08 +00:00
|
|
|
{
|
2010-05-17 15:03:59 +00:00
|
|
|
presets_save();
|
2006-04-02 12:23:08 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-20 00:33:43 +00:00
|
|
|
}
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_NON_STATIC;
|
2003-11-20 00:33:43 +00:00
|
|
|
break;
|
2003-05-09 00:14:59 +00:00
|
|
|
|
2004-10-10 17:12:43 +00:00
|
|
|
#ifdef FM_RECORD
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_FM_RECORD:
|
2005-09-05 19:17:23 +00:00
|
|
|
#ifdef FM_RECORD_DBLPRE
|
2006-09-22 12:18:58 +00:00
|
|
|
if (lastbutton != ACTION_FM_RECORD_DBLPRE)
|
2005-09-05 19:17:23 +00:00
|
|
|
{
|
|
|
|
rec_lastclick = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (current_tick - rec_lastclick > HZ/2)
|
|
|
|
{
|
|
|
|
rec_lastclick = current_tick;
|
|
|
|
break;
|
2008-08-03 22:47:33 +00:00
|
|
|
}
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif /* FM_RECORD_DBLPRE */
|
2004-07-02 07:43:49 +00:00
|
|
|
#ifndef SIMULATOR
|
2005-04-04 12:36:06 +00:00
|
|
|
if(audio_status() == AUDIO_STATUS_RECORD)
|
2003-11-20 00:33:43 +00:00
|
|
|
{
|
2007-08-25 15:53:54 +00:00
|
|
|
rec_command(RECORDING_CMD_START_NEWFILE);
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2003-11-20 00:33:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-08-25 15:53:54 +00:00
|
|
|
rec_command(RECORDING_CMD_START);
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2003-11-20 00:33:43 +00:00
|
|
|
}
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif /* SIMULATOR */
|
2003-11-20 00:33:43 +00:00
|
|
|
last_seconds = 0;
|
2003-05-09 00:14:59 +00:00
|
|
|
break;
|
2004-10-10 17:12:43 +00:00
|
|
|
#endif /* #ifdef FM_RECORD */
|
2003-11-20 00:33:43 +00:00
|
|
|
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_FM_EXIT:
|
2006-08-28 22:38:41 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
|
2005-04-04 12:36:06 +00:00
|
|
|
if(audio_status() == AUDIO_STATUS_RECORD)
|
|
|
|
audio_stop();
|
2005-03-06 18:03:01 +00:00
|
|
|
#endif
|
2003-11-20 00:33:43 +00:00
|
|
|
keep_playing = true;
|
2005-11-13 21:03:53 +00:00
|
|
|
done = true;
|
2010-07-06 15:10:11 +00:00
|
|
|
if(presets_have_changed())
|
2006-04-02 12:23:08 +00:00
|
|
|
{
|
2007-08-06 13:08:36 +00:00
|
|
|
if(yesno_pop(ID2P(LANG_FM_SAVE_CHANGES)))
|
2006-04-02 12:23:08 +00:00
|
|
|
{
|
2010-05-17 15:03:59 +00:00
|
|
|
presets_save();
|
2008-08-03 22:47:33 +00:00
|
|
|
}
|
2006-04-02 12:23:08 +00:00
|
|
|
}
|
2008-08-03 22:47:33 +00:00
|
|
|
|
2003-05-03 02:40:09 +00:00
|
|
|
break;
|
2006-09-22 12:18:58 +00:00
|
|
|
|
|
|
|
case ACTION_STD_PREV:
|
|
|
|
case ACTION_STD_NEXT:
|
2007-03-16 14:40:40 +00:00
|
|
|
next_station(button == ACTION_STD_PREV ? -1 : 1);
|
|
|
|
end_search();
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2007-11-07 02:14:28 +00:00
|
|
|
talk = true;
|
2003-05-03 02:40:09 +00:00
|
|
|
break;
|
|
|
|
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_STD_PREVREPEAT:
|
2007-03-16 14:40:40 +00:00
|
|
|
case ACTION_STD_NEXTREPEAT:
|
|
|
|
{
|
|
|
|
int dir = search_dir;
|
|
|
|
search_dir = button == ACTION_STD_PREVREPEAT ? -1 : 1;
|
|
|
|
if (radio_mode != RADIO_SCAN_MODE)
|
2006-04-02 12:23:08 +00:00
|
|
|
{
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_next(search_dir);
|
2007-03-16 14:40:40 +00:00
|
|
|
end_search();
|
2007-11-07 02:14:28 +00:00
|
|
|
talk = true;
|
2006-04-02 12:23:08 +00:00
|
|
|
}
|
2007-03-16 14:40:40 +00:00
|
|
|
else if (dir == 0)
|
2006-04-02 12:23:08 +00:00
|
|
|
{
|
2007-03-16 14:40:40 +00:00
|
|
|
/* Starting auto scan */
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_MUTE, 1);
|
2006-04-02 12:23:08 +00:00
|
|
|
}
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2003-05-03 02:40:09 +00:00
|
|
|
break;
|
2010-08-16 12:07:46 +00:00
|
|
|
}
|
2006-09-22 12:18:58 +00:00
|
|
|
|
|
|
|
case ACTION_SETTINGS_INC:
|
|
|
|
case ACTION_SETTINGS_INCREPEAT:
|
2003-05-03 02:40:09 +00:00
|
|
|
global_settings.volume++;
|
2007-05-30 17:57:32 +00:00
|
|
|
setvol();
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_NON_STATIC;
|
2003-05-03 02:40:09 +00:00
|
|
|
break;
|
|
|
|
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_SETTINGS_DEC:
|
|
|
|
case ACTION_SETTINGS_DECREPEAT:
|
2003-05-03 02:40:09 +00:00
|
|
|
global_settings.volume--;
|
2007-05-30 17:57:32 +00:00
|
|
|
setvol();
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_NON_STATIC;
|
2003-05-03 02:40:09 +00:00
|
|
|
break;
|
|
|
|
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_FM_PLAY:
|
2007-02-08 10:36:49 +00:00
|
|
|
if (radio_status == FMRADIO_PLAYING)
|
2006-08-28 22:38:41 +00:00
|
|
|
radio_pause();
|
2005-11-13 21:03:53 +00:00
|
|
|
else
|
2006-08-28 22:38:41 +00:00
|
|
|
radio_start();
|
|
|
|
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_NON_STATIC;
|
2007-11-07 02:14:28 +00:00
|
|
|
talk = false;
|
|
|
|
talk_shutup();
|
2005-11-13 21:03:53 +00:00
|
|
|
break;
|
2006-09-22 12:18:58 +00:00
|
|
|
|
|
|
|
case ACTION_FM_MENU:
|
2010-05-12 10:38:00 +00:00
|
|
|
fms_fix_displays(FMS_EXIT);
|
2003-05-09 00:14:59 +00:00
|
|
|
radio_menu();
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_set_current(preset_find(curr_freq));
|
2010-08-16 12:07:46 +00:00
|
|
|
fms_fix_displays(FMS_ENTER);
|
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2003-05-04 02:23:18 +00:00
|
|
|
break;
|
2008-08-03 22:47:33 +00:00
|
|
|
|
2004-10-10 17:12:43 +00:00
|
|
|
#ifdef FM_PRESET
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_FM_PRESET:
|
2010-05-17 15:03:59 +00:00
|
|
|
if(radio_preset_count() < 1)
|
2006-04-02 12:23:08 +00:00
|
|
|
{
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ, ID2P(LANG_FM_NO_PRESETS));
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2005-11-16 23:36:35 +00:00
|
|
|
break;
|
|
|
|
}
|
2010-05-12 10:38:00 +00:00
|
|
|
fms_fix_displays(FMS_EXIT);
|
2010-02-20 21:32:31 +00:00
|
|
|
handle_radio_presets();
|
2010-08-16 12:07:46 +00:00
|
|
|
fms_fix_displays(FMS_ENTER);
|
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2003-05-04 02:23:18 +00:00
|
|
|
break;
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif /* FM_PRESET */
|
2008-08-03 22:47:33 +00:00
|
|
|
|
2004-10-10 17:12:43 +00:00
|
|
|
#ifdef FM_FREEZE
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_FM_FREEZE:
|
2003-11-06 00:47:47 +00:00
|
|
|
if(!screen_freeze)
|
|
|
|
{
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ, str(LANG_FM_FREEZE));
|
2003-11-06 00:47:47 +00:00
|
|
|
screen_freeze = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2003-11-06 00:47:47 +00:00
|
|
|
screen_freeze = false;
|
|
|
|
}
|
|
|
|
break;
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif /* FM_FREEZE */
|
|
|
|
|
2003-05-04 02:23:18 +00:00
|
|
|
case SYS_USB_CONNECTED:
|
2007-03-16 14:40:40 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2003-11-20 00:33:43 +00:00
|
|
|
/* Only accept USB connection when not recording */
|
2005-04-04 12:36:06 +00:00
|
|
|
if(audio_status() != AUDIO_STATUS_RECORD)
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif
|
2003-11-20 00:33:43 +00:00
|
|
|
{
|
2004-07-26 16:06:59 +00:00
|
|
|
default_event_handler(SYS_USB_CONNECTED);
|
2003-12-31 03:13:29 +00:00
|
|
|
screen_freeze = true; /* Cosmetic: makes sure the
|
|
|
|
radio screen doesn't redraw */
|
2003-11-20 00:33:43 +00:00
|
|
|
done = true;
|
|
|
|
}
|
|
|
|
break;
|
2005-11-13 21:03:53 +00:00
|
|
|
|
|
|
|
#ifdef FM_MODE
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_FM_MODE:
|
|
|
|
if(radio_mode == RADIO_SCAN_MODE)
|
2005-11-13 21:03:53 +00:00
|
|
|
{
|
2006-09-22 12:18:58 +00:00
|
|
|
/* Force scan mode if there are no presets. */
|
2010-05-17 15:03:59 +00:00
|
|
|
if(radio_preset_count() > 0)
|
2006-09-22 12:18:58 +00:00
|
|
|
radio_mode = RADIO_PRESET_MODE;
|
2005-11-13 21:03:53 +00:00
|
|
|
}
|
2006-09-22 12:18:58 +00:00
|
|
|
else
|
|
|
|
radio_mode = RADIO_SCAN_MODE;
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2007-11-07 02:14:28 +00:00
|
|
|
cond_talk_ids_fq(radio_mode ?
|
|
|
|
LANG_PRESET : LANG_RADIO_SCAN_MODE);
|
|
|
|
talk = true;
|
2005-11-13 21:03:53 +00:00
|
|
|
break;
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif /* FM_MODE */
|
|
|
|
|
2005-11-13 21:03:53 +00:00
|
|
|
#ifdef FM_NEXT_PRESET
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_FM_NEXT_PRESET:
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_next(1);
|
2007-03-16 14:40:40 +00:00
|
|
|
end_search();
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2007-11-07 02:14:28 +00:00
|
|
|
talk = true;
|
2005-11-13 21:03:53 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2007-03-16 14:40:40 +00:00
|
|
|
|
2005-11-13 21:03:53 +00:00
|
|
|
#ifdef FM_PREV_PRESET
|
2006-09-22 12:18:58 +00:00
|
|
|
case ACTION_FM_PREV_PRESET:
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_next(-1);
|
2007-03-16 14:40:40 +00:00
|
|
|
end_search();
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2007-11-07 02:14:28 +00:00
|
|
|
talk = true;
|
2005-11-13 21:03:53 +00:00
|
|
|
break;
|
|
|
|
#endif
|
2010-07-06 08:06:59 +00:00
|
|
|
case ACTION_NONE:
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_NON_STATIC;
|
2010-07-06 08:06:59 +00:00
|
|
|
break;
|
2008-08-03 22:47:33 +00:00
|
|
|
|
2004-07-26 16:06:59 +00:00
|
|
|
default:
|
|
|
|
default_event_handler(button);
|
2009-12-01 17:54:40 +00:00
|
|
|
#ifdef HAVE_RDS_CAP
|
|
|
|
if (tuner_get(RADIO_EVENT))
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2009-12-01 17:54:40 +00:00
|
|
|
#endif
|
|
|
|
if (!tuner_get(RADIO_PRESENT))
|
|
|
|
{
|
|
|
|
#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
|
|
|
|
if(audio_status() == AUDIO_STATUS_RECORD)
|
|
|
|
audio_stop();
|
|
|
|
#endif
|
|
|
|
keep_playing = false;
|
|
|
|
done = true;
|
2010-07-06 15:10:11 +00:00
|
|
|
if(presets_have_changed())
|
2009-12-01 17:54:40 +00:00
|
|
|
{
|
|
|
|
if(yesno_pop(ID2P(LANG_FM_SAVE_CHANGES)))
|
|
|
|
{
|
2010-05-17 15:03:59 +00:00
|
|
|
radio_save_presets();
|
2009-12-01 17:54:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear the preset list on exit. */
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_list_clear();
|
2009-12-01 17:54:40 +00:00
|
|
|
}
|
2004-07-26 16:06:59 +00:00
|
|
|
break;
|
2006-03-07 11:49:06 +00:00
|
|
|
} /*switch(button)*/
|
2003-11-05 09:46:08 +00:00
|
|
|
|
2007-03-16 14:40:40 +00:00
|
|
|
#ifdef FM_RECORD_DBLPRE
|
2006-09-22 12:18:58 +00:00
|
|
|
if (button != ACTION_NONE)
|
2005-08-13 17:35:02 +00:00
|
|
|
lastbutton = button;
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif
|
2006-09-22 12:18:58 +00:00
|
|
|
|
2006-03-03 19:41:16 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2003-11-05 09:46:08 +00:00
|
|
|
peak_meter_peek();
|
2006-03-03 19:41:16 +00:00
|
|
|
#endif
|
2003-11-05 09:46:08 +00:00
|
|
|
|
2003-11-06 00:47:47 +00:00
|
|
|
if(!screen_freeze)
|
2008-08-03 22:47:33 +00:00
|
|
|
{
|
2003-12-31 03:13:29 +00:00
|
|
|
/* Only display the peak meter when not recording */
|
2007-03-16 14:40:40 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2003-11-06 00:47:47 +00:00
|
|
|
if(TIME_AFTER(current_tick, timeout))
|
2003-11-05 09:46:08 +00:00
|
|
|
{
|
2003-11-06 00:47:47 +00:00
|
|
|
timeout = current_tick + HZ;
|
2007-03-16 14:40:40 +00:00
|
|
|
#else /* SWCODEC */
|
|
|
|
{
|
|
|
|
#endif /* CONFIG_CODEC == SWCODEC */
|
2006-08-28 22:38:41 +00:00
|
|
|
|
|
|
|
/* keep "mono" from always being displayed when paused */
|
2007-02-08 10:36:49 +00:00
|
|
|
if (radio_status != FMRADIO_PAUSED)
|
2003-11-06 00:47:47 +00:00
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
stereo = tuner_get(RADIO_STEREO) &&
|
2006-08-28 22:38:41 +00:00
|
|
|
!global_settings.fm_force_mono;
|
2007-03-16 14:40:40 +00:00
|
|
|
|
|
|
|
if(stereo != last_stereo)
|
2006-08-28 22:38:41 +00:00
|
|
|
{
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = SKIN_REFRESH_ALL;
|
2007-03-16 14:40:40 +00:00
|
|
|
last_stereo = stereo;
|
2006-08-28 22:38:41 +00:00
|
|
|
}
|
2003-11-06 00:47:47 +00:00
|
|
|
}
|
2003-11-05 09:46:08 +00:00
|
|
|
}
|
2007-03-16 14:40:40 +00:00
|
|
|
|
|
|
|
#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR)
|
2005-11-12 04:00:56 +00:00
|
|
|
seconds = audio_recorded_time() / HZ;
|
2010-08-16 12:07:46 +00:00
|
|
|
if (update_type || seconds > last_seconds)
|
2003-11-05 09:46:08 +00:00
|
|
|
{
|
2003-11-20 00:33:43 +00:00
|
|
|
last_seconds = seconds;
|
2007-03-16 14:40:40 +00:00
|
|
|
#else
|
2010-08-16 12:07:46 +00:00
|
|
|
if (update_type)
|
2007-03-16 14:40:40 +00:00
|
|
|
{
|
|
|
|
#endif
|
2008-05-29 11:13:46 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
2010-09-14 11:56:50 +00:00
|
|
|
skin_update(FM_SCREEN, i, update_type);
|
2003-11-05 09:46:08 +00:00
|
|
|
}
|
|
|
|
}
|
2010-08-16 12:07:46 +00:00
|
|
|
update_type = 0;
|
2007-03-16 14:40:40 +00:00
|
|
|
|
2007-11-07 02:14:28 +00:00
|
|
|
if (global_settings.talk_file && talk
|
|
|
|
&& radio_status == FMRADIO_PAUSED)
|
|
|
|
{
|
|
|
|
talk = false;
|
|
|
|
bool enqueue = false;
|
|
|
|
if (radio_mode == RADIO_SCAN_MODE)
|
|
|
|
{
|
|
|
|
talk_freq(curr_freq, enqueue);
|
|
|
|
enqueue = true;
|
|
|
|
}
|
2010-05-17 15:03:59 +00:00
|
|
|
if (radio_current_preset() >= 0)
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_talk(radio_current_preset(), radio_mode == RADIO_PRESET_MODE,
|
2007-11-07 02:14:28 +00:00
|
|
|
enqueue);
|
|
|
|
}
|
|
|
|
|
2007-03-16 14:40:40 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2005-04-04 12:36:06 +00:00
|
|
|
if(audio_status() & AUDIO_STATUS_ERROR)
|
2003-11-20 00:33:43 +00:00
|
|
|
{
|
|
|
|
done = true;
|
|
|
|
}
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_NOISY_IDLE_MODE
|
2006-03-07 11:49:06 +00:00
|
|
|
if (TIME_AFTER(current_tick, button_timeout))
|
2006-08-28 22:38:41 +00:00
|
|
|
{
|
|
|
|
cpu_idle_mode(true);
|
|
|
|
}
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif
|
2006-03-07 11:49:06 +00:00
|
|
|
} /*while(!done)*/
|
2003-05-03 15:39:40 +00:00
|
|
|
|
2004-07-02 07:43:49 +00:00
|
|
|
#ifndef SIMULATOR
|
2007-03-16 14:40:40 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2005-04-04 12:36:06 +00:00
|
|
|
if(audio_status() & AUDIO_STATUS_ERROR)
|
2003-11-20 00:33:43 +00:00
|
|
|
{
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(0, str(LANG_DISK_FULL));
|
2005-04-04 12:36:06 +00:00
|
|
|
audio_error_clear();
|
2003-11-20 00:33:43 +00:00
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
2006-09-22 12:18:58 +00:00
|
|
|
button = get_action(CONTEXT_FM, TIMEOUT_BLOCK);
|
2006-09-25 19:59:37 +00:00
|
|
|
if(button == ACTION_FM_STOP)
|
2003-11-20 00:33:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2008-08-03 22:47:33 +00:00
|
|
|
|
2005-04-04 12:36:06 +00:00
|
|
|
audio_init_playback();
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif /* CONFIG_CODEC != SWCODEC */
|
2003-11-20 00:33:43 +00:00
|
|
|
|
2004-07-06 12:17:14 +00:00
|
|
|
sound_settings_apply();
|
2006-04-02 12:23:08 +00:00
|
|
|
#endif /* SIMULATOR */
|
2006-08-28 22:38:41 +00:00
|
|
|
|
2003-11-20 00:33:43 +00:00
|
|
|
if(keep_playing)
|
|
|
|
{
|
2007-03-16 14:40:40 +00:00
|
|
|
/* Catch FMRADIO_PLAYING status for the sim. */
|
2006-04-02 12:23:08 +00:00
|
|
|
#ifndef SIMULATOR
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2003-11-20 00:33:43 +00:00
|
|
|
/* Enable the Left and right A/D Converter */
|
2005-11-12 04:00:56 +00:00
|
|
|
audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
|
2006-08-28 22:38:41 +00:00
|
|
|
sound_default(SOUND_RIGHT_GAIN),
|
|
|
|
AUDIO_GAIN_LINEIN);
|
2003-11-20 00:33:43 +00:00
|
|
|
mas_codec_writereg(6, 0x4000);
|
2005-08-13 17:35:02 +00:00
|
|
|
#endif
|
2007-03-16 14:40:40 +00:00
|
|
|
end_search();
|
|
|
|
#endif /* SIMULATOR */
|
2004-10-19 08:20:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2007-06-08 23:42:04 +00:00
|
|
|
audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
2006-08-28 22:38:41 +00:00
|
|
|
#else
|
|
|
|
radio_stop();
|
2005-08-13 17:35:02 +00:00
|
|
|
#endif
|
2003-11-20 00:33:43 +00:00
|
|
|
}
|
2007-03-16 14:40:40 +00:00
|
|
|
|
|
|
|
#ifndef HAVE_NOISY_IDLE_MODE
|
2005-09-29 11:19:55 +00:00
|
|
|
cpu_idle_mode(false);
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif
|
2010-05-12 10:38:00 +00:00
|
|
|
fms_fix_displays(FMS_EXIT);
|
2007-02-08 10:36:49 +00:00
|
|
|
in_screen = false;
|
2006-08-28 22:38:41 +00:00
|
|
|
} /* radio_screen */
|
2003-05-04 02:23:18 +00:00
|
|
|
|
2007-02-27 09:06:30 +00:00
|
|
|
void toggle_mono_mode(bool mono)
|
2006-10-05 12:40:13 +00:00
|
|
|
{
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_FORCE_MONO, mono);
|
2006-10-05 12:40:13 +00:00
|
|
|
}
|
|
|
|
|
2007-02-27 09:06:30 +00:00
|
|
|
void set_radio_region(int region)
|
2006-10-05 12:40:13 +00:00
|
|
|
{
|
2007-07-14 13:41:59 +00:00
|
|
|
#ifdef HAVE_RADIO_REGION
|
2007-07-14 11:20:31 +00:00
|
|
|
tuner_set(RADIO_REGION, region);
|
2007-07-14 13:41:59 +00:00
|
|
|
#endif
|
2007-03-16 14:40:40 +00:00
|
|
|
next_station(0);
|
2006-10-12 13:59:44 +00:00
|
|
|
remember_frequency();
|
2007-07-14 13:41:59 +00:00
|
|
|
(void)region;
|
2006-10-05 12:40:13 +00:00
|
|
|
}
|
|
|
|
|
2007-02-27 09:06:30 +00:00
|
|
|
MENUITEM_SETTING(set_region, &global_settings.fm_region, NULL);
|
|
|
|
MENUITEM_SETTING(force_mono, &global_settings.fm_force_mono, NULL);
|
2005-11-29 15:10:07 +00:00
|
|
|
|
2007-02-27 09:06:30 +00:00
|
|
|
#ifndef FM_MODE
|
2008-05-03 21:33:00 +00:00
|
|
|
static char* get_mode_text(int selected_item, void * data, char *buffer)
|
2005-11-29 15:10:07 +00:00
|
|
|
{
|
2007-02-27 09:06:30 +00:00
|
|
|
(void)selected_item;
|
|
|
|
(void)data;
|
2007-08-05 19:19:39 +00:00
|
|
|
snprintf(buffer, MAX_PATH, "%s %s", str(LANG_MODE),
|
|
|
|
radio_mode ? str(LANG_PRESET) :
|
2005-11-29 15:10:07 +00:00
|
|
|
str(LANG_RADIO_SCAN_MODE));
|
2007-02-27 09:06:30 +00:00
|
|
|
return buffer;
|
2005-11-29 15:10:07 +00:00
|
|
|
}
|
2007-03-17 12:33:34 +00:00
|
|
|
static int toggle_radio_mode(void)
|
2005-11-29 15:10:07 +00:00
|
|
|
{
|
|
|
|
radio_mode = (radio_mode == RADIO_SCAN_MODE) ?
|
|
|
|
RADIO_PRESET_MODE : RADIO_SCAN_MODE;
|
2007-02-27 09:06:30 +00:00
|
|
|
return 0;
|
2005-11-29 15:10:07 +00:00
|
|
|
}
|
2007-03-17 12:33:34 +00:00
|
|
|
MENUITEM_FUNCTION_DYNTEXT(radio_mode_item, 0,
|
2007-03-18 07:03:43 +00:00
|
|
|
toggle_radio_mode, NULL,
|
2007-10-09 03:48:56 +00:00
|
|
|
get_mode_text, NULL, NULL, NULL, Icon_NOICON);
|
2005-11-29 15:10:07 +00:00
|
|
|
#endif
|
|
|
|
|
2005-11-16 23:36:35 +00:00
|
|
|
|
2004-10-19 22:50:34 +00:00
|
|
|
|
2006-10-10 13:42:22 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
|
2007-05-20 20:26:36 +00:00
|
|
|
#if defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC
|
2006-10-10 13:42:22 +00:00
|
|
|
#define FM_RECORDING_SCREEN
|
2007-02-27 09:06:30 +00:00
|
|
|
static int fm_recording_screen(void)
|
2006-08-28 22:38:41 +00:00
|
|
|
{
|
|
|
|
bool ret;
|
|
|
|
|
|
|
|
/* switch recording source to FMRADIO for the duration */
|
|
|
|
int rec_source = global_settings.rec_source;
|
|
|
|
global_settings.rec_source = AUDIO_SRC_FMRADIO;
|
|
|
|
ret = recording_screen(true);
|
|
|
|
|
|
|
|
/* safe to reset as changing sources is prohibited here */
|
|
|
|
global_settings.rec_source = rec_source;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2007-03-17 12:33:34 +00:00
|
|
|
|
2007-05-20 20:26:36 +00:00
|
|
|
#endif /* defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC */
|
2006-08-28 22:38:41 +00:00
|
|
|
|
2007-05-20 20:26:36 +00:00
|
|
|
#if defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC
|
2006-10-10 13:42:22 +00:00
|
|
|
#define FM_RECORDING_SETTINGS
|
2007-02-27 09:06:30 +00:00
|
|
|
static int fm_recording_settings(void)
|
2006-08-28 22:38:41 +00:00
|
|
|
{
|
|
|
|
bool ret = recording_menu(true);
|
2007-03-16 14:40:40 +00:00
|
|
|
|
2006-09-17 18:52:31 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2006-08-28 22:38:41 +00:00
|
|
|
if (!ret)
|
|
|
|
{
|
2006-11-06 18:07:30 +00:00
|
|
|
struct audio_recording_options rec_options;
|
|
|
|
rec_init_recording_options(&rec_options);
|
|
|
|
rec_options.rec_source = AUDIO_SRC_LINEIN;
|
|
|
|
rec_set_recording_options(&rec_options);
|
2006-08-28 22:38:41 +00:00
|
|
|
}
|
2006-09-17 18:52:31 +00:00
|
|
|
#endif
|
2006-08-28 22:38:41 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2007-03-17 12:33:34 +00:00
|
|
|
|
2007-05-20 20:26:36 +00:00
|
|
|
#endif /* defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC */
|
2006-10-10 13:42:22 +00:00
|
|
|
#endif /* HAVE_RECORDING */
|
2007-03-16 14:40:40 +00:00
|
|
|
|
|
|
|
#ifdef FM_RECORDING_SCREEN
|
2008-08-03 22:47:33 +00:00
|
|
|
MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING),
|
2007-06-25 21:19:45 +00:00
|
|
|
fm_recording_screen, NULL, NULL, Icon_Recording);
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif
|
|
|
|
#ifdef FM_RECORDING_SETTINGS
|
2008-08-03 22:47:33 +00:00
|
|
|
MENUITEM_FUNCTION(recsettings_item, 0, ID2P(LANG_RECORDING_SETTINGS),
|
2007-06-25 21:19:45 +00:00
|
|
|
fm_recording_settings, NULL, NULL, Icon_Recording);
|
2007-03-16 14:40:40 +00:00
|
|
|
#endif
|
2007-02-27 09:06:30 +00:00
|
|
|
#ifndef FM_PRESET
|
2008-08-03 22:47:33 +00:00
|
|
|
MENUITEM_FUNCTION(radio_presets_item, 0, ID2P(LANG_PRESET),
|
2010-07-06 15:10:11 +00:00
|
|
|
handle_radio_presets, NULL, NULL, Icon_NOICON);
|
2007-02-27 09:06:30 +00:00
|
|
|
#endif
|
|
|
|
#ifndef FM_PRESET_ADD
|
2008-08-03 22:47:33 +00:00
|
|
|
MENUITEM_FUNCTION(radio_addpreset_item, 0, ID2P(LANG_FM_ADD_PRESET),
|
2010-07-06 15:10:11 +00:00
|
|
|
handle_radio_add_preset, NULL, NULL, Icon_NOICON);
|
2007-02-27 09:06:30 +00:00
|
|
|
#endif
|
2006-08-28 22:38:41 +00:00
|
|
|
|
2008-08-03 22:47:33 +00:00
|
|
|
MENUITEM_FUNCTION(presetload_item, 0, ID2P(LANG_FM_PRESET_LOAD),
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_list_load, NULL, NULL, Icon_NOICON);
|
2008-08-03 22:47:33 +00:00
|
|
|
MENUITEM_FUNCTION(presetsave_item, 0, ID2P(LANG_FM_PRESET_SAVE),
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_list_save, NULL, NULL, Icon_NOICON);
|
2008-08-03 22:47:33 +00:00
|
|
|
MENUITEM_FUNCTION(presetclear_item, 0, ID2P(LANG_FM_PRESET_CLEAR),
|
2010-07-06 15:10:11 +00:00
|
|
|
preset_list_clear, NULL, NULL, Icon_NOICON);
|
2008-05-29 11:13:46 +00:00
|
|
|
MENUITEM_FUNCTION(scan_presets_item, MENU_FUNC_USEPARAM,
|
|
|
|
ID2P(LANG_FM_SCAN_PRESETS),
|
2010-07-06 15:10:11 +00:00
|
|
|
presets_scan, NULL, NULL, Icon_NOICON);
|
2007-02-27 09:06:30 +00:00
|
|
|
|
2008-08-03 22:47:33 +00:00
|
|
|
MAKE_MENU(radio_settings_menu, ID2P(LANG_FM_MENU), NULL,
|
|
|
|
Icon_Radio_screen,
|
2005-09-22 18:36:02 +00:00
|
|
|
#ifndef FM_PRESET
|
2007-02-27 09:06:30 +00:00
|
|
|
&radio_presets_item,
|
2005-09-22 18:36:02 +00:00
|
|
|
#endif
|
|
|
|
#ifndef FM_PRESET_ADD
|
2007-02-27 09:06:30 +00:00
|
|
|
&radio_addpreset_item,
|
2005-08-13 17:35:02 +00:00
|
|
|
#endif
|
2007-02-27 09:06:30 +00:00
|
|
|
&presetload_item, &presetsave_item, &presetclear_item,
|
|
|
|
&force_mono,
|
2005-11-29 15:10:07 +00:00
|
|
|
#ifndef FM_MODE
|
2007-02-27 09:06:30 +00:00
|
|
|
&radio_mode_item,
|
2006-08-28 22:38:41 +00:00
|
|
|
#endif
|
2007-02-27 09:06:30 +00:00
|
|
|
&set_region, &sound_settings,
|
2006-10-10 13:42:22 +00:00
|
|
|
#ifdef FM_RECORDING_SCREEN
|
2007-02-27 09:22:56 +00:00
|
|
|
&recscreen_item,
|
2005-11-29 15:10:07 +00:00
|
|
|
#endif
|
2006-10-10 13:42:22 +00:00
|
|
|
#ifdef FM_RECORDING_SETTINGS
|
2007-02-27 09:06:30 +00:00
|
|
|
&recsettings_item,
|
2005-11-29 15:10:07 +00:00
|
|
|
#endif
|
2007-02-27 09:06:30 +00:00
|
|
|
&scan_presets_item);
|
|
|
|
/* main menu of the radio screen */
|
|
|
|
static bool radio_menu(void)
|
|
|
|
{
|
2008-08-03 22:47:33 +00:00
|
|
|
return do_menu(&radio_settings_menu, NULL, NULL, false) ==
|
2009-12-01 17:54:40 +00:00
|
|
|
MENU_ATTACHED_USB;
|
2003-05-04 02:23:18 +00:00
|
|
|
}
|
|
|
|
|
2003-05-03 02:40:09 +00:00
|
|
|
#endif
|