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 <stdio.h>
|
|
|
|
#include <stdbool.h>
|
2007-03-16 14:40:40 +00:00
|
|
|
#include <stdlib.h>
|
2011-01-29 15:01:28 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
2003-05-03 02:40:09 +00:00
|
|
|
#include "settings.h"
|
|
|
|
#include "status.h"
|
2005-04-04 12:36:06 +00:00
|
|
|
#include "audio.h"
|
2009-02-10 23:43:37 +00:00
|
|
|
#include "general.h"
|
2003-05-04 02:23:18 +00:00
|
|
|
#include "radio.h"
|
|
|
|
#include "menu.h"
|
2011-01-29 15:01:28 +00:00
|
|
|
#include "menus/exported_menus.h"
|
2003-05-04 02:23:18 +00:00
|
|
|
#include "misc.h"
|
|
|
|
#include "screens.h"
|
2003-11-05 09:46:08 +00:00
|
|
|
#include "peakmeter.h"
|
|
|
|
#include "lang.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
|
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"
|
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"
|
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-26 04:59:39 +00:00
|
|
|
#include "playback.h"
|
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
|
|
|
|
2020-07-15 23:40:55 +00:00
|
|
|
#if (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
|
|
|
|
2014-07-14 00:10:37 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD) || (CONFIG_KEYPAD == GIGABEAT_S_PAD)
|
2007-11-11 16:00:33 +00:00
|
|
|
#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
|
|
|
|
2010-06-18 22:14:45 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || (CONFIG_KEYPAD == SANSA_C200_PAD) ||\
|
2014-06-17 23:13:15 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_FUZE_PAD) || (CONFIG_KEYPAD == SANSA_CLIP_PAD) ||\
|
2014-07-14 00:10:37 +00:00
|
|
|
(CONFIG_KEYPAD == PHILIPS_HDD1630_PAD)||(CONFIG_KEYPAD == COWON_D2_PAD)||\
|
2016-01-23 14:54:08 +00:00
|
|
|
(CONFIG_KEYPAD == SAMSUNG_YH92X_PAD)||(CONFIG_KEYPAD == MPIO_HD200_PAD)||\
|
2017-11-14 15:47:27 +00:00
|
|
|
(CONFIG_KEYPAD == PHILIPS_HDD6330_PAD) || (CONFIG_KEYPAD == SONY_NWZ_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) || \
|
2014-07-14 00:10:37 +00:00
|
|
|
(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
|
|
|
|
|
2012-04-07 08:30:23 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
|
|
|
|
#define FM_MENU
|
|
|
|
#define FM_PRESET
|
|
|
|
#define FM_STOP
|
|
|
|
#define FM_MODE
|
|
|
|
#define FM_EXIT
|
|
|
|
#define FM_PLAY
|
|
|
|
#define FM_PREV_PRESET
|
|
|
|
#define FM_NEXT_PRESET
|
|
|
|
|
2013-07-15 15:28:54 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD)
|
|
|
|
#define FM_PRESET_ADD
|
|
|
|
#define FM_PRESET_ACTION
|
|
|
|
#define FM_MENU
|
|
|
|
#define FM_PRESET
|
|
|
|
#define FM_STOP
|
|
|
|
#define FM_MODE
|
|
|
|
#define FM_EXIT
|
|
|
|
#define FM_PLAY
|
|
|
|
#define FM_RECORD
|
|
|
|
#define FM_PREV_PRESET
|
|
|
|
#define FM_NEXT_PRESET
|
|
|
|
|
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 */
|
|
|
|
int radio_mode = RADIO_SCAN_MODE;
|
2003-05-03 02:40:09 +00:00
|
|
|
|
2011-01-29 15:01:28 +00:00
|
|
|
static int search_dir = 0;
|
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;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
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);
|
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;
|
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
|
|
|
|
2018-12-23 03:07:19 +00:00
|
|
|
if(radio_status != FMRADIO_OFF)
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
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
|
|
|
|
#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" */
|
2011-06-01 14:41:49 +00:00
|
|
|
push_current_activity(ACTIVITY_FM);
|
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();
|
2013-09-02 08:50:24 +00:00
|
|
|
|
|
|
|
fms_fix_displays(FMS_ENTER);
|
|
|
|
|
2006-08-28 22:38:41 +00:00
|
|
|
/* turn on radio */
|
2010-05-26 04:51:24 +00:00
|
|
|
/* This should be done before touching audio settings */
|
2011-09-01 12:15:43 +00:00
|
|
|
while (!pcm_is_initialized())
|
2010-05-26 04:51:24 +00:00
|
|
|
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);
|
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-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
|
|
|
|
2014-01-14 16:07:03 +00:00
|
|
|
/* Load/update the skin at last, when fully initialzed, so that it can
|
|
|
|
* display the right content from the beginning */
|
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
skin_update(FM_SCREEN, i, SKIN_REFRESH_ALL);
|
|
|
|
|
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:
|
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
|
|
|
{
|
2011-07-21 06:40:21 +00:00
|
|
|
if(yesno_pop(ID2P(LANG_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
|
|
|
}
|
2011-05-24 10:56:01 +00:00
|
|
|
#endif /* SIMULATOR */
|
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:
|
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
|
|
|
{
|
2011-07-21 06:40:21 +00:00
|
|
|
if(yesno_pop(ID2P(LANG_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:
|
2013-07-17 09:13:51 +00:00
|
|
|
global_settings.volume += sound_steps(SOUND_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:
|
2013-07-17 09:13:51 +00:00
|
|
|
global_settings.volume -= sound_steps(SOUND_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;
|
2015-02-25 21:13:02 +00:00
|
|
|
talk = true;
|
2007-11-07 02:14:28 +00:00
|
|
|
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);
|
2011-01-29 15:01:28 +00:00
|
|
|
do_menu(&radio_settings_menu, NULL, NULL, false);
|
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:
|
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;
|
2013-07-06 11:41:54 +00:00
|
|
|
/* this case is used by the softlock feature
|
|
|
|
* it requests a full update here */
|
|
|
|
case ACTION_REDRAW:
|
|
|
|
skin_request_full_update(FM_SCREEN);
|
|
|
|
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
|
|
|
if (!tuner_get(RADIO_PRESENT))
|
|
|
|
{
|
|
|
|
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
|
|
|
{
|
2011-07-21 06:40:21 +00:00
|
|
|
if(yesno_pop(ID2P(LANG_SAVE_CHANGES)))
|
2009-12-01 17:54:40 +00:00
|
|
|
{
|
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
|
|
|
|
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
|
|
|
{
|
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
|
|
|
|
2010-08-16 12:07:46 +00:00
|
|
|
if (update_type)
|
2007-03-16 14:40:40 +00:00
|
|
|
{
|
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);
|
2011-12-07 14:58:46 +00:00
|
|
|
if (update_type == (int)SKIN_REFRESH_ALL)
|
|
|
|
skin_request_full_update(CUSTOM_STATUSBAR);
|
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)
|
|
|
|
{
|
2011-06-26 14:42:24 +00:00
|
|
|
talk_value_decimal(curr_freq, UNIT_INT, 6, enqueue);
|
2007-11-07 02:14:28 +00:00
|
|
|
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
|
|
|
#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
|
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
|
2007-03-16 14:40:40 +00:00
|
|
|
end_search();
|
|
|
|
#endif /* SIMULATOR */
|
2004-10-19 08:20:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-06-08 23:42:04 +00:00
|
|
|
audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK);
|
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);
|
2011-06-01 14:41:49 +00:00
|
|
|
pop_current_activity();
|
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
|
|
|
{
|
2018-12-23 03:07:19 +00:00
|
|
|
if(radio_status != FMRADIO_OFF)
|
|
|
|
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
|
2018-12-23 03:07:19 +00:00
|
|
|
if(radio_status != FMRADIO_OFF)
|
|
|
|
tuner_set(RADIO_REGION, region);
|
|
|
|
#else
|
|
|
|
(void)region;
|
2007-07-14 13:41:59 +00:00
|
|
|
#endif
|
2007-03-16 14:40:40 +00:00
|
|
|
next_station(0);
|
2006-10-05 12:40:13 +00:00
|
|
|
}
|
|
|
|
|
2003-05-03 02:40:09 +00:00
|
|
|
#endif
|