From b6867dc9980d19ff6d0954a2a5c7aff7b2b713c3 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Mon, 17 May 2010 15:03:59 +0000 Subject: split the radio code into multiple files in the hope that makes it more likely for someone to want to work on! :D git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26109 a1c6a512-1295-4272-9138-f99709370657 --- apps/SOURCES | 13 +- apps/radio/presets.c | 614 ++++++++++++++++ apps/radio/radio.c | 1042 +++++++++++++++++++++++++++ apps/radio/radio.h | 84 +++ apps/radio/radio_skin.c | 118 ++++ apps/radio/radioart.c | 180 +++++ apps/recorder/radio.c | 1783 ----------------------------------------------- apps/recorder/radio.h | 69 -- tools/configure | 132 ++-- 9 files changed, 2114 insertions(+), 1921 deletions(-) create mode 100644 apps/radio/presets.c create mode 100644 apps/radio/radio.c create mode 100644 apps/radio/radio.h create mode 100644 apps/radio/radio_skin.c create mode 100644 apps/radio/radioart.c delete mode 100644 apps/recorder/radio.c delete mode 100644 apps/recorder/radio.h diff --git a/apps/SOURCES b/apps/SOURCES index 98efec944a..93ec93fe27 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -132,12 +132,19 @@ recorder/albumart.c gui/color_picker.c #endif #endif -#if CONFIG_TUNER -recorder/radio.c -#endif #ifdef HAVE_RECORDING recorder/recording.c #endif + +#if CONFIG_TUNER +radio/radio.c +radio/presets.c +radio/radio_skin.c +#ifdef HAVE_ALBUMART +radio/radioart.c +#endif +#endif + #if CONFIG_CODEC == SWCODEC #if INPUT_SRC_CAPS != 0 audio_path.c diff --git a/apps/radio/presets.c b/apps/radio/presets.c new file mode 100644 index 0000000000..b996e68443 --- /dev/null +++ b/apps/radio/presets.c @@ -0,0 +1,614 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: radio.c -1 $ + * + * Copyright (C) 2003 Linus Nielsen Feltzing + * + * 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. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" +#include +#include +#include +#include "settings.h" +#include "general.h" +#include "radio.h" +#include "tuner.h" +#include "file.h" +#include "string-extra.h" +#include "misc.h" +#include "lang.h" +#include "action.h" +#include "list.h" +#include "splash.h" +#include "menu.h" +#include "yesno.h" +#include "keyboard.h" +#include "talk.h" +#include "filetree.h" +#include "dir.h" + +static int curr_preset = -1; + +extern int curr_freq; /* from radio.c.. naughty but meh */ +extern int radio_mode; +int snap_freq_to_grid(int freq); +void remember_frequency(void); +void talk_freq(int freq, bool enqueue); + +#define MAX_PRESETS 64 +static bool presets_loaded = false, presets_changed = false; +static struct fmstation presets[MAX_PRESETS]; + +static char filepreset[MAX_PATH]; /* preset filename variable */ + +static int num_presets = 0; /* The number of presets in the preset list */ + +bool yesno_pop(const char* text); /* radio.c */ + +int radio_current_preset(void) +{ + return curr_preset; +} +int radio_preset_count(void) +{ + return num_presets; +} +const struct fmstation *radio_get_preset(int preset) +{ + return &presets[preset]; +} + +bool has_presets_changed(void) +{ + return presets_changed; +} + + +/* Find a matching preset to freq */ +int find_preset(int freq) +{ + int i; + if(num_presets < 1) + return -1; + for(i = 0;i < MAX_PRESETS;i++) + { + if(freq == presets[i].frequency) + return i; + } + + return -1; +} + +/* Return the closest preset encountered in the search direction with + wraparound. */ +int find_closest_preset(int freq, int direction) +{ + int i; + int lowpreset = 0; + int highpreset = 0; + int closest = -1; + + if (direction == 0) /* direction == 0 isn't really used */ + return 0; + + for (i = 0; i < num_presets; i++) + { + int f = presets[i].frequency; + if (f == freq) + return i; /* Exact match = stop */ + + /* remember the highest and lowest presets for wraparound */ + if (f < presets[lowpreset].frequency) + lowpreset = i; + if (f > presets[highpreset].frequency) + highpreset = i; + + /* find the closest preset in the given direction */ + if (direction > 0 && f > freq) + { + if (closest < 0 || f < presets[closest].frequency) + closest = i; + } + else if (direction < 0 && f < freq) + { + if (closest < 0 || f > presets[closest].frequency) + closest = i; + } + } + + if (closest < 0) + { + /* no presets in the given direction */ + /* wrap around depending on direction */ + if (direction < 0) + closest = highpreset; + else + closest = lowpreset; + } + + return closest; +} + +void next_preset(int direction) +{ + if (num_presets < 1) + return; + + if (curr_preset == -1) + curr_preset = find_closest_preset(curr_freq, direction); + else + curr_preset = (curr_preset + direction + num_presets) % num_presets; + + /* Must stay on the current grid for the region */ + curr_freq = snap_freq_to_grid(presets[curr_preset].frequency); + + tuner_set(RADIO_FREQUENCY, curr_freq); + remember_frequency(); +} + +void set_current_preset(int preset) +{ + curr_preset = preset; +} + +/* Speak a preset by number or by spelling its name, depending on settings. */ +void talk_preset(int preset, bool fallback, bool enqueue) +{ + if (global_settings.talk_file == 1) /* number */ + talk_number(preset + 1, enqueue); + else + { /* spell */ + if(presets[preset].name[0]) + talk_spell(presets[preset].name, enqueue); + else if(fallback) + talk_freq(presets[preset].frequency, enqueue); + } +} + + +void radio_save_presets(void) +{ + int fd; + int i; + + fd = creat(filepreset, 0666); + if(fd >= 0) + { + for(i = 0;i < num_presets;i++) + { + fdprintf(fd, "%d:%s\n", presets[i].frequency, presets[i].name); + } + close(fd); + + if(!strncasecmp(FMPRESET_PATH, filepreset, strlen(FMPRESET_PATH))) + set_file(filepreset, global_settings.fmr_file, MAX_FILENAME); + presets_changed = false; + } + else + { + splash(HZ, ID2P(LANG_FM_PRESET_SAVE_FAILED)); + } +} + +void radio_load_presets(char *filename) +{ + int fd; + int rc; + char buf[128]; + char *freq; + char *name; + bool done = false; + int f; + + memset(presets, 0, sizeof(presets)); + num_presets = 0; + + /* No Preset in configuration. */ + if(filename[0] == '\0') + { + filepreset[0] = '\0'; + return; + } + /* Temporary preset, loaded until player shuts down. */ + else if(filename[0] == '/') + strlcpy(filepreset, filename, sizeof(filepreset)); + /* Preset from default directory. */ + else + snprintf(filepreset, sizeof(filepreset), "%s/%s.fmr", + FMPRESET_PATH, filename); + + fd = open_utf8(filepreset, O_RDONLY); + if(fd >= 0) + { + while(!done && num_presets < MAX_PRESETS) + { + rc = read_line(fd, buf, 128); + if(rc > 0) + { + if(settings_parseline(buf, &freq, &name)) + { + f = atoi(freq); + if(f) /* For backwards compatibility */ + { + struct fmstation * const fms = &presets[num_presets]; + fms->frequency = f; + strlcpy(fms->name, name, MAX_FMPRESET_LEN+1); + num_presets++; + } + } + } + else + done = true; + } + close(fd); + } + else /* invalid file name? */ + filepreset[0] = '\0'; + + presets_loaded = num_presets > 0; + presets_changed = false; +} + +const char* radio_get_preset_name(int preset) +{ + if (preset < num_presets) + return presets[preset].name; + return NULL; +} + +int radio_add_preset(void) +{ + char buf[MAX_FMPRESET_LEN + 1]; + + if(num_presets < MAX_PRESETS) + { + buf[0] = '\0'; + + if (!kbd_input(buf, MAX_FMPRESET_LEN + 1)) + { + struct fmstation * const fms = &presets[num_presets]; + strcpy(fms->name, buf); + fms->frequency = curr_freq; + num_presets++; + presets_changed = true; + presets_loaded = num_presets > 0; + return true; + } + } + else + { + splash(HZ, ID2P(LANG_FM_NO_FREE_PRESETS)); + } + return false; +} + +/* needed to know which preset we are edit/delete-ing */ +static int selected_preset = -1; +static int radio_edit_preset(void) +{ + char buf[MAX_FMPRESET_LEN + 1]; + + if (num_presets > 0) + { + struct fmstation * const fms = &presets[selected_preset]; + + strcpy(buf, fms->name); + + if (!kbd_input(buf, MAX_FMPRESET_LEN + 1)) + { + strcpy(fms->name, buf); + presets_changed = true; + } + } + + return 1; +} + +static int radio_delete_preset(void) +{ + if (num_presets > 0) + { + struct fmstation * const fms = &presets[selected_preset]; + + if (selected_preset >= --num_presets) + selected_preset = num_presets - 1; + + memmove(fms, fms + 1, (uintptr_t)(fms + num_presets) - + (uintptr_t)fms); + + if (curr_preset >= num_presets) + --curr_preset; + } + + /* Don't ask to save when all presets are deleted. */ + presets_changed = num_presets > 0; + + if (!presets_changed) + { + /* The preset list will be cleared, switch to Scan Mode. */ + radio_mode = RADIO_SCAN_MODE; + curr_preset = -1; + presets_loaded = false; + } + + return 1; +} + +int load_preset_list(void) +{ + return !rockbox_browse(FMPRESET_PATH, SHOW_FMR); +} + +int save_preset_list(void) +{ + if(num_presets > 0) + { + bool bad_file_name = true; + + if(!dir_exists(FMPRESET_PATH)) /* Check if there is preset folder */ + mkdir(FMPRESET_PATH); + + create_numbered_filename(filepreset, FMPRESET_PATH, "preset", + ".fmr", 2 IF_CNFN_NUM_(, NULL)); + + while(bad_file_name) + { + if(!kbd_input(filepreset, sizeof(filepreset))) + { + /* check the name: max MAX_FILENAME (20) chars */ + char* p2; + char* p1; + int len; + p1 = strrchr(filepreset, '/'); + p2 = p1; + while((p1) && (*p2) && (*p2 != '.')) + p2++; + len = (int)(p2-p1) - 1; + if((!p1) || (len > MAX_FILENAME) || (len == 0)) + { + /* no slash, too long or too short */ + splash(HZ, ID2P(LANG_INVALID_FILENAME)); + } + else + { + /* add correct extension (easier to always write) + at this point, p2 points to 0 or the extension dot */ + *p2 = '\0'; + strcat(filepreset,".fmr"); + bad_file_name = false; + radio_save_presets(); + } + } + else + { + /* user aborted */ + return false; + } + } + } + else + splash(HZ, ID2P(LANG_FM_NO_PRESETS)); + + return true; +} + +int clear_preset_list(void) +{ + /* Clear all the preset entries */ + memset(presets, 0, sizeof (presets)); + + num_presets = 0; + presets_loaded = false; + /* The preset list will be cleared switch to Scan Mode. */ + radio_mode = RADIO_SCAN_MODE; + curr_preset = -1; + presets_changed = false; /* Don't ask to save when clearing the list. */ + + return true; +} + +MENUITEM_FUNCTION(radio_edit_preset_item, MENU_FUNC_CHECK_RETVAL, + ID2P(LANG_FM_EDIT_PRESET), + radio_edit_preset, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(radio_delete_preset_item, MENU_FUNC_CHECK_RETVAL, + ID2P(LANG_FM_DELETE_PRESET), + radio_delete_preset, NULL, NULL, Icon_NOICON); +static int radio_preset_callback(int action, + const struct menu_item_ex *this_item) +{ + if (action == ACTION_STD_OK) + action = ACTION_EXIT_AFTER_THIS_MENUITEM; + return action; + (void)this_item; +} +MAKE_MENU(handle_radio_preset_menu, ID2P(LANG_PRESET), + radio_preset_callback, Icon_NOICON, &radio_edit_preset_item, + &radio_delete_preset_item); +/* present a list of preset stations */ +static const char* presets_get_name(int selected_item, void *data, + char *buffer, size_t buffer_len) +{ + (void)data; + struct fmstation *p = &presets[selected_item]; + if(p->name[0]) + return p->name; + int freq = p->frequency / 10000; + int frac = freq % 100; + freq /= 100; + snprintf(buffer, buffer_len, + str(LANG_FM_DEFAULT_PRESET_NAME), freq, frac); + return buffer; +} + +static int presets_speak_name(int selected_item, void * data) +{ + (void)data; + talk_preset(selected_item, true, false); + return 0; +} + +int handle_radio_presets(void) +{ + struct gui_synclist lists; + int result = 0; + int action = ACTION_NONE; +#ifdef HAVE_BUTTONBAR + struct gui_buttonbar buttonbar; +#endif + + if(presets_loaded == false) + return result; + +#ifdef HAVE_BUTTONBAR + gui_buttonbar_init(&buttonbar); + gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); + gui_buttonbar_set(&buttonbar, str(LANG_FM_BUTTONBAR_ADD), + str(LANG_FM_BUTTONBAR_EXIT), + str(LANG_FM_BUTTONBAR_ACTION)); + gui_buttonbar_draw(&buttonbar); +#endif + gui_synclist_init(&lists, presets_get_name, NULL, false, 1, NULL); + gui_synclist_set_title(&lists, str(LANG_PRESET), NOICON); + gui_synclist_set_icon_callback(&lists, NULL); + if(global_settings.talk_file) + gui_synclist_set_voice_callback(&lists, presets_speak_name); + gui_synclist_set_nb_items(&lists, num_presets); + gui_synclist_select_item(&lists, curr_preset<0 ? 0 : curr_preset); + gui_synclist_speak_item(&lists); + + while (result == 0) + { + gui_synclist_draw(&lists); + list_do_action(CONTEXT_STD, TIMEOUT_BLOCK, + &lists, &action, LIST_WRAP_UNLESS_HELD); + switch (action) + { + case ACTION_STD_MENU: + if (radio_add_preset()) + { + gui_synclist_set_nb_items(&lists, num_presets); + gui_synclist_select_item(&lists, num_presets - 1); + } + break; + case ACTION_STD_CANCEL: + result = 1; + break; + case ACTION_STD_OK: + curr_preset = gui_synclist_get_sel_pos(&lists); + curr_freq = presets[curr_preset].frequency; + next_station(0); + remember_frequency(); + result = 1; + break; + case ACTION_F3: + case ACTION_STD_CONTEXT: + selected_preset = gui_synclist_get_sel_pos(&lists); + do_menu(&handle_radio_preset_menu, NULL, NULL, false); + gui_synclist_set_nb_items(&lists, num_presets); + gui_synclist_select_item(&lists, selected_preset); + gui_synclist_speak_item(&lists); + break; + default: + if(default_event_handler(action) == SYS_USB_CONNECTED) + result = 2; + } + } + return result - 1; +} + + +int scan_presets(void *viewports) +{ + bool do_scan = true; + int i; + struct viewport *vp = (struct viewport *)viewports; + + FOR_NB_SCREENS(i) + screens[i].set_viewport(vp?&vp[i]:NULL); + if(num_presets > 0) /* Do that to avoid 2 questions. */ + do_scan = yesno_pop(ID2P(LANG_FM_CLEAR_PRESETS)); + + if(do_scan) + { + const struct fm_region_data * const fmr = + &fm_region_data[global_settings.fm_region]; + + curr_freq = fmr->freq_min; + num_presets = 0; + memset(presets, 0, sizeof(presets)); + + tuner_set(RADIO_MUTE, 1); + + while(curr_freq <= fmr->freq_max) + { + int freq, frac; + if(num_presets >= MAX_PRESETS || action_userabort(TIMEOUT_NOBLOCK)) + break; + + freq = curr_freq / 10000; + frac = freq % 100; + freq /= 100; + + splashf(0, str(LANG_FM_SCANNING), freq, frac); + + if(tuner_set(RADIO_SCAN_FREQUENCY, curr_freq)) + { + /* add preset */ + presets[num_presets].name[0] = '\0'; + presets[num_presets].frequency = curr_freq; + num_presets++; + } + + curr_freq += fmr->freq_step; + } + + if (get_radio_status() == FMRADIO_PLAYING) + tuner_set(RADIO_MUTE, 0); + + presets_changed = true; + + FOR_NB_SCREENS(i) + { + screens[i].clear_viewport(); + screens[i].update_viewport(); + } + + if(num_presets > 0) + { + curr_freq = presets[0].frequency; + radio_mode = RADIO_PRESET_MODE; + presets_loaded = true; + next_station(0); + } + else + { + /* Wrap it to beginning or we'll be past end of band */ + presets_loaded = false; + next_station(1); + } + } + return true; +} + + +void presets_save(void) +{ + if(filepreset[0] == '\0') + save_preset_list(); + else + radio_save_presets(); +} diff --git a/apps/radio/radio.c b/apps/radio/radio.c new file mode 100644 index 0000000000..b3540610f1 --- /dev/null +++ b/apps/radio/radio.c @@ -0,0 +1,1042 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2003 Linus Nielsen Feltzing + * + * 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. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" +#include +#include +#include +#include "mas.h" +#include "settings.h" +#include "button.h" +#include "status.h" +#include "thread.h" +#include "audio.h" +#include "mp3_playback.h" +#include "ctype.h" +#include "file.h" +#include "general.h" +#include "errno.h" +#include "string-extra.h" +#include "system.h" +#include "radio.h" +#include "menu.h" +#include "misc.h" +#include "keyboard.h" +#include "screens.h" +#include "peakmeter.h" +#include "lang.h" +#include "font.h" +#include "sound_menu.h" +#ifdef HAVE_RECORDING +#include "recording.h" +#endif +#ifdef IPOD_ACCESSORY_PROTOCOL +#include "iap.h" +#endif +#include "appevents.h" +#include "talk.h" +#include "tuner.h" +#include "power.h" +#include "sound.h" +#include "screen_access.h" +#include "splash.h" +#include "yesno.h" +#include "buttonbar.h" +#include "tree.h" +#include "dir.h" +#include "action.h" +#include "list.h" +#include "menus/exported_menus.h" +#include "root_menu.h" +#include "viewport.h" +#include "skin_engine/skin_engine.h" +#include "statusbar-skinned.h" +#include "buffering.h" + +#if CONFIG_TUNER + +#if CONFIG_KEYPAD == RECORDER_PAD +#define FM_RECORD +#define FM_PRESET_ADD +#define FM_PRESET_ACTION +#define FM_PRESET +#define FM_MODE + +#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) +#define FM_PRESET +#define FM_MODE +#define FM_NEXT_PRESET +#define FM_PREV_PRESET + +#elif CONFIG_KEYPAD == IRIVER_H10_PAD +#define FM_PRESET +#define FM_MODE + +#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) +#define FM_PRESET +#define FM_MODE +/* 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 + +#elif CONFIG_KEYPAD == ONDIO_PAD +#define FM_RECORD_DBLPRE +#define FM_RECORD +#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || (CONFIG_KEYPAD == SANSA_C200_PAD) +#define FM_MENU +#define FM_PRESET +#define FM_STOP +#define FM_MODE +#define FM_EXIT +#define FM_PLAY + +#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) +#define FM_PRESET +#define FM_MODE + +#elif (CONFIG_KEYPAD == COWON_D2_PAD) +#define FM_MENU +#define FM_PRESET +#define FM_STOP +#define FM_MODE +#define FM_EXIT +#define FM_PLAY + +#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \ + (CONFIG_KEYPAD == IPOD_1G2G_PAD) +#define FM_MENU +#define FM_STOP +#define FM_EXIT +#define FM_PLAY +#define FM_MODE + +#endif + +/* presets.c needs these so keep unstatic or redo the whole thing! */ +int curr_freq; /* current frequency in Hz */ +/* these are all in presets.c... someone PLEASE rework this ! */ +int handle_radio_presets(void); +static bool radio_menu(void); +int radio_add_preset(void); +int save_preset_list(void); +int load_preset_list(void); +int clear_preset_list(void); +void next_preset(int direction); +void set_current_preset(int preset); +int scan_presets(void *viewports); +int find_preset(int freq); +void radio_save_presets(void); +bool has_presets_changed(void); +void talk_preset(int preset, bool fallback, bool enqueue); +void presets_save(void); + + + +int radio_mode = RADIO_SCAN_MODE; +static int search_dir = 0; + +static int radio_status = FMRADIO_OFF; +static bool in_screen = false; + + +static void radio_off(void); + +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; +} + +/* Function to manipulate all yesno dialogues. + This function needs the output text as an argument. */ +bool yesno_pop(const char* text) +{ + int i; + const char *lines[]={text}; + const struct text_message message={lines, 1}; + bool ret = (gui_syncyesno_run(&message,NULL,NULL)== YESNO_YES); + FOR_NB_SCREENS(i) + screens[i].clear_viewport(); + return ret; +} + +void radio_init(void) +{ + tuner_init(); + radio_off(); +#ifdef HAVE_ALBUMART + radioart_init(false); +#endif +} + +int get_radio_status(void) +{ + return radio_status; +} + +bool in_radio_screen(void) +{ + return in_screen; +} + +/* TODO: Move some more of the control functionality to firmware + and clean up the mess */ + +/* secret flag for starting paused - prevents unmute */ +#define FMRADIO_START_PAUSED 0x8000 +void radio_start(void) +{ + const struct fm_region_data *fmr; + bool start_paused; + + if(radio_status == FMRADIO_PLAYING) + return; + + fmr = &fm_region_data[global_settings.fm_region]; + + start_paused = radio_status & FMRADIO_START_PAUSED; + /* clear flag before any yielding */ + radio_status &= ~FMRADIO_START_PAUSED; + + if(radio_status == FMRADIO_OFF) + tuner_power(true); + + curr_freq = global_status.last_frequency * fmr->freq_step + fmr->freq_min; + + tuner_set(RADIO_SLEEP, 0); /* wake up the tuner */ + + if(radio_status == FMRADIO_OFF) + { +#ifdef HAVE_RADIO_REGION + tuner_set(RADIO_REGION, global_settings.fm_region); +#endif + tuner_set(RADIO_FORCE_MONO, global_settings.fm_force_mono); + } + + tuner_set(RADIO_FREQUENCY, curr_freq); + +#ifdef HAVE_RADIO_MUTE_TIMEOUT + { + 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(); + } + } +#endif + + /* keep radio from sounding initially */ + if(!start_paused) + tuner_set(RADIO_MUTE, 0); + + radio_status = FMRADIO_PLAYING; +} /* radio_start */ + +void radio_pause(void) +{ + if(radio_status == FMRADIO_PAUSED) + return; + + if(radio_status == FMRADIO_OFF) + { + radio_status |= FMRADIO_START_PAUSED; + radio_start(); + } + + tuner_set(RADIO_MUTE, 1); + tuner_set(RADIO_SLEEP, 1); + + radio_status = FMRADIO_PAUSED; +} /* radio_pause */ + +static void radio_off(void) +{ + tuner_set(RADIO_MUTE, 1); + tuner_set(RADIO_SLEEP, 1); /* low power mode, if available */ + radio_status = FMRADIO_OFF; + tuner_power(false); /* status update, power off if avail. */ +} + +void radio_stop(void) +{ + if(radio_status == FMRADIO_OFF) + return; + + radio_off(); +} /* radio_stop */ + +bool radio_hardware_present(void) +{ + return tuner_get(RADIO_PRESENT); +} + +/* Keep freq on the grid for the current region */ +int snap_freq_to_grid(int freq) +{ + const struct fm_region_data * const fmr = + &fm_region_data[global_settings.fm_region]; + + /* 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; +} + +void remember_frequency(void) +{ + const struct fm_region_data * const fmr = + &fm_region_data[global_settings.fm_region]; + global_status.last_frequency = (curr_freq - fmr->freq_min) + / fmr->freq_step; + status_save(); +} + +/* Step to the next or previous frequency */ +static int step_freq(int freq, int direction) +{ + const struct fm_region_data * const fmr = + &fm_region_data[global_settings.fm_region]; + + 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 */ +void next_station(int direction) +{ + if (direction != 0 && radio_mode != RADIO_SCAN_MODE) + { + next_preset(direction); + return; + } + + curr_freq = step_freq(curr_freq, direction); + + if (radio_status == FMRADIO_PLAYING) + tuner_set(RADIO_MUTE, 1); + + tuner_set(RADIO_FREQUENCY, curr_freq); + + if (radio_status == FMRADIO_PLAYING) + tuner_set(RADIO_MUTE, 0); + + set_current_preset(find_preset(curr_freq)); + remember_frequency(); +} + +/* Ends an in-progress search */ +static void end_search(void) +{ + if (search_dir != 0 && radio_status == FMRADIO_PLAYING) + tuner_set(RADIO_MUTE, 0); + search_dir = 0; +} + +/* Speak a frequency. */ +void talk_freq(int freq, bool enqueue) +{ + 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); +} + + +int radio_screen(void) +{ + bool done = false; + int ret_val = GO_TO_ROOT; + int button; + int i; + bool stereo = false, last_stereo = false; + bool update_screen = true, restore = true; + bool screen_freeze = false; + bool keep_playing = false; + bool talk = false; +#ifdef FM_RECORD_DBLPRE + int lastbutton = BUTTON_NONE; + unsigned long rec_lastclick = 0; +#endif +#if CONFIG_CODEC != SWCODEC + bool have_recorded = false; + int timeout = current_tick + HZ/10; + unsigned int last_seconds = 0; +#ifndef SIMULATOR + unsigned int seconds = 0; + struct audio_recording_options rec_options; +#endif +#endif /* CONFIG_CODEC != SWCODEC */ +#ifndef HAVE_NOISY_IDLE_MODE + int button_timeout = current_tick + (2*HZ); +#endif + + /* change status to "in screen" */ + in_screen = true; + + if(radio_preset_count() <= 0) + { + radio_load_presets(global_settings.fmr_file); + } +#ifdef HAVE_ALBUMART + radioart_init(true); +#endif + + if(radio_status == FMRADIO_OFF) + audio_stop(); + +#ifndef SIMULATOR + +#if CONFIG_CODEC != SWCODEC + if(rec_create_directory() > 0) + have_recorded = true; + + audio_init_recording(talk_get_bufsize()); + + sound_settings_apply(); + /* Yes, we use the D/A for monitoring */ + peak_meter_playback(true); + + peak_meter_enable(true); + + rec_init_recording_options(&rec_options); + rec_options.rec_source = AUDIO_SRC_LINEIN; + rec_set_recording_options(&rec_options); + + audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN), + sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN); + +#endif /* CONFIG_CODEC != SWCODEC */ +#endif /* ndef SIMULATOR */ + + /* turn on radio */ +#if CONFIG_CODEC == SWCODEC + audio_set_input_source(AUDIO_SRC_FMRADIO, + (radio_status == FMRADIO_PAUSED) ? + SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING); +#else + if (radio_status == FMRADIO_OFF) + radio_start(); +#endif + + if(radio_preset_count() < 1 && yesno_pop(ID2P(LANG_FM_FIRST_AUTOSCAN))) + scan_presets(NULL); + + set_current_preset(find_preset(curr_freq)); + if(radio_current_preset() != -1) + radio_mode = RADIO_PRESET_MODE; + +#ifndef HAVE_NOISY_IDLE_MODE + cpu_idle_mode(true); +#endif + + while(!done) + { + if(search_dir != 0) + { + curr_freq = step_freq(curr_freq, search_dir); + update_screen = true; + + if(tuner_set(RADIO_SCAN_FREQUENCY, curr_freq)) + { + set_current_preset(find_preset(curr_freq)); + remember_frequency(); + end_search(); + talk = true; + } + trigger_cpu_boost(); + } + + if (!update_screen) + { + cancel_cpu_boost(); + } + + button = fms_do_button_loop(update_screen); + +#ifndef HAVE_NOISY_IDLE_MODE + if (button != ACTION_NONE) + { + cpu_idle_mode(false); + button_timeout = current_tick + (2*HZ); + } +#endif + switch(button) + { + case ACTION_FM_STOP: +#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) + if(audio_status() == AUDIO_STATUS_RECORD) + { + audio_stop(); + } + else +#endif + { + done = true; + if(has_presets_changed()) + { + if(yesno_pop(ID2P(LANG_FM_SAVE_CHANGES))) + { + presets_save(); + } + } + } + update_screen = true; + break; + +#ifdef FM_RECORD + case ACTION_FM_RECORD: +#ifdef FM_RECORD_DBLPRE + if (lastbutton != ACTION_FM_RECORD_DBLPRE) + { + rec_lastclick = 0; + break; + } + if (current_tick - rec_lastclick > HZ/2) + { + rec_lastclick = current_tick; + break; + } +#endif /* FM_RECORD_DBLPRE */ +#ifndef SIMULATOR + if(audio_status() == AUDIO_STATUS_RECORD) + { + rec_command(RECORDING_CMD_START_NEWFILE); + update_screen = true; + } + else + { + have_recorded = true; + rec_command(RECORDING_CMD_START); + update_screen = true; + } +#endif /* SIMULATOR */ + last_seconds = 0; + break; +#endif /* #ifdef FM_RECORD */ + + case ACTION_FM_EXIT: +#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) + if(audio_status() == AUDIO_STATUS_RECORD) + audio_stop(); +#endif + keep_playing = true; + done = true; + ret_val = GO_TO_ROOT; + if(has_presets_changed()) + { + if(yesno_pop(ID2P(LANG_FM_SAVE_CHANGES))) + { + presets_save(); + } + } + + break; + + case ACTION_STD_PREV: + case ACTION_STD_NEXT: + next_station(button == ACTION_STD_PREV ? -1 : 1); + end_search(); + update_screen = true; + talk = true; + break; + + case ACTION_STD_PREVREPEAT: + case ACTION_STD_NEXTREPEAT: + { + int dir = search_dir; + search_dir = button == ACTION_STD_PREVREPEAT ? -1 : 1; + if (radio_mode != RADIO_SCAN_MODE) + { + next_preset(search_dir); + end_search(); + update_screen = true; + talk = true; + } + else if (dir == 0) + { + /* Starting auto scan */ + tuner_set(RADIO_MUTE, 1); + update_screen = true; + } + break; + } + + case ACTION_SETTINGS_INC: + case ACTION_SETTINGS_INCREPEAT: + global_settings.volume++; + setvol(); + update_screen = true; + break; + + case ACTION_SETTINGS_DEC: + case ACTION_SETTINGS_DECREPEAT: + global_settings.volume--; + setvol(); + update_screen = true; + break; + + case ACTION_FM_PLAY: + if (radio_status == FMRADIO_PLAYING) + radio_pause(); + else + radio_start(); + + update_screen = true; + talk = false; + talk_shutup(); + break; + + case ACTION_FM_MENU: + fms_fix_displays(FMS_EXIT); + radio_menu(); + set_current_preset(find_preset(curr_freq)); + update_screen = true; + restore = true; + break; + +#ifdef FM_PRESET + case ACTION_FM_PRESET: + if(radio_preset_count() < 1) + { + splash(HZ, ID2P(LANG_FM_NO_PRESETS)); + update_screen = true; + break; + } + fms_fix_displays(FMS_EXIT); + handle_radio_presets(); + update_screen = true; + restore = true; + break; +#endif /* FM_PRESET */ + +#ifdef FM_FREEZE + case ACTION_FM_FREEZE: + if(!screen_freeze) + { + splash(HZ, str(LANG_FM_FREEZE)); + screen_freeze = true; + } + else + { + update_screen = true; + screen_freeze = false; + } + break; +#endif /* FM_FREEZE */ + + case SYS_USB_CONNECTED: +#if CONFIG_CODEC != SWCODEC + /* Only accept USB connection when not recording */ + if(audio_status() != AUDIO_STATUS_RECORD) +#endif + { + default_event_handler(SYS_USB_CONNECTED); + screen_freeze = true; /* Cosmetic: makes sure the + radio screen doesn't redraw */ + done = true; + } + break; + +#ifdef FM_MODE + case ACTION_FM_MODE: + if(radio_mode == RADIO_SCAN_MODE) + { + /* Force scan mode if there are no presets. */ + if(radio_preset_count() > 0) + radio_mode = RADIO_PRESET_MODE; + } + else + radio_mode = RADIO_SCAN_MODE; + update_screen = true; + cond_talk_ids_fq(radio_mode ? + LANG_PRESET : LANG_RADIO_SCAN_MODE); + talk = true; + break; +#endif /* FM_MODE */ + +#ifdef FM_NEXT_PRESET + case ACTION_FM_NEXT_PRESET: + next_preset(1); + end_search(); + update_screen = true; + talk = true; + break; +#endif + +#ifdef FM_PREV_PRESET + case ACTION_FM_PREV_PRESET: + next_preset(-1); + end_search(); + update_screen = true; + talk = true; + break; +#endif + + default: + default_event_handler(button); +#ifdef HAVE_RDS_CAP + if (tuner_get(RADIO_EVENT)) + update_screen = true; +#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; + ret_val = GO_TO_ROOT; + if(has_presets_changed()) + { + if(yesno_pop(ID2P(LANG_FM_SAVE_CHANGES))) + { + radio_save_presets(); + } + } + + /* Clear the preset list on exit. */ + clear_preset_list(); + } + break; + } /*switch(button)*/ + +#ifdef FM_RECORD_DBLPRE + if (button != ACTION_NONE) + lastbutton = button; +#endif + +#if CONFIG_CODEC != SWCODEC + peak_meter_peek(); +#endif + + if(!screen_freeze) + { + /* Only display the peak meter when not recording */ +#if CONFIG_CODEC != SWCODEC + if(TIME_AFTER(current_tick, timeout)) + { + timeout = current_tick + HZ; +#else /* SWCODEC */ + { +#endif /* CONFIG_CODEC == SWCODEC */ + + /* keep "mono" from always being displayed when paused */ + if (radio_status != FMRADIO_PAUSED) + { + stereo = tuner_get(RADIO_STEREO) && + !global_settings.fm_force_mono; + + if(stereo != last_stereo) + { + update_screen = true; + last_stereo = stereo; + } + } + } + +#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) + seconds = audio_recorded_time() / HZ; + if (update_screen || seconds > last_seconds || restore) + { + last_seconds = seconds; +#else + if (update_screen || restore) + { +#endif + if (restore) + fms_fix_displays(FMS_ENTER); + FOR_NB_SCREENS(i) + skin_update(fms_get(i), WPS_REFRESH_ALL); + restore = false; + } + } + update_screen = false; + + 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; + } + if (radio_current_preset() >= 0) + talk_preset(radio_current_preset(), radio_mode == RADIO_PRESET_MODE, + enqueue); + } + +#if CONFIG_CODEC != SWCODEC + if(audio_status() & AUDIO_STATUS_ERROR) + { + done = true; + } +#endif + +#ifndef HAVE_NOISY_IDLE_MODE + if (TIME_AFTER(current_tick, button_timeout)) + { + cpu_idle_mode(true); + } +#endif + } /*while(!done)*/ + +#ifndef SIMULATOR +#if CONFIG_CODEC != SWCODEC + if(audio_status() & AUDIO_STATUS_ERROR) + { + splash(0, str(LANG_DISK_FULL)); + audio_error_clear(); + + while(1) + { + button = get_action(CONTEXT_FM, TIMEOUT_BLOCK); + if(button == ACTION_FM_STOP) + break; + } + } + + audio_init_playback(); +#endif /* CONFIG_CODEC != SWCODEC */ + + sound_settings_apply(); +#endif /* SIMULATOR */ + + if(keep_playing) + { +/* Catch FMRADIO_PLAYING status for the sim. */ +#ifndef SIMULATOR +#if CONFIG_CODEC != SWCODEC + /* Enable the Left and right A/D Converter */ + audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN), + sound_default(SOUND_RIGHT_GAIN), + AUDIO_GAIN_LINEIN); + mas_codec_writereg(6, 0x4000); +#endif + end_search(); +#endif /* SIMULATOR */ + } + else + { +#if CONFIG_CODEC == SWCODEC + audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); +#else + radio_stop(); +#endif + } + +#ifndef HAVE_NOISY_IDLE_MODE + cpu_idle_mode(false); +#endif + fms_fix_displays(FMS_EXIT); + in_screen = false; +#if CONFIG_CODEC != SWCODEC + return have_recorded; +#else + return false; +#endif +} /* radio_screen */ + +void toggle_mono_mode(bool mono) +{ + tuner_set(RADIO_FORCE_MONO, mono); +} + +void set_radio_region(int region) +{ +#ifdef HAVE_RADIO_REGION + tuner_set(RADIO_REGION, region); +#endif + next_station(0); + remember_frequency(); + (void)region; +} + +MENUITEM_SETTING(set_region, &global_settings.fm_region, NULL); +MENUITEM_SETTING(force_mono, &global_settings.fm_force_mono, NULL); + +#ifndef FM_MODE +static char* get_mode_text(int selected_item, void * data, char *buffer) +{ + (void)selected_item; + (void)data; + snprintf(buffer, MAX_PATH, "%s %s", str(LANG_MODE), + radio_mode ? str(LANG_PRESET) : + str(LANG_RADIO_SCAN_MODE)); + return buffer; +} +static int toggle_radio_mode(void) +{ + radio_mode = (radio_mode == RADIO_SCAN_MODE) ? + RADIO_PRESET_MODE : RADIO_SCAN_MODE; + return 0; +} +MENUITEM_FUNCTION_DYNTEXT(radio_mode_item, 0, + toggle_radio_mode, NULL, + get_mode_text, NULL, NULL, NULL, Icon_NOICON); +#endif + + + +#ifdef HAVE_RECORDING + +#if defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC +#define FM_RECORDING_SCREEN +static int fm_recording_screen(void) +{ + 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; +} + +#endif /* defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC */ + +#if defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC +#define FM_RECORDING_SETTINGS +static int fm_recording_settings(void) +{ + bool ret = recording_menu(true); + +#if CONFIG_CODEC != SWCODEC + if (!ret) + { + 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); + } +#endif + + return ret; +} + +#endif /* defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC */ +#endif /* HAVE_RECORDING */ + +#ifdef FM_RECORDING_SCREEN +MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING), + fm_recording_screen, NULL, NULL, Icon_Recording); +#endif +#ifdef FM_RECORDING_SETTINGS +MENUITEM_FUNCTION(recsettings_item, 0, ID2P(LANG_RECORDING_SETTINGS), + fm_recording_settings, NULL, NULL, Icon_Recording); +#endif +#ifndef FM_PRESET +int handle_radio_presets_menu(void) +{ + return handle_radio_presets(); +} +MENUITEM_FUNCTION(radio_presets_item, 0, ID2P(LANG_PRESET), + handle_radio_presets_menu, NULL, NULL, Icon_NOICON); +#endif +#ifndef FM_PRESET_ADD +int handle_radio_addpreset_menu(void) +{ + return radio_add_preset(); +} +MENUITEM_FUNCTION(radio_addpreset_item, 0, ID2P(LANG_FM_ADD_PRESET), + radio_add_preset, NULL, NULL, Icon_NOICON); +#endif + + +MENUITEM_FUNCTION(presetload_item, 0, ID2P(LANG_FM_PRESET_LOAD), + load_preset_list, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(presetsave_item, 0, ID2P(LANG_FM_PRESET_SAVE), + save_preset_list, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(presetclear_item, 0, ID2P(LANG_FM_PRESET_CLEAR), + clear_preset_list, NULL, NULL, Icon_NOICON); +MENUITEM_FUNCTION(scan_presets_item, MENU_FUNC_USEPARAM, + ID2P(LANG_FM_SCAN_PRESETS), + scan_presets, NULL, NULL, Icon_NOICON); + +MAKE_MENU(radio_settings_menu, ID2P(LANG_FM_MENU), NULL, + Icon_Radio_screen, +#ifndef FM_PRESET + &radio_presets_item, +#endif +#ifndef FM_PRESET_ADD + &radio_addpreset_item, +#endif + &presetload_item, &presetsave_item, &presetclear_item, + &force_mono, +#ifndef FM_MODE + &radio_mode_item, +#endif + &set_region, &sound_settings, +#ifdef FM_RECORDING_SCREEN + &recscreen_item, +#endif +#ifdef FM_RECORDING_SETTINGS + &recsettings_item, +#endif + &scan_presets_item); +/* main menu of the radio screen */ +static bool radio_menu(void) +{ + return do_menu(&radio_settings_menu, NULL, NULL, false) == + MENU_ATTACHED_USB; +} + +#endif diff --git a/apps/radio/radio.h b/apps/radio/radio.h new file mode 100644 index 0000000000..f7b0a0e80b --- /dev/null +++ b/apps/radio/radio.h @@ -0,0 +1,84 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2003 Linus Nielsen Feltzing + * + * 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. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef RADIO_H +#define RADIO_H + +#ifndef FMRADIO_H +#include "fmradio.h" +#endif +#include "screen_access.h" +#include "bmp.h" + +enum { + RADIO_SCAN_MODE = 0, + RADIO_PRESET_MODE, +}; + +#if CONFIG_TUNER +void radio_load_presets(char *filename); +void radio_init(void) INIT_ATTR; +int radio_screen(void); +void radio_start(void); +void radio_pause(void); +void radio_stop(void); +bool radio_hardware_present(void); +bool in_radio_screen(void); + +bool radio_scan_mode(void); /* true for scan mode, false for preset mode */ +bool radio_is_stereo(void); +int radio_current_frequency(void); +int radio_current_preset(void); +int radio_preset_count(void); +const struct fmstation *radio_get_preset(int preset); + +/* skin functions */ +void fms_data_load(enum screen_type screen, const char *buf, bool isfile); +void fms_skin_init(void); + +/* callbacks for the radio settings */ +void set_radio_region(int region); +void toggle_mono_mode(bool mono); + +#define MAX_FMPRESET_LEN 27 + +struct fmstation +{ + int frequency; /* In Hz */ + char name[MAX_FMPRESET_LEN+1]; +}; +const char* radio_get_preset_name(int preset); + +#ifdef HAVE_ALBUMART +void radioart_init(bool entering_screen); +int radio_get_art_hid(struct dim *requested_dim); +#endif + +void next_station(int direction); + + +enum fms_exiting { + FMS_EXIT, + FMS_ENTER +}; + +#endif /* CONFIG_TUNER */ + +#endif /* RADIO_H */ diff --git a/apps/radio/radio_skin.c b/apps/radio/radio_skin.c new file mode 100644 index 0000000000..f9713703ac --- /dev/null +++ b/apps/radio/radio_skin.c @@ -0,0 +1,118 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: radio.c -1 $ + * + * Copyright (C) 2010 Jonathan Gordon + * + * 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. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + + +#include "config.h" +#include +#include +#include +#include "skin_engine/skin_engine.h" +#include "settings.h" +#include "radio.h" +#include "action.h" +#include "appevents.h" +#include "statusbar-skinned.h" + + +extern struct wps_state wps_state; /* from wps.c */ +static struct gui_wps fms_skin[NB_SCREENS] = {{ .data = NULL }}; +static struct wps_data fms_skin_data[NB_SCREENS] = {{ .wps_loaded = 0 }}; +static struct wps_sync_data fms_skin_sync_data = { .do_full_update = false }; + +void fms_data_load(enum screen_type screen, const char *buf, bool isfile) +{ + struct wps_data *data = fms_skin[screen].data; + int success; + success = buf && skin_data_load(screen, data, buf, isfile); + + if (!success ) /* load the default */ + { + const char default_fms[] = "%Sx|Station:| %tf\n" + "%?ts<%Sx|Stereo||%Sx|Mono|>\n" + "%?tm<%Sx|Mode:| %Sx|Scan||%Sx|Preset|: %Ti. %?Tn<%Tn|%Tf>>\n" + "%pb\n" +#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) + "%?Rr<%Sx|Time:| %Rh:%Rn:%Rs|" + "%?St|prerecording time|<%Sx|Prerecord Time| %Rs|%pm>>\n" +#endif +#ifdef HAVE_RDS_CAP + "\n%s%ty\n" + "%s%tz\n" +#endif + ; + skin_data_load(screen, data, default_fms, false); + } +} +void fms_fix_displays(enum fms_exiting toggle_state) +{ + int i; + FOR_NB_SCREENS(i) + { + if (toggle_state == FMS_ENTER) + { + viewportmanager_theme_enable(i, skin_has_sbs(i, fms_skin[i].data), NULL); +#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 + screens[i].backdrop_show(fms_skin[i].data->backdrop); +#endif + screens[i].clear_display(); + /* force statusbar/skin update since we just cleared the whole screen */ + send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); + } + else + { + screens[i].stop_scroll(); +#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 + screens[i].backdrop_show(sb_get_backdrop(i)); +#endif + viewportmanager_theme_undo(i, skin_has_sbs(i, fms_skin[i].data)); + } + } +} + + +void fms_skin_init(void) +{ + int i; + FOR_NB_SCREENS(i) + { +#ifdef HAVE_ALBUMART + fms_skin_data[i].albumart = NULL; + fms_skin_data[i].playback_aa_slot = -1; +#endif + fms_skin[i].data = &fms_skin_data[i]; + fms_skin[i].display = &screens[i]; + /* Currently no seperate wps_state needed/possible + so use the only available ( "global" ) one */ + fms_skin[i].state = &wps_state; + fms_skin[i].sync_data = &fms_skin_sync_data; + } +} + +int fms_do_button_loop(bool update_screen) +{ + return skin_wait_for_action(fms_skin, CONTEXT_FM, + update_screen ? TIMEOUT_NOBLOCK : HZ); +} + +struct gui_wps *fms_get(enum screen_type screen) +{ + return &fms_skin[screen]; +} diff --git a/apps/radio/radioart.c b/apps/radio/radioart.c new file mode 100644 index 0000000000..319f254144 --- /dev/null +++ b/apps/radio/radioart.c @@ -0,0 +1,180 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: radio.c -1 $ + * + * Copyright (C) 2010 Jonathan Gordon + * + * 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. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" +#include +#include +#include +#include "settings.h" +#include "radio.h" +#include "buffering.h" +#include "file.h" +#include "kernel.h" +#include "string-extra.h" +#include "misc.h" + +#define MAX_RADIOART_IMAGES 10 +struct radioart { + int handle; + long last_tick; + struct dim dim; + char name[MAX_FMPRESET_LEN+1]; +}; + +static struct radioart radioart[MAX_RADIOART_IMAGES]; +#ifdef HAVE_RECORDING +static bool allow_buffer_access = true; /* If we are recording dont touch the buffers! */ +#endif +static int find_oldest_image(void) +{ + int i; + long oldest_tick = radioart[0].last_tick; + int oldest_idx = 0; + for(i=1;iname, preset_name, MAX_FMPRESET_LEN+1); + ra->dim.height = dim->height; + ra->dim.width = dim->width; + ra->last_tick = current_tick; + ra->handle = bufopen(path, 0, TYPE_BITMAP, &ra->dim); + if (ra->handle == ERR_BUFFER_FULL) + { + int i = find_oldest_image(); + bufclose(i); + ra->handle = bufopen(path, 0, TYPE_BITMAP, &ra->dim); + } +#ifndef HAVE_NOISY_IDLE_MODE + cpu_idle_mode(true); +#endif + return ra->handle; +} +int radio_get_art_hid(struct dim *requested_dim) +{ + int preset = radio_current_preset(); + int i, free_idx = -1; + const char* preset_name; + if (radio_scan_mode() || preset < 0) + return -1; +#ifdef HAVE_RECORDING + if (!allow_buffer_access) + return -1; +#endif + preset_name = radio_get_preset_name(preset); + for(i=0;iwidth && + radioart[i].dim.height == requested_dim->height) + { + radioart[i].last_tick = current_tick; + return radioart[i].handle; + } + } + if (free_idx >= 0) + { + return load_radioart_image(&radioart[free_idx], + preset_name, requested_dim); + } + else + { + int i = find_oldest_image(); + bufclose(radioart[i].handle); + return load_radioart_image(&radioart[i], + preset_name, requested_dim); + } + + return -1; +} +static void playback_restarting_handler(void *data) +{ + (void)data; + int i; + for(i=0;i= 0) + bufclose(radioart[i].handle); + radioart[i].handle = -1; + radioart[i].name[0] = '\0'; + } +} +#ifdef HAVE_RECORDING +static void recording_started_handler(void *data) +{ + (void)data; + allow_buffer_access = false; + playback_restarting_handler(NULL); +} +static void recording_stopped_handler(void *data) +{ + (void)data; + allow_buffer_access = true; +} +#endif + +void radioart_init(bool entering_screen) +{ + int i; + if (entering_screen) + { + for(i=0;i ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2003 Linus Nielsen Feltzing - * - * 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. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include "config.h" -#include -#include -#include -#include "mas.h" -#include "settings.h" -#include "button.h" -#include "status.h" -#include "thread.h" -#include "audio.h" -#include "mp3_playback.h" -#include "ctype.h" -#include "file.h" -#include "general.h" -#include "errno.h" -#include "string-extra.h" -#include "system.h" -#include "radio.h" -#include "menu.h" -#include "misc.h" -#include "keyboard.h" -#include "screens.h" -#include "peakmeter.h" -#include "lang.h" -#include "font.h" -#include "sound_menu.h" -#ifdef HAVE_RECORDING -#include "recording.h" -#endif -#ifdef IPOD_ACCESSORY_PROTOCOL -#include "iap.h" -#endif -#include "appevents.h" -#include "talk.h" -#include "tuner.h" -#include "power.h" -#include "sound.h" -#include "screen_access.h" -#include "splash.h" -#include "yesno.h" -#include "buttonbar.h" -#include "tree.h" -#include "dir.h" -#include "action.h" -#include "list.h" -#include "menus/exported_menus.h" -#include "root_menu.h" -#include "viewport.h" -#include "skin_engine/skin_engine.h" -#include "statusbar-skinned.h" -#include "buffering.h" - -#if CONFIG_TUNER - -#if CONFIG_KEYPAD == RECORDER_PAD -#define FM_RECORD -#define FM_PRESET_ADD -#define FM_PRESET_ACTION -#define FM_PRESET -#define FM_MODE - -#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD) -#define FM_PRESET -#define FM_MODE -#define FM_NEXT_PRESET -#define FM_PREV_PRESET - -#elif CONFIG_KEYPAD == IRIVER_H10_PAD -#define FM_PRESET -#define FM_MODE - -#elif (CONFIG_KEYPAD == IAUDIO_X5M5_PAD) -#define FM_PRESET -#define FM_MODE -/* 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 - -#elif CONFIG_KEYPAD == ONDIO_PAD -#define FM_RECORD_DBLPRE -#define FM_RECORD -#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || (CONFIG_KEYPAD == SANSA_C200_PAD) -#define FM_MENU -#define FM_PRESET -#define FM_STOP -#define FM_MODE -#define FM_EXIT -#define FM_PLAY - -#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) -#define FM_PRESET -#define FM_MODE - -#elif (CONFIG_KEYPAD == COWON_D2_PAD) -#define FM_MENU -#define FM_PRESET -#define FM_STOP -#define FM_MODE -#define FM_EXIT -#define FM_PLAY - -#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \ - (CONFIG_KEYPAD == IPOD_1G2G_PAD) -#define FM_MENU -#define FM_STOP -#define FM_EXIT -#define FM_PLAY -#define FM_MODE - -#endif - -#define RADIO_SCAN_MODE 0 -#define RADIO_PRESET_MODE 1 - -static int curr_preset = -1; -static int curr_freq; /* current frequency in Hz */ -static int radio_mode = RADIO_SCAN_MODE; -static int search_dir = 0; - -static int radio_status = FMRADIO_OFF; -static bool in_screen = false; - -#define MAX_PRESETS 64 -static bool presets_loaded = false, presets_changed = false; -static struct fmstation presets[MAX_PRESETS]; - -static char filepreset[MAX_PATH]; /* preset filename variable */ - -static int num_presets = 0; /* The number of presets in the preset list */ - -static void radio_save_presets(void); -static int handle_radio_presets(void); -static bool radio_menu(void); -static int radio_add_preset(void); -static int save_preset_list(void); -static int load_preset_list(void); -static int clear_preset_list(void); - -static int scan_presets(void *viewports); -static void radio_off(void); - -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; -} - -int radio_current_preset(void) -{ - return curr_preset; -} -int radio_preset_count(void) -{ - return num_presets; -} -const struct fmstation *radio_get_preset(int preset) -{ - return &presets[preset]; -} -/* Function to manipulate all yesno dialogues. - This function needs the output text as an argument. */ -static bool yesno_pop(const char* text) -{ - int i; - const char *lines[]={text}; - const struct text_message message={lines, 1}; - bool ret = (gui_syncyesno_run(&message,NULL,NULL)== YESNO_YES); - FOR_NB_SCREENS(i) - screens[i].clear_viewport(); - return ret; -} - -#if defined(HAVE_RECORDING) && defined(HAVE_ALBUMART) -static void recording_started_handler(void *data); -static void recording_stopped_handler(void *data); -#endif -void radio_init(void) -{ - tuner_init(); - radio_off(); -#if defined(HAVE_RECORDING) && defined(HAVE_ALBUMART) - add_event(RECORDING_EVENT_START, false, recording_started_handler); - add_event(RECORDING_EVENT_STOP, false, recording_stopped_handler); -#endif -} - -int get_radio_status(void) -{ - return radio_status; -} - -bool in_radio_screen(void) -{ - return in_screen; -} - -/* TODO: Move some more of the control functionality to firmware - and clean up the mess */ - -/* secret flag for starting paused - prevents unmute */ -#define FMRADIO_START_PAUSED 0x8000 -void radio_start(void) -{ - const struct fm_region_data *fmr; - bool start_paused; - - if(radio_status == FMRADIO_PLAYING) - return; - - fmr = &fm_region_data[global_settings.fm_region]; - - start_paused = radio_status & FMRADIO_START_PAUSED; - /* clear flag before any yielding */ - radio_status &= ~FMRADIO_START_PAUSED; - - if(radio_status == FMRADIO_OFF) - tuner_power(true); - - curr_freq = global_status.last_frequency * fmr->freq_step + fmr->freq_min; - - tuner_set(RADIO_SLEEP, 0); /* wake up the tuner */ - - if(radio_status == FMRADIO_OFF) - { -#ifdef HAVE_RADIO_REGION - tuner_set(RADIO_REGION, global_settings.fm_region); -#endif - tuner_set(RADIO_FORCE_MONO, global_settings.fm_force_mono); - } - - tuner_set(RADIO_FREQUENCY, curr_freq); - -#ifdef HAVE_RADIO_MUTE_TIMEOUT - { - 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(); - } - } -#endif - - /* keep radio from sounding initially */ - if(!start_paused) - tuner_set(RADIO_MUTE, 0); - - radio_status = FMRADIO_PLAYING; -} /* radio_start */ - -void radio_pause(void) -{ - if(radio_status == FMRADIO_PAUSED) - return; - - if(radio_status == FMRADIO_OFF) - { - radio_status |= FMRADIO_START_PAUSED; - radio_start(); - } - - tuner_set(RADIO_MUTE, 1); - tuner_set(RADIO_SLEEP, 1); - - radio_status = FMRADIO_PAUSED; -} /* radio_pause */ - -static void radio_off(void) -{ - tuner_set(RADIO_MUTE, 1); - tuner_set(RADIO_SLEEP, 1); /* low power mode, if available */ - radio_status = FMRADIO_OFF; - tuner_power(false); /* status update, power off if avail. */ -} - -void radio_stop(void) -{ - if(radio_status == FMRADIO_OFF) - return; - - radio_off(); -} /* radio_stop */ - -bool radio_hardware_present(void) -{ - return tuner_get(RADIO_PRESENT); -} - -/* Keep freq on the grid for the current region */ -static int snap_freq_to_grid(int freq) -{ - const struct fm_region_data * const fmr = - &fm_region_data[global_settings.fm_region]; - - /* 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; -} - -/* Find a matching preset to freq */ -static int find_preset(int freq) -{ - int i; - if(num_presets < 1) - return -1; - for(i = 0;i < MAX_PRESETS;i++) - { - if(freq == presets[i].frequency) - return i; - } - - return -1; -} - -/* Return the closest preset encountered in the search direction with - wraparound. */ -static int find_closest_preset(int freq, int direction) -{ - int i; - int lowpreset = 0; - int highpreset = 0; - int closest = -1; - - if (direction == 0) /* direction == 0 isn't really used */ - return 0; - - for (i = 0; i < num_presets; i++) - { - int f = presets[i].frequency; - if (f == freq) - return i; /* Exact match = stop */ - - /* remember the highest and lowest presets for wraparound */ - if (f < presets[lowpreset].frequency) - lowpreset = i; - if (f > presets[highpreset].frequency) - highpreset = i; - - /* find the closest preset in the given direction */ - if (direction > 0 && f > freq) - { - if (closest < 0 || f < presets[closest].frequency) - closest = i; - } - else if (direction < 0 && f < freq) - { - if (closest < 0 || f > presets[closest].frequency) - closest = i; - } - } - - if (closest < 0) - { - /* no presets in the given direction */ - /* wrap around depending on direction */ - if (direction < 0) - closest = highpreset; - else - closest = lowpreset; - } - - return closest; -} - -static void remember_frequency(void) -{ - const struct fm_region_data * const fmr = - &fm_region_data[global_settings.fm_region]; - global_status.last_frequency = (curr_freq - fmr->freq_min) - / fmr->freq_step; - status_save(); -} - -static void next_preset(int direction) -{ - if (num_presets < 1) - return; - - if (curr_preset == -1) - curr_preset = find_closest_preset(curr_freq, direction); - else - curr_preset = (curr_preset + direction + num_presets) % num_presets; - - /* Must stay on the current grid for the region */ - curr_freq = snap_freq_to_grid(presets[curr_preset].frequency); - - tuner_set(RADIO_FREQUENCY, curr_freq); - remember_frequency(); -} - -/* Step to the next or previous frequency */ -static int step_freq(int freq, int direction) -{ - const struct fm_region_data * const fmr = - &fm_region_data[global_settings.fm_region]; - - 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 */ -static void next_station(int direction) -{ - if (direction != 0 && radio_mode != RADIO_SCAN_MODE) - { - next_preset(direction); - return; - } - - curr_freq = step_freq(curr_freq, direction); - - if (radio_status == FMRADIO_PLAYING) - tuner_set(RADIO_MUTE, 1); - - tuner_set(RADIO_FREQUENCY, curr_freq); - - if (radio_status == FMRADIO_PLAYING) - tuner_set(RADIO_MUTE, 0); - - curr_preset = find_preset(curr_freq); - remember_frequency(); -} - -/* Ends an in-progress search */ -static void end_search(void) -{ - if (search_dir != 0 && radio_status == FMRADIO_PLAYING) - tuner_set(RADIO_MUTE, 0); - search_dir = 0; -} - -/* Speak a frequency. */ -static void talk_freq(int freq, bool enqueue) -{ - 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); -} - -/* Speak a preset by number or by spelling its name, depending on settings. */ -static void talk_preset(int preset, bool fallback, bool enqueue) -{ - if (global_settings.talk_file == 1) /* number */ - talk_number(preset + 1, enqueue); - else - { /* spell */ - if(presets[preset].name[0]) - talk_spell(presets[preset].name, enqueue); - else if(fallback) - talk_freq(presets[preset].frequency, enqueue); - } -} - -/* Skin stuff */ -extern struct wps_state wps_state; /* from wps.c */ -static struct gui_wps fms_skin[NB_SCREENS] = {{ .data = NULL }}; -static struct wps_data fms_skin_data[NB_SCREENS] = {{ .wps_loaded = 0 }}; -static struct wps_sync_data fms_skin_sync_data = { .do_full_update = false }; - -#ifdef HAVE_ALBUMART -#define MAX_RADIOART_IMAGES 10 -struct radioart { - int handle; - long last_tick; - struct dim dim; - char name[MAX_FMPRESET_LEN+1]; -}; - -static struct radioart radioart[MAX_RADIOART_IMAGES]; -#ifdef HAVE_RECORDING -static bool allow_buffer_access = true; /* If we are recording dont touch the buffers! */ -#endif -static int find_oldest_image(void) -{ - int i; - long oldest_tick = radioart[0].last_tick; - int oldest_idx = 0; - for(i=1;iname, preset_name, MAX_FMPRESET_LEN+1); - ra->dim.height = dim->height; - ra->dim.width = dim->width; - ra->last_tick = current_tick; - ra->handle = bufopen(path, 0, TYPE_BITMAP, &ra->dim); - if (ra->handle == ERR_BUFFER_FULL) - { - int i = find_oldest_image(); - bufclose(i); - ra->handle = bufopen(path, 0, TYPE_BITMAP, &ra->dim); - } -#ifndef HAVE_NOISY_IDLE_MODE - cpu_idle_mode(true); -#endif - return ra->handle; -} -int radio_get_art_hid(struct dim *requested_dim) -{ - int preset = radio_current_preset(); - int i, free_idx = -1; - if ((radio_mode != RADIO_PRESET_MODE) || preset < 0) - return -1; -#ifdef HAVE_RECORDING - if (!allow_buffer_access) - return -1; -#endif - for(i=0;iwidth && - radioart[i].dim.height == requested_dim->height) - { - radioart[i].last_tick = current_tick; - return radioart[i].handle; - } - } - if (free_idx >= 0) - { - return load_radioart_image(&radioart[free_idx], - presets[preset].name, requested_dim); - } - else - { - int i = find_oldest_image(); - bufclose(radioart[i].handle); - return load_radioart_image(&radioart[i], - presets[preset].name, requested_dim); - } - - return -1; -} -static void playback_restarting_handler(void *data) -{ - (void)data; - int i; - for(i=0;i= 0) - bufclose(radioart[i].handle); - radioart[i].handle = -1; - radioart[i].name[0] = '\0'; - } -} -#ifdef HAVE_RECORDING -static void recording_started_handler(void *data) -{ - (void)data; - allow_buffer_access = false; - playback_restarting_handler(NULL); -} -static void recording_stopped_handler(void *data) -{ - (void)data; - allow_buffer_access = true; -} -#endif -#endif - -void fms_data_load(enum screen_type screen, const char *buf, bool isfile) -{ - struct wps_data *data = fms_skin[screen].data; - int success; - success = buf && skin_data_load(screen, data, buf, isfile); - - if (!success ) /* load the default */ - { - const char default_fms[] = "%Sx|Station:| %tf\n" - "%?ts<%Sx|Stereo||%Sx|Mono|>\n" - "%?tm<%Sx|Mode:| %Sx|Scan||%Sx|Preset|: %Ti. %?Tn<%Tn|%Tf>>\n" - "%pb\n" -#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) - "%?Rr<%Sx|Time:| %Rh:%Rn:%Rs|" - "%?St|prerecording time|<%Sx|Prerecord Time| %Rs|%pm>>\n" -#endif -#ifdef HAVE_RDS_CAP - "\n%s%ty\n" - "%s%tz\n" -#endif - ; - skin_data_load(screen, data, default_fms, false); - } -} -enum fms_exiting { - FMS_EXIT, - FMS_ENTER -}; -void fms_fix_displays(enum fms_exiting toggle_state) -{ - int i; - FOR_NB_SCREENS(i) - { - if (toggle_state == FMS_ENTER) - { - viewportmanager_theme_enable(i, skin_has_sbs(i, fms_skin[i].data), NULL); -#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - screens[i].backdrop_show(fms_skin[i].data->backdrop); -#endif - screens[i].clear_display(); - /* force statusbar/skin update since we just cleared the whole screen */ - send_event(GUI_EVENT_ACTIONUPDATE, (void*)1); - } - else - { - screens[i].stop_scroll(); -#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - screens[i].backdrop_show(sb_get_backdrop(i)); -#endif - viewportmanager_theme_undo(i, skin_has_sbs(i, fms_skin[i].data)); - } - } -} - - -void fms_skin_init(void) -{ - int i; - FOR_NB_SCREENS(i) - { -#ifdef HAVE_ALBUMART - fms_skin_data[i].albumart = NULL; - fms_skin_data[i].playback_aa_slot = -1; -#endif - fms_skin[i].data = &fms_skin_data[i]; - fms_skin[i].display = &screens[i]; - /* Currently no seperate wps_state needed/possible - so use the only available ( "global" ) one */ - fms_skin[i].state = &wps_state; - fms_skin[i].sync_data = &fms_skin_sync_data; - } -} - -int radio_screen(void) -{ - bool done = false; - int ret_val = GO_TO_ROOT; - int button; - int i; - bool stereo = false, last_stereo = false; - bool update_screen = true, restore = true; - bool screen_freeze = false; - bool keep_playing = false; - bool talk = false; -#ifdef FM_RECORD_DBLPRE - int lastbutton = BUTTON_NONE; - unsigned long rec_lastclick = 0; -#endif -#if CONFIG_CODEC != SWCODEC - bool have_recorded = false; - int timeout = current_tick + HZ/10; - unsigned int last_seconds = 0; -#ifndef SIMULATOR - unsigned int seconds = 0; - struct audio_recording_options rec_options; -#endif -#endif /* CONFIG_CODEC != SWCODEC */ -#ifndef HAVE_NOISY_IDLE_MODE - int button_timeout = current_tick + (2*HZ); -#endif - - /* change status to "in screen" */ - in_screen = true; - - if(num_presets <= 0) - { - radio_load_presets(global_settings.fmr_file); - } -#ifdef HAVE_ALBUMART - for(i=0;i 0) - have_recorded = true; - - audio_init_recording(talk_get_bufsize()); - - sound_settings_apply(); - /* Yes, we use the D/A for monitoring */ - peak_meter_playback(true); - - peak_meter_enable(true); - - rec_init_recording_options(&rec_options); - rec_options.rec_source = AUDIO_SRC_LINEIN; - rec_set_recording_options(&rec_options); - - audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN), - sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN); - -#endif /* CONFIG_CODEC != SWCODEC */ -#endif /* ndef SIMULATOR */ - - /* turn on radio */ -#if CONFIG_CODEC == SWCODEC - audio_set_input_source(AUDIO_SRC_FMRADIO, - (radio_status == FMRADIO_PAUSED) ? - SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING); -#else - if (radio_status == FMRADIO_OFF) - radio_start(); -#endif - - if(num_presets < 1 && yesno_pop(ID2P(LANG_FM_FIRST_AUTOSCAN))) - scan_presets(NULL); - - curr_preset = find_preset(curr_freq); - if(curr_preset != -1) - radio_mode = RADIO_PRESET_MODE; - -#ifndef HAVE_NOISY_IDLE_MODE - cpu_idle_mode(true); -#endif - - while(!done) - { - if(search_dir != 0) - { - curr_freq = step_freq(curr_freq, search_dir); - update_screen = true; - - if(tuner_set(RADIO_SCAN_FREQUENCY, curr_freq)) - { - curr_preset = find_preset(curr_freq); - remember_frequency(); - end_search(); - talk = true; - } - trigger_cpu_boost(); - } - - if (!update_screen) - { - cancel_cpu_boost(); - } - - button = skin_wait_for_action(fms_skin, CONTEXT_FM, - update_screen ? TIMEOUT_NOBLOCK : HZ); - -#ifndef HAVE_NOISY_IDLE_MODE - if (button != ACTION_NONE) - { - cpu_idle_mode(false); - button_timeout = current_tick + (2*HZ); - } -#endif - switch(button) - { - case ACTION_FM_STOP: -#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) - if(audio_status() == AUDIO_STATUS_RECORD) - { - audio_stop(); - } - else -#endif - { - done = true; - if(presets_changed) - { - if(yesno_pop(ID2P(LANG_FM_SAVE_CHANGES))) - { - if(filepreset[0] == '\0') - save_preset_list(); - else - radio_save_presets(); - } - } - } - update_screen = true; - break; - -#ifdef FM_RECORD - case ACTION_FM_RECORD: -#ifdef FM_RECORD_DBLPRE - if (lastbutton != ACTION_FM_RECORD_DBLPRE) - { - rec_lastclick = 0; - break; - } - if (current_tick - rec_lastclick > HZ/2) - { - rec_lastclick = current_tick; - break; - } -#endif /* FM_RECORD_DBLPRE */ -#ifndef SIMULATOR - if(audio_status() == AUDIO_STATUS_RECORD) - { - rec_command(RECORDING_CMD_START_NEWFILE); - update_screen = true; - } - else - { - have_recorded = true; - rec_command(RECORDING_CMD_START); - update_screen = true; - } -#endif /* SIMULATOR */ - last_seconds = 0; - break; -#endif /* #ifdef FM_RECORD */ - - case ACTION_FM_EXIT: -#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) - if(audio_status() == AUDIO_STATUS_RECORD) - audio_stop(); -#endif - keep_playing = true; - done = true; - ret_val = GO_TO_ROOT; - if(presets_changed) - { - if(yesno_pop(ID2P(LANG_FM_SAVE_CHANGES))) - { - if(filepreset[0] == '\0') - save_preset_list(); - else - radio_save_presets(); - } - } - - break; - - case ACTION_STD_PREV: - case ACTION_STD_NEXT: - next_station(button == ACTION_STD_PREV ? -1 : 1); - end_search(); - update_screen = true; - talk = true; - break; - - case ACTION_STD_PREVREPEAT: - case ACTION_STD_NEXTREPEAT: - { - int dir = search_dir; - search_dir = button == ACTION_STD_PREVREPEAT ? -1 : 1; - if (radio_mode != RADIO_SCAN_MODE) - { - next_preset(search_dir); - end_search(); - update_screen = true; - talk = true; - } - else if (dir == 0) - { - /* Starting auto scan */ - tuner_set(RADIO_MUTE, 1); - update_screen = true; - } - break; - } - - case ACTION_SETTINGS_INC: - case ACTION_SETTINGS_INCREPEAT: - global_settings.volume++; - setvol(); - update_screen = true; - break; - - case ACTION_SETTINGS_DEC: - case ACTION_SETTINGS_DECREPEAT: - global_settings.volume--; - setvol(); - update_screen = true; - break; - - case ACTION_FM_PLAY: - if (radio_status == FMRADIO_PLAYING) - radio_pause(); - else - radio_start(); - - update_screen = true; - talk = false; - talk_shutup(); - break; - - case ACTION_FM_MENU: - fms_fix_displays(FMS_EXIT); - radio_menu(); - curr_preset = find_preset(curr_freq); - update_screen = true; - restore = true; - break; - -#ifdef FM_PRESET - case ACTION_FM_PRESET: - if(num_presets < 1) - { - splash(HZ, ID2P(LANG_FM_NO_PRESETS)); - update_screen = true; - break; - } - fms_fix_displays(FMS_EXIT); - handle_radio_presets(); - update_screen = true; - restore = true; - break; -#endif /* FM_PRESET */ - -#ifdef FM_FREEZE - case ACTION_FM_FREEZE: - if(!screen_freeze) - { - splash(HZ, str(LANG_FM_FREEZE)); - screen_freeze = true; - } - else - { - update_screen = true; - screen_freeze = false; - } - break; -#endif /* FM_FREEZE */ - - case SYS_USB_CONNECTED: -#if CONFIG_CODEC != SWCODEC - /* Only accept USB connection when not recording */ - if(audio_status() != AUDIO_STATUS_RECORD) -#endif - { - default_event_handler(SYS_USB_CONNECTED); - screen_freeze = true; /* Cosmetic: makes sure the - radio screen doesn't redraw */ - done = true; - } - break; - -#ifdef FM_MODE - case ACTION_FM_MODE: - if(radio_mode == RADIO_SCAN_MODE) - { - /* Force scan mode if there are no presets. */ - if(num_presets > 0) - radio_mode = RADIO_PRESET_MODE; - } - else - radio_mode = RADIO_SCAN_MODE; - update_screen = true; - cond_talk_ids_fq(radio_mode ? - LANG_PRESET : LANG_RADIO_SCAN_MODE); - talk = true; - break; -#endif /* FM_MODE */ - -#ifdef FM_NEXT_PRESET - case ACTION_FM_NEXT_PRESET: - next_preset(1); - end_search(); - update_screen = true; - talk = true; - break; -#endif - -#ifdef FM_PREV_PRESET - case ACTION_FM_PREV_PRESET: - next_preset(-1); - end_search(); - update_screen = true; - talk = true; - break; -#endif - - default: - default_event_handler(button); -#ifdef HAVE_RDS_CAP - if (tuner_get(RADIO_EVENT)) - update_screen = true; -#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; - ret_val = GO_TO_ROOT; - if(presets_changed) - { - if(yesno_pop(ID2P(LANG_FM_SAVE_CHANGES))) - { - if(filepreset[0] == '\0') - save_preset_list(); - else - radio_save_presets(); - } - } - - /* Clear the preset list on exit. */ - clear_preset_list(); - } - break; - } /*switch(button)*/ - -#ifdef FM_RECORD_DBLPRE - if (button != ACTION_NONE) - lastbutton = button; -#endif - -#if CONFIG_CODEC != SWCODEC - peak_meter_peek(); -#endif - - if(!screen_freeze) - { - /* Only display the peak meter when not recording */ -#if CONFIG_CODEC != SWCODEC - if(TIME_AFTER(current_tick, timeout)) - { - timeout = current_tick + HZ; -#else /* SWCODEC */ - { -#endif /* CONFIG_CODEC == SWCODEC */ - - /* keep "mono" from always being displayed when paused */ - if (radio_status != FMRADIO_PAUSED) - { - stereo = tuner_get(RADIO_STEREO) && - !global_settings.fm_force_mono; - - if(stereo != last_stereo) - { - update_screen = true; - last_stereo = stereo; - } - } - } - -#if CONFIG_CODEC != SWCODEC && !defined(SIMULATOR) - seconds = audio_recorded_time() / HZ; - if (update_screen || seconds > last_seconds || restore) - { - last_seconds = seconds; -#else - if (update_screen || restore) - { -#endif - if (restore) - fms_fix_displays(FMS_ENTER); - FOR_NB_SCREENS(i) - skin_update(&fms_skin[i], WPS_REFRESH_ALL); - restore = false; - } - } - update_screen = false; - - 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; - } - if (curr_preset >= 0) - talk_preset(curr_preset, radio_mode == RADIO_PRESET_MODE, - enqueue); - } - -#if CONFIG_CODEC != SWCODEC - if(audio_status() & AUDIO_STATUS_ERROR) - { - done = true; - } -#endif - -#ifndef HAVE_NOISY_IDLE_MODE - if (TIME_AFTER(current_tick, button_timeout)) - { - cpu_idle_mode(true); - } -#endif - } /*while(!done)*/ - -#ifndef SIMULATOR -#if CONFIG_CODEC != SWCODEC - if(audio_status() & AUDIO_STATUS_ERROR) - { - splash(0, str(LANG_DISK_FULL)); - audio_error_clear(); - - while(1) - { - button = get_action(CONTEXT_FM, TIMEOUT_BLOCK); - if(button == ACTION_FM_STOP) - break; - } - } - - audio_init_playback(); -#endif /* CONFIG_CODEC != SWCODEC */ - - sound_settings_apply(); -#endif /* SIMULATOR */ - - if(keep_playing) - { -/* Catch FMRADIO_PLAYING status for the sim. */ -#ifndef SIMULATOR -#if CONFIG_CODEC != SWCODEC - /* Enable the Left and right A/D Converter */ - audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN), - sound_default(SOUND_RIGHT_GAIN), - AUDIO_GAIN_LINEIN); - mas_codec_writereg(6, 0x4000); -#endif - end_search(); -#endif /* SIMULATOR */ - } - else - { -#if CONFIG_CODEC == SWCODEC - audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); -#else - radio_stop(); -#endif - } - -#ifndef HAVE_NOISY_IDLE_MODE - cpu_idle_mode(false); -#endif - fms_fix_displays(FMS_EXIT); - in_screen = false; -#if CONFIG_CODEC != SWCODEC - return have_recorded; -#else - return false; -#endif -} /* radio_screen */ - -static void radio_save_presets(void) -{ - int fd; - int i; - - fd = creat(filepreset, 0666); - if(fd >= 0) - { - for(i = 0;i < num_presets;i++) - { - fdprintf(fd, "%d:%s\n", presets[i].frequency, presets[i].name); - } - close(fd); - - if(!strncasecmp(FMPRESET_PATH, filepreset, strlen(FMPRESET_PATH))) - set_file(filepreset, global_settings.fmr_file, MAX_FILENAME); - presets_changed = false; - } - else - { - splash(HZ, ID2P(LANG_FM_PRESET_SAVE_FAILED)); - } -} - -void radio_load_presets(char *filename) -{ - int fd; - int rc; - char buf[128]; - char *freq; - char *name; - bool done = false; - int f; - - memset(presets, 0, sizeof(presets)); - num_presets = 0; - - /* No Preset in configuration. */ - if(filename[0] == '\0') - { - filepreset[0] = '\0'; - return; - } - /* Temporary preset, loaded until player shuts down. */ - else if(filename[0] == '/') - strlcpy(filepreset, filename, sizeof(filepreset)); - /* Preset from default directory. */ - else - snprintf(filepreset, sizeof(filepreset), "%s/%s.fmr", - FMPRESET_PATH, filename); - - fd = open_utf8(filepreset, O_RDONLY); - if(fd >= 0) - { - while(!done && num_presets < MAX_PRESETS) - { - rc = read_line(fd, buf, 128); - if(rc > 0) - { - if(settings_parseline(buf, &freq, &name)) - { - f = atoi(freq); - if(f) /* For backwards compatibility */ - { - struct fmstation * const fms = &presets[num_presets]; - fms->frequency = f; - strlcpy(fms->name, name, MAX_FMPRESET_LEN+1); - num_presets++; - } - } - } - else - done = true; - } - close(fd); - } - else /* invalid file name? */ - filepreset[0] = '\0'; - - presets_loaded = num_presets > 0; - presets_changed = false; -} - - -static int radio_add_preset(void) -{ - char buf[MAX_FMPRESET_LEN + 1]; - - if(num_presets < MAX_PRESETS) - { - buf[0] = '\0'; - - if (!kbd_input(buf, MAX_FMPRESET_LEN + 1)) - { - struct fmstation * const fms = &presets[num_presets]; - strcpy(fms->name, buf); - fms->frequency = curr_freq; - num_presets++; - presets_changed = true; - presets_loaded = num_presets > 0; - return true; - } - } - else - { - splash(HZ, ID2P(LANG_FM_NO_FREE_PRESETS)); - } - return false; -} - -/* needed to know which preset we are edit/delete-ing */ -static int selected_preset = -1; -static int radio_edit_preset(void) -{ - char buf[MAX_FMPRESET_LEN + 1]; - - if (num_presets > 0) - { - struct fmstation * const fms = &presets[selected_preset]; - - strcpy(buf, fms->name); - - if (!kbd_input(buf, MAX_FMPRESET_LEN + 1)) - { - strcpy(fms->name, buf); - presets_changed = true; - } - } - - return 1; -} - -static int radio_delete_preset(void) -{ - if (num_presets > 0) - { - struct fmstation * const fms = &presets[selected_preset]; - - if (selected_preset >= --num_presets) - selected_preset = num_presets - 1; - - memmove(fms, fms + 1, (uintptr_t)(fms + num_presets) - - (uintptr_t)fms); - - if (curr_preset >= num_presets) - --curr_preset; - } - - /* Don't ask to save when all presets are deleted. */ - presets_changed = num_presets > 0; - - if (!presets_changed) - { - /* The preset list will be cleared, switch to Scan Mode. */ - radio_mode = RADIO_SCAN_MODE; - curr_preset = -1; - presets_loaded = false; - } - - return 1; -} - -static int load_preset_list(void) -{ - return !rockbox_browse(FMPRESET_PATH, SHOW_FMR); -} - -static int save_preset_list(void) -{ - if(num_presets > 0) - { - bool bad_file_name = true; - - if(!dir_exists(FMPRESET_PATH)) /* Check if there is preset folder */ - mkdir(FMPRESET_PATH); - - create_numbered_filename(filepreset, FMPRESET_PATH, "preset", - ".fmr", 2 IF_CNFN_NUM_(, NULL)); - - while(bad_file_name) - { - if(!kbd_input(filepreset, sizeof(filepreset))) - { - /* check the name: max MAX_FILENAME (20) chars */ - char* p2; - char* p1; - int len; - p1 = strrchr(filepreset, '/'); - p2 = p1; - while((p1) && (*p2) && (*p2 != '.')) - p2++; - len = (int)(p2-p1) - 1; - if((!p1) || (len > MAX_FILENAME) || (len == 0)) - { - /* no slash, too long or too short */ - splash(HZ, ID2P(LANG_INVALID_FILENAME)); - } - else - { - /* add correct extension (easier to always write) - at this point, p2 points to 0 or the extension dot */ - *p2 = '\0'; - strcat(filepreset,".fmr"); - bad_file_name = false; - radio_save_presets(); - } - } - else - { - /* user aborted */ - return false; - } - } - } - else - splash(HZ, ID2P(LANG_FM_NO_PRESETS)); - - return true; -} - -static int clear_preset_list(void) -{ - /* Clear all the preset entries */ - memset(presets, 0, sizeof (presets)); - - num_presets = 0; - presets_loaded = false; - /* The preset list will be cleared switch to Scan Mode. */ - radio_mode = RADIO_SCAN_MODE; - curr_preset = -1; - presets_changed = false; /* Don't ask to save when clearing the list. */ - - return true; -} - -MENUITEM_FUNCTION(radio_edit_preset_item, MENU_FUNC_CHECK_RETVAL, - ID2P(LANG_FM_EDIT_PRESET), - radio_edit_preset, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(radio_delete_preset_item, MENU_FUNC_CHECK_RETVAL, - ID2P(LANG_FM_DELETE_PRESET), - radio_delete_preset, NULL, NULL, Icon_NOICON); -static int radio_preset_callback(int action, - const struct menu_item_ex *this_item) -{ - if (action == ACTION_STD_OK) - action = ACTION_EXIT_AFTER_THIS_MENUITEM; - return action; - (void)this_item; -} -MAKE_MENU(handle_radio_preset_menu, ID2P(LANG_PRESET), - radio_preset_callback, Icon_NOICON, &radio_edit_preset_item, - &radio_delete_preset_item); -/* present a list of preset stations */ -static const char* presets_get_name(int selected_item, void *data, - char *buffer, size_t buffer_len) -{ - (void)data; - struct fmstation *p = &presets[selected_item]; - if(p->name[0]) - return p->name; - int freq = p->frequency / 10000; - int frac = freq % 100; - freq /= 100; - snprintf(buffer, buffer_len, - str(LANG_FM_DEFAULT_PRESET_NAME), freq, frac); - return buffer; -} - -static int presets_speak_name(int selected_item, void * data) -{ - (void)data; - talk_preset(selected_item, true, false); - return 0; -} - -static int handle_radio_presets(void) -{ - struct gui_synclist lists; - int result = 0; - int action = ACTION_NONE; -#ifdef HAVE_BUTTONBAR - struct gui_buttonbar buttonbar; -#endif - - if(presets_loaded == false) - return result; - -#ifdef HAVE_BUTTONBAR - gui_buttonbar_init(&buttonbar); - gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); - gui_buttonbar_set(&buttonbar, str(LANG_FM_BUTTONBAR_ADD), - str(LANG_FM_BUTTONBAR_EXIT), - str(LANG_FM_BUTTONBAR_ACTION)); - gui_buttonbar_draw(&buttonbar); -#endif - gui_synclist_init(&lists, presets_get_name, NULL, false, 1, NULL); - gui_synclist_set_title(&lists, str(LANG_PRESET), NOICON); - gui_synclist_set_icon_callback(&lists, NULL); - if(global_settings.talk_file) - gui_synclist_set_voice_callback(&lists, presets_speak_name); - gui_synclist_set_nb_items(&lists, num_presets); - gui_synclist_select_item(&lists, curr_preset<0 ? 0 : curr_preset); - gui_synclist_speak_item(&lists); - - while (result == 0) - { - gui_synclist_draw(&lists); - list_do_action(CONTEXT_STD, TIMEOUT_BLOCK, - &lists, &action, LIST_WRAP_UNLESS_HELD); - switch (action) - { - case ACTION_STD_MENU: - if (radio_add_preset()) - { - gui_synclist_set_nb_items(&lists, num_presets); - gui_synclist_select_item(&lists, num_presets - 1); - } - break; - case ACTION_STD_CANCEL: - result = 1; - break; - case ACTION_STD_OK: - curr_preset = gui_synclist_get_sel_pos(&lists); - curr_freq = presets[curr_preset].frequency; - next_station(0); - remember_frequency(); - result = 1; - break; - case ACTION_F3: - case ACTION_STD_CONTEXT: - selected_preset = gui_synclist_get_sel_pos(&lists); - do_menu(&handle_radio_preset_menu, NULL, NULL, false); - gui_synclist_set_nb_items(&lists, num_presets); - gui_synclist_select_item(&lists, selected_preset); - gui_synclist_speak_item(&lists); - break; - default: - if(default_event_handler(action) == SYS_USB_CONNECTED) - result = 2; - } - } - return result - 1; -} - -void toggle_mono_mode(bool mono) -{ - tuner_set(RADIO_FORCE_MONO, mono); -} - -void set_radio_region(int region) -{ -#ifdef HAVE_RADIO_REGION - tuner_set(RADIO_REGION, region); -#endif - next_station(0); - remember_frequency(); - (void)region; -} - -MENUITEM_SETTING(set_region, &global_settings.fm_region, NULL); -MENUITEM_SETTING(force_mono, &global_settings.fm_force_mono, NULL); - -#ifndef FM_MODE -static char* get_mode_text(int selected_item, void * data, char *buffer) -{ - (void)selected_item; - (void)data; - snprintf(buffer, MAX_PATH, "%s %s", str(LANG_MODE), - radio_mode ? str(LANG_PRESET) : - str(LANG_RADIO_SCAN_MODE)); - return buffer; -} -static int toggle_radio_mode(void) -{ - radio_mode = (radio_mode == RADIO_SCAN_MODE) ? - RADIO_PRESET_MODE : RADIO_SCAN_MODE; - return 0; -} -MENUITEM_FUNCTION_DYNTEXT(radio_mode_item, 0, - toggle_radio_mode, NULL, - get_mode_text, NULL, NULL, NULL, Icon_NOICON); -#endif - -static int scan_presets(void *viewports) -{ - bool do_scan = true; - int i; - struct viewport *vp = (struct viewport *)viewports; - - FOR_NB_SCREENS(i) - screens[i].set_viewport(vp?&vp[i]:NULL); - if(num_presets > 0) /* Do that to avoid 2 questions. */ - do_scan = yesno_pop(ID2P(LANG_FM_CLEAR_PRESETS)); - - if(do_scan) - { - const struct fm_region_data * const fmr = - &fm_region_data[global_settings.fm_region]; - - curr_freq = fmr->freq_min; - num_presets = 0; - memset(presets, 0, sizeof(presets)); - - tuner_set(RADIO_MUTE, 1); - - while(curr_freq <= fmr->freq_max) - { - int freq, frac; - if(num_presets >= MAX_PRESETS || action_userabort(TIMEOUT_NOBLOCK)) - break; - - freq = curr_freq / 10000; - frac = freq % 100; - freq /= 100; - - splashf(0, str(LANG_FM_SCANNING), freq, frac); - - if(tuner_set(RADIO_SCAN_FREQUENCY, curr_freq)) - { - /* add preset */ - presets[num_presets].name[0] = '\0'; - presets[num_presets].frequency = curr_freq; - num_presets++; - } - - curr_freq += fmr->freq_step; - } - - if (radio_status == FMRADIO_PLAYING) - tuner_set(RADIO_MUTE, 0); - - presets_changed = true; - - FOR_NB_SCREENS(i) - { - screens[i].clear_viewport(); - screens[i].update_viewport(); - } - - if(num_presets > 0) - { - curr_freq = presets[0].frequency; - radio_mode = RADIO_PRESET_MODE; - presets_loaded = true; - next_station(0); - } - else - { - /* Wrap it to beginning or we'll be past end of band */ - presets_loaded = false; - next_station(1); - } - } - return true; -} - - -#ifdef HAVE_RECORDING - -#if defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC -#define FM_RECORDING_SCREEN -static int fm_recording_screen(void) -{ - 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; -} - -#endif /* defined(HAVE_FMRADIO_REC) && CONFIG_CODEC == SWCODEC */ - -#if defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC -#define FM_RECORDING_SETTINGS -static int fm_recording_settings(void) -{ - bool ret = recording_menu(true); - -#if CONFIG_CODEC != SWCODEC - if (!ret) - { - 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); - } -#endif - - return ret; -} - -#endif /* defined(HAVE_FMRADIO_REC) || CONFIG_CODEC != SWCODEC */ -#endif /* HAVE_RECORDING */ - -#ifdef FM_RECORDING_SCREEN -MENUITEM_FUNCTION(recscreen_item, 0, ID2P(LANG_RECORDING), - fm_recording_screen, NULL, NULL, Icon_Recording); -#endif -#ifdef FM_RECORDING_SETTINGS -MENUITEM_FUNCTION(recsettings_item, 0, ID2P(LANG_RECORDING_SETTINGS), - fm_recording_settings, NULL, NULL, Icon_Recording); -#endif -#ifndef FM_PRESET -MENUITEM_FUNCTION(radio_presets_item, 0, ID2P(LANG_PRESET), - handle_radio_presets, NULL, NULL, Icon_NOICON); -#endif -#ifndef FM_PRESET_ADD -MENUITEM_FUNCTION(radio_addpreset_item, 0, ID2P(LANG_FM_ADD_PRESET), - radio_add_preset, NULL, NULL, Icon_NOICON); -#endif - - -MENUITEM_FUNCTION(presetload_item, 0, ID2P(LANG_FM_PRESET_LOAD), - load_preset_list, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(presetsave_item, 0, ID2P(LANG_FM_PRESET_SAVE), - save_preset_list, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(presetclear_item, 0, ID2P(LANG_FM_PRESET_CLEAR), - clear_preset_list, NULL, NULL, Icon_NOICON); -MENUITEM_FUNCTION(scan_presets_item, MENU_FUNC_USEPARAM, - ID2P(LANG_FM_SCAN_PRESETS), - scan_presets, NULL, NULL, Icon_NOICON); - -MAKE_MENU(radio_settings_menu, ID2P(LANG_FM_MENU), NULL, - Icon_Radio_screen, -#ifndef FM_PRESET - &radio_presets_item, -#endif -#ifndef FM_PRESET_ADD - &radio_addpreset_item, -#endif - &presetload_item, &presetsave_item, &presetclear_item, - &force_mono, -#ifndef FM_MODE - &radio_mode_item, -#endif - &set_region, &sound_settings, -#ifdef FM_RECORDING_SCREEN - &recscreen_item, -#endif -#ifdef FM_RECORDING_SETTINGS - &recsettings_item, -#endif - &scan_presets_item); -/* main menu of the radio screen */ -static bool radio_menu(void) -{ - return do_menu(&radio_settings_menu, NULL, NULL, false) == - MENU_ATTACHED_USB; -} - -#endif diff --git a/apps/recorder/radio.h b/apps/recorder/radio.h deleted file mode 100644 index db23ee5e84..0000000000 --- a/apps/recorder/radio.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2003 Linus Nielsen Feltzing - * - * 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. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef RADIO_H -#define RADIO_H - -#ifndef FMRADIO_H -#include "fmradio.h" -#endif -#include "screen_access.h" -#include "bmp.h" - -#if CONFIG_TUNER -void radio_load_presets(char *filename); -void radio_init(void) INIT_ATTR; -int radio_screen(void); -void radio_start(void); -void radio_pause(void); -void radio_stop(void); -bool radio_hardware_present(void); -bool in_radio_screen(void); - -bool radio_scan_mode(void); /* true for scan mode, false for preset mode */ -bool radio_is_stereo(void); -int radio_current_frequency(void); -int radio_current_preset(void); -int radio_preset_count(void); -const struct fmstation *radio_get_preset(int preset); - -/* skin functions */ -void fms_data_load(enum screen_type screen, const char *buf, bool isfile); -void fms_skin_init(void); - -/* callbacks for the radio settings */ -void set_radio_region(int region); -void toggle_mono_mode(bool mono); - -#define MAX_FMPRESET_LEN 27 - -struct fmstation -{ - int frequency; /* In Hz */ - char name[MAX_FMPRESET_LEN+1]; -}; - -#ifdef HAVE_ALBUMART -int radio_get_art_hid(struct dim *requested_dim); -#endif - -#endif /* CONFIG_TUNER */ - -#endif /* RADIO_H */ diff --git a/tools/configure b/tools/configure index bf49be8a9e..ef4d73ad29 100755 --- a/tools/configure +++ b/tools/configure @@ -1030,7 +1030,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 0" output="ajbrec.ajz" - appextra="recorder:gui" + appextra="recorder:gui:radio" #archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" @@ -1052,7 +1052,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 0" output="ajbrec.ajz" - appextra="recorder:gui" + appextra="recorder:gui:radio" #archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" @@ -1074,7 +1074,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 0" output="ajbrec.ajz" - appextra="recorder:gui" + appextra="recorder:gui:radio" #archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" @@ -1096,7 +1096,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 0" output="ajbrec.ajz" - appextra="recorder:gui" + appextra="recorder:gui:radio" #archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" @@ -1118,7 +1118,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 0" output="ajbrec.ajz" - appextra="recorder:gui" + appextra="recorder:gui:radio" #archosrom="$pwd/rombox.ucl" flash="$pwd/rockbox.ucl" plugins="yes" @@ -1139,7 +1139,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 6" output="cjbm.ajz" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="" # toolset is the tools within the tools directory that we build for @@ -1164,7 +1164,7 @@ fi bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" output="rockbox.iriver" bootoutput="bootloader.iriver" - appextra="recorder:gui" + appextra="recorder:gui:radio" flash="$pwd/rombox.iriver" plugins="yes" swcodec="yes" @@ -1188,7 +1188,7 @@ fi bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" output="rockbox.iriver" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for @@ -1212,7 +1212,7 @@ fi bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" output="rockbox.iriver" bootoutput="bootloader.iriver" - appextra="recorder:gui" + appextra="recorder:gui:radio" flash="$pwd/rombox.iriver" plugins="yes" swcodec="yes" @@ -1234,7 +1234,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 0" output="rockbox.wma" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for @@ -1255,7 +1255,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 5" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=h10 -type=RBBL" @@ -1279,7 +1279,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 5" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2 -model=h105 -type=RBBL" @@ -1303,7 +1303,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 5" output="rockbox.ipod" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" @@ -1326,7 +1326,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 5" output="rockbox.ipod" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" @@ -1348,7 +1348,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.ipod" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" @@ -1371,7 +1371,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 6" output="rockbox.ipod" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" @@ -1394,7 +1394,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 6" output="rockbox.ipod" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" @@ -1417,7 +1417,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 6" output="rockbox.ipod" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" @@ -1440,7 +1440,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 6" output="rockbox.ipod" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" @@ -1463,7 +1463,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 6" output="rockbox.ipod" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" @@ -1486,7 +1486,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.ipod" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" bootoutput="bootloader-$modelname.ipod" @@ -1511,7 +1511,7 @@ fi bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7" output="rockbox.iaudio" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for @@ -1535,7 +1535,7 @@ fi bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 7" output="rockbox.iaudio" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for @@ -1558,7 +1558,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.iaudio" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" bootoutput="I7_FW.BIN" @@ -1583,7 +1583,7 @@ fi bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.d2" bootoutput="bootloader-cowond2.bin" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset="$tccbitmaptools" @@ -1603,7 +1603,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 7" output="rockbox.iaudio" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for @@ -1625,7 +1625,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.gigabeat" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$gigabeatbitmaptools @@ -1647,7 +1647,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.gigabeat" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset="$gigabeatbitmaptools" @@ -1671,7 +1671,7 @@ fi bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" output="rockbox.mrobe500" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$gigabeatbitmaptools @@ -1695,7 +1695,7 @@ fi bmp2rb_remotemono="$rootdir/tools/bmp2rb -f 0" bmp2rb_remotenative="$rootdir/tools/bmp2rb -f 0" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2 -model=m100 -type=RBBL" @@ -1721,7 +1721,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 0" output="rockbox.logik" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="" swcodec="yes" # toolset is the tools within the tools directory that we build for @@ -1744,7 +1744,7 @@ fi tool="$rootdir/tools/scramble -creative=zvm" USE_ELF="yes" output="rockbox.zvm" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$ipodbitmaptools @@ -1767,7 +1767,7 @@ fi tool="$rootdir/tools/scramble -creative=zvm60 -no-ciff" USE_ELF="yes" output="rockbox.zvm60" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$ipodbitmaptools @@ -1790,7 +1790,7 @@ fi tool="$rootdir/tools/scramble -creative=zenvision -no-ciff" USE_ELF="yes" output="rockbox.zv" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="" swcodec="yes" toolset=$ipodbitmaptools @@ -1812,7 +1812,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=e200 -type=RBBL" @@ -1839,7 +1839,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4r -model=e20r -type=RBBL" @@ -1863,7 +1863,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=c200 -type=RBBL" @@ -1889,7 +1889,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 0" output="rockbox.m200" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="" swcodec="yes" # toolset is the tools within the tools directory that we build for @@ -1913,7 +1913,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.c100" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="" swcodec="yes" # toolset is the tools within the tools directory that we build for @@ -1935,7 +1935,7 @@ fi tool="$rootdir/tools/scramble -add=clip" output="rockbox.sansa" bootoutput="bootloader-clip.sansa" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$scramblebitmaptools @@ -1956,7 +1956,7 @@ fi tool="$rootdir/tools/scramble -add=e2v2" output="rockbox.sansa" bootoutput="bootloader-e200v2.sansa" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$scramblebitmaptools @@ -1977,7 +1977,7 @@ fi tool="$rootdir/tools/scramble -add=m2v4" output="rockbox.sansa" bootoutput="bootloader-m200v4.sansa" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$scramblebitmaptools @@ -1998,7 +1998,7 @@ fi tool="$rootdir/tools/scramble -add=fuze" output="rockbox.sansa" bootoutput="bootloader-fuze.sansa" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$scramblebitmaptools @@ -2019,7 +2019,7 @@ fi tool="$rootdir/tools/scramble -add=c2v2" output="rockbox.sansa" bootoutput="bootloader-c200v2.sansa" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for @@ -2042,7 +2042,7 @@ fi tool="$rootdir/tools/scramble -add=clv2" output="rockbox.sansa" bootoutput="bootloader-clipv2.sansa" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$scramblebitmaptools @@ -2086,7 +2086,7 @@ fi tool="$rootdir/tools/scramble -add=cli+" output="rockbox.sansa" bootoutput="bootloader-clipplus.sansa" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$scramblebitmaptools @@ -2106,7 +2106,7 @@ fi tool="$rootdir/tools/scramble -add=fuz2" output="rockbox.sansa" bootoutput="bootloader-fuzev2.sansa" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$scramblebitmaptools @@ -2126,7 +2126,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 5" output="rockbox.elio" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2" @@ -2150,7 +2150,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=9200 -type=RBBL" @@ -2174,7 +2174,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=1630 -type=RBBL" @@ -2198,7 +2198,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=6330 -type=RBBL" @@ -2222,7 +2222,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.meizu" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="no" #FIXME swcodec="yes" toolset=$genericbitmaptools @@ -2244,7 +2244,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.meizu" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="no" #FIXME swcodec="yes" toolset=$genericbitmaptools @@ -2266,7 +2266,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.meizu" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="no" #FIXME swcodec="yes" toolset=$genericbitmaptools @@ -2288,7 +2288,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.vx747" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$genericbitmaptools @@ -2310,7 +2310,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.vx767" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="" #FIXME swcodec="yes" toolset=$genericbitmaptools @@ -2332,7 +2332,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.vx747p" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$genericbitmaptools @@ -2354,7 +2354,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.vx777" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" toolset=$genericbitmaptools @@ -2376,7 +2376,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.lyre" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="" swcodec="yes" toolset=$scramblebitmaptools @@ -2398,7 +2398,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.mini2440" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="" swcodec="yes" toolset=$scramblebitmaptools @@ -2420,7 +2420,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2 -model=y820 -type=RBBL" @@ -2444,7 +2444,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 2" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2 -model=y920 -type=RBBL" @@ -2468,7 +2468,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v2 -model=y925 -type=RBBL" @@ -2492,7 +2492,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" output="rockbox.yps3" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="no" #FIXME swcodec="yes" toolset=$genericbitmaptools @@ -2514,7 +2514,7 @@ fi bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 5" output="rockbox.mi4" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" boottool="$rootdir/tools/scramble -mi4v3 -model=v500 -type=RBBL" @@ -2539,7 +2539,7 @@ fi bmp2rb_native="$rootdir/tools/bmp2rb -f 7" output="rockbox.mpio" bootoutput="bootloader.mpio" - appextra="recorder:gui" + appextra="recorder:gui:radio" plugins="yes" swcodec="yes" # toolset is the tools within the tools directory that we build for -- cgit v1.2.3