diff options
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/radio.c | 51 | ||||
-rw-r--r-- | apps/recorder/radio.h | 1 | ||||
-rw-r--r-- | apps/recorder/recording.c | 11 | ||||
-rw-r--r-- | apps/recorder/recording.h | 1 |
4 files changed, 25 insertions, 39 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index dc533cf017..97d6266a02 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -114,9 +114,6 @@ static int curr_preset = -1; | |||
114 | static int curr_freq; | 114 | static int curr_freq; |
115 | static int radio_mode = RADIO_SCAN_MODE; | 115 | static int radio_mode = RADIO_SCAN_MODE; |
116 | 116 | ||
117 | static int radio_status = FMRADIO_OFF; | ||
118 | static bool in_screen = false; | ||
119 | |||
120 | #define MAX_PRESETS 64 | 117 | #define MAX_PRESETS 64 |
121 | static bool presets_loaded = false, presets_changed = false; | 118 | static bool presets_loaded = false, presets_changed = false; |
122 | static struct fmstation presets[MAX_PRESETS]; | 119 | static struct fmstation presets[MAX_PRESETS]; |
@@ -185,14 +182,11 @@ void radio_init(void) | |||
185 | radio_stop(); | 182 | radio_stop(); |
186 | } | 183 | } |
187 | 184 | ||
185 | /* For powermgmt.c to check status for shutdown since it can't access | ||
186 | the global_status structure directly. */ | ||
188 | int get_radio_status(void) | 187 | int get_radio_status(void) |
189 | { | 188 | { |
190 | return radio_status; | 189 | return global_status.radio_status; |
191 | } | ||
192 | |||
193 | bool in_radio_screen(void) | ||
194 | { | ||
195 | return in_screen; | ||
196 | } | 190 | } |
197 | 191 | ||
198 | /* secret flag for starting paused - prevents unmute */ | 192 | /* secret flag for starting paused - prevents unmute */ |
@@ -202,14 +196,14 @@ void radio_start(void) | |||
202 | bool start_paused; | 196 | bool start_paused; |
203 | int mute_timeout; | 197 | int mute_timeout; |
204 | 198 | ||
205 | if(radio_status == FMRADIO_PLAYING) | 199 | if(global_status.radio_status == FMRADIO_PLAYING) |
206 | return; | 200 | return; |
207 | 201 | ||
208 | start_paused = radio_status & FMRADIO_START_PAUSED; | 202 | start_paused = global_status.radio_status & FMRADIO_START_PAUSED; |
209 | /* clear flag before any yielding */ | 203 | /* clear flag before any yielding */ |
210 | radio_status &= ~FMRADIO_START_PAUSED; | 204 | global_status.radio_status &= ~FMRADIO_START_PAUSED; |
211 | 205 | ||
212 | if(radio_status == FMRADIO_OFF) | 206 | if(global_status.radio_status == FMRADIO_OFF) |
213 | radio_power(true); | 207 | radio_power(true); |
214 | 208 | ||
215 | curr_freq = global_status.last_frequency | 209 | curr_freq = global_status.last_frequency |
@@ -219,7 +213,7 @@ void radio_start(void) | |||
219 | radio_set(RADIO_SLEEP, 0); /* wake up the tuner */ | 213 | radio_set(RADIO_SLEEP, 0); /* wake up the tuner */ |
220 | radio_set(RADIO_FREQUENCY, curr_freq); | 214 | radio_set(RADIO_FREQUENCY, curr_freq); |
221 | 215 | ||
222 | if(radio_status == FMRADIO_OFF) | 216 | if(global_status.radio_status == FMRADIO_OFF) |
223 | { | 217 | { |
224 | radio_set(RADIO_IF_MEASUREMENT, 0); | 218 | radio_set(RADIO_IF_MEASUREMENT, 0); |
225 | radio_set(RADIO_SENSITIVITY, 0); | 219 | radio_set(RADIO_SENSITIVITY, 0); |
@@ -248,34 +242,34 @@ void radio_start(void) | |||
248 | if(!start_paused) | 242 | if(!start_paused) |
249 | radio_set(RADIO_MUTE, 0); | 243 | radio_set(RADIO_MUTE, 0); |
250 | 244 | ||
251 | radio_status = FMRADIO_PLAYING; | 245 | global_status.radio_status = FMRADIO_PLAYING; |
252 | } /* radio_start */ | 246 | } /* radio_start */ |
253 | 247 | ||
254 | void radio_pause(void) | 248 | void radio_pause(void) |
255 | { | 249 | { |
256 | if(radio_status == FMRADIO_PAUSED) | 250 | if(global_status.radio_status == FMRADIO_PAUSED) |
257 | return; | 251 | return; |
258 | 252 | ||
259 | if(radio_status == FMRADIO_OFF) | 253 | if(global_status.radio_status == FMRADIO_OFF) |
260 | { | 254 | { |
261 | radio_status |= FMRADIO_START_PAUSED; | 255 | global_status.radio_status |= FMRADIO_START_PAUSED; |
262 | radio_start(); | 256 | radio_start(); |
263 | } | 257 | } |
264 | 258 | ||
265 | radio_set(RADIO_MUTE, 1); | 259 | radio_set(RADIO_MUTE, 1); |
266 | radio_set(RADIO_SLEEP, 1); | 260 | radio_set(RADIO_SLEEP, 1); |
267 | 261 | ||
268 | radio_status = FMRADIO_PAUSED; | 262 | global_status.radio_status = FMRADIO_PAUSED; |
269 | } /* radio_pause */ | 263 | } /* radio_pause */ |
270 | 264 | ||
271 | void radio_stop(void) | 265 | void radio_stop(void) |
272 | { | 266 | { |
273 | if(radio_status == FMRADIO_OFF) | 267 | if(global_status.radio_status == FMRADIO_OFF) |
274 | return; | 268 | return; |
275 | 269 | ||
276 | radio_set(RADIO_MUTE, 1); | 270 | radio_set(RADIO_MUTE, 1); |
277 | radio_set(RADIO_SLEEP, 1); /* low power mode, if available */ | 271 | radio_set(RADIO_SLEEP, 1); /* low power mode, if available */ |
278 | radio_status = FMRADIO_OFF; | 272 | global_status.radio_status = FMRADIO_OFF; |
279 | radio_power(false); /* status update, power off if avail. */ | 273 | radio_power(false); /* status update, power off if avail. */ |
280 | } /* radio_stop */ | 274 | } /* radio_stop */ |
281 | 275 | ||
@@ -397,7 +391,7 @@ bool radio_screen(void) | |||
397 | gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); | 391 | gui_buttonbar_set_display(&buttonbar, &(screens[SCREEN_MAIN]) ); |
398 | #endif | 392 | #endif |
399 | /* change status to "in screen" */ | 393 | /* change status to "in screen" */ |
400 | in_screen = true; | 394 | global_status.in_radio_screen = true; |
401 | 395 | ||
402 | /* always display status bar in radio screen for now */ | 396 | /* always display status bar in radio screen for now */ |
403 | global_settings.statusbar = true; | 397 | global_settings.statusbar = true; |
@@ -422,7 +416,7 @@ bool radio_screen(void) | |||
422 | } | 416 | } |
423 | 417 | ||
424 | #ifndef SIMULATOR | 418 | #ifndef SIMULATOR |
425 | if(radio_status == FMRADIO_OFF) | 419 | if(global_status.radio_status == FMRADIO_OFF) |
426 | audio_stop(); | 420 | audio_stop(); |
427 | 421 | ||
428 | #if CONFIG_CODEC != SWCODEC | 422 | #if CONFIG_CODEC != SWCODEC |
@@ -449,10 +443,11 @@ bool radio_screen(void) | |||
449 | 443 | ||
450 | /* turn on radio */ | 444 | /* turn on radio */ |
451 | #if CONFIG_CODEC == SWCODEC | 445 | #if CONFIG_CODEC == SWCODEC |
452 | rec_set_source(AUDIO_SRC_FMRADIO, (radio_status == FMRADIO_PAUSED) ? | 446 | rec_set_source(AUDIO_SRC_FMRADIO, |
447 | (global_status.radio_status == FMRADIO_PAUSED) ? | ||
453 | SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING); | 448 | SRCF_FMRADIO_PAUSED : SRCF_FMRADIO_PLAYING); |
454 | #else | 449 | #else |
455 | if (radio_status == FMRADIO_OFF) | 450 | if (global_status.radio_status == FMRADIO_OFF) |
456 | radio_start(); | 451 | radio_start(); |
457 | #endif | 452 | #endif |
458 | 453 | ||
@@ -676,7 +671,7 @@ bool radio_screen(void) | |||
676 | break; | 671 | break; |
677 | 672 | ||
678 | case ACTION_FM_PLAY: | 673 | case ACTION_FM_PLAY: |
679 | if (radio_status == FMRADIO_PLAYING) | 674 | if (global_status.radio_status == FMRADIO_PLAYING) |
680 | radio_pause(); | 675 | radio_pause(); |
681 | else | 676 | else |
682 | radio_start(); | 677 | radio_start(); |
@@ -819,7 +814,7 @@ bool radio_screen(void) | |||
819 | timeout = current_tick + HZ; | 814 | timeout = current_tick + HZ; |
820 | 815 | ||
821 | /* keep "mono" from always being displayed when paused */ | 816 | /* keep "mono" from always being displayed when paused */ |
822 | if (radio_status != FMRADIO_PAUSED) | 817 | if (global_status.radio_status != FMRADIO_PAUSED) |
823 | { | 818 | { |
824 | stereo = radio_get(RADIO_STEREO) && | 819 | stereo = radio_get(RADIO_STEREO) && |
825 | !global_settings.fm_force_mono; | 820 | !global_settings.fm_force_mono; |
@@ -962,7 +957,7 @@ bool radio_screen(void) | |||
962 | /* restore status bar settings */ | 957 | /* restore status bar settings */ |
963 | global_settings.statusbar = statusbar; | 958 | global_settings.statusbar = statusbar; |
964 | 959 | ||
965 | in_screen = false; | 960 | global_status.in_radio_screen = false; |
966 | 961 | ||
967 | return have_recorded; | 962 | return have_recorded; |
968 | } /* radio_screen */ | 963 | } /* radio_screen */ |
diff --git a/apps/recorder/radio.h b/apps/recorder/radio.h index a4f9f1a978..0bfda3bccf 100644 --- a/apps/recorder/radio.h +++ b/apps/recorder/radio.h | |||
@@ -31,7 +31,6 @@ void radio_start(void); | |||
31 | void radio_pause(void); | 31 | void radio_pause(void); |
32 | void radio_stop(void); | 32 | void radio_stop(void); |
33 | bool radio_hardware_present(void); | 33 | bool radio_hardware_present(void); |
34 | bool in_radio_screen(void); | ||
35 | 34 | ||
36 | #define MAX_FMPRESET_LEN 27 | 35 | #define MAX_FMPRESET_LEN 27 |
37 | 36 | ||
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index cb934877a9..a0a929f3a6 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -70,13 +70,6 @@ | |||
70 | #include "radio.h" | 70 | #include "radio.h" |
71 | #ifdef HAVE_RECORDING | 71 | #ifdef HAVE_RECORDING |
72 | 72 | ||
73 | static bool in_screen = false; | ||
74 | |||
75 | bool in_recording_screen(void) | ||
76 | { | ||
77 | return in_screen; | ||
78 | } | ||
79 | |||
80 | #define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1) | 73 | #define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1) |
81 | 74 | ||
82 | #if CONFIG_KEYPAD == RECORDER_PAD | 75 | #if CONFIG_KEYPAD == RECORDER_PAD |
@@ -801,7 +794,7 @@ bool recording_screen(bool no_source) | |||
801 | 794 | ||
802 | struct audio_recording_options rec_options; | 795 | struct audio_recording_options rec_options; |
803 | 796 | ||
804 | in_screen = true; | 797 | global_status.in_recording_screen = true; |
805 | cursor = 0; | 798 | cursor = 0; |
806 | #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) | 799 | #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) |
807 | ata_set_led_enabled(false); | 800 | ata_set_led_enabled(false); |
@@ -1771,7 +1764,7 @@ bool recording_screen(bool no_source) | |||
1771 | peak_meter_trigger(false); | 1764 | peak_meter_trigger(false); |
1772 | peak_meter_set_trigger_listener(NULL); | 1765 | peak_meter_set_trigger_listener(NULL); |
1773 | 1766 | ||
1774 | in_screen = false; | 1767 | global_status.in_recording_screen = false; |
1775 | sound_settings_apply(); | 1768 | sound_settings_apply(); |
1776 | 1769 | ||
1777 | FOR_NB_SCREENS(i) | 1770 | FOR_NB_SCREENS(i) |
diff --git a/apps/recorder/recording.h b/apps/recorder/recording.h index 1b313ecab5..a67337b9b6 100644 --- a/apps/recorder/recording.h +++ b/apps/recorder/recording.h | |||
@@ -19,7 +19,6 @@ | |||
19 | #ifndef RECORDING_H | 19 | #ifndef RECORDING_H |
20 | #define RECORDING_H | 20 | #define RECORDING_H |
21 | 21 | ||
22 | bool in_recording_screen(void); | ||
23 | bool recording_screen(bool no_source); | 22 | bool recording_screen(bool no_source); |
24 | char *rec_create_filename(char *buf); | 23 | char *rec_create_filename(char *buf); |
25 | int rec_create_directory(void); | 24 | int rec_create_directory(void); |