summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorMartin Scarratt <mmmm@rockbox.org>2006-09-02 17:30:30 +0000
committerMartin Scarratt <mmmm@rockbox.org>2006-09-02 17:30:30 +0000
commit617b67e769661d4841b4fd1ace358b932f9c0378 (patch)
tree22a1b0dddc51ac890b2804ce100df30d10f271ea /apps/gui
parentee88a3bb2c137078c4e1d3285e1d7c5b5ff61572 (diff)
downloadrockbox-617b67e769661d4841b4fd1ace358b932f9c0378.tar.gz
rockbox-617b67e769661d4841b4fd1ace358b932f9c0378.zip
Display bitrate (Q value for Archos), samplerate, channels and recording format (M = MP3) in the statusbar in the recording screen. This is all new info for archos targets and I-river targets now have this info on the remote as well as the main screen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10856 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/statusbar.c189
-rw-r--r--apps/gui/statusbar.h4
2 files changed, 175 insertions, 18 deletions
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index cbd1709bbc..72e681faaf 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -36,7 +36,9 @@
36#include "status.h" /* needed for battery_state global var */ 36#include "status.h" /* needed for battery_state global var */
37#include "action.h" /* for keys_locked */ 37#include "action.h" /* for keys_locked */
38#include "statusbar.h" 38#include "statusbar.h"
39 39#ifdef HAVE_RECORDING
40#include "audio.h"
41#endif
40 42
41/* FIXME: should be removed from icon.h to avoid redefinition, 43/* FIXME: should be removed from icon.h to avoid redefinition,
42 but still needed for compatibility with old system */ 44 but still needed for compatibility with old system */
@@ -52,6 +54,11 @@
52 STATUSBAR_PLUG_WIDTH + \ 54 STATUSBAR_PLUG_WIDTH + \
53 2*ICONS_SPACING 55 2*ICONS_SPACING
54#define STATUSBAR_VOLUME_WIDTH 16 56#define STATUSBAR_VOLUME_WIDTH 16
57#define STATUSBAR_ENCODER_X_POS STATUSBAR_X_POS + \
58 STATUSBAR_BATTERY_WIDTH + \
59 STATUSBAR_PLUG_WIDTH + \
60 2*ICONS_SPACING - 1
61#define STATUSBAR_ENCODER_WIDTH 18
55#define STATUSBAR_PLAY_STATE_X_POS STATUSBAR_X_POS + \ 62#define STATUSBAR_PLAY_STATE_X_POS STATUSBAR_X_POS + \
56 STATUSBAR_BATTERY_WIDTH + \ 63 STATUSBAR_BATTERY_WIDTH + \
57 STATUSBAR_PLUG_WIDTH + \ 64 STATUSBAR_PLUG_WIDTH + \
@@ -65,6 +72,21 @@
65 STATUSBAR_PLAY_STATE_WIDTH + \ 72 STATUSBAR_PLAY_STATE_WIDTH + \
66 4*ICONS_SPACING 73 4*ICONS_SPACING
67#define STATUSBAR_PLAY_MODE_WIDTH 7 74#define STATUSBAR_PLAY_MODE_WIDTH 7
75#define STATUSBAR_RECFREQ_X_POS STATUSBAR_X_POS + \
76 STATUSBAR_BATTERY_WIDTH + \
77 STATUSBAR_PLUG_WIDTH + \
78 STATUSBAR_VOLUME_WIDTH + \
79 STATUSBAR_PLAY_STATE_WIDTH + \
80 3*ICONS_SPACING
81#define STATUSBAR_RECFREQ_WIDTH 12
82#define STATUSBAR_RECCHANNELS_X_POS STATUSBAR_X_POS + \
83 STATUSBAR_BATTERY_WIDTH + \
84 STATUSBAR_PLUG_WIDTH + \
85 STATUSBAR_VOLUME_WIDTH + \
86 STATUSBAR_PLAY_STATE_WIDTH + \
87 STATUSBAR_RECFREQ_WIDTH + \
88 4*ICONS_SPACING
89#define STATUSBAR_RECCHANNELS_WIDTH 5
68#define STATUSBAR_SHUFFLE_X_POS STATUSBAR_X_POS + \ 90#define STATUSBAR_SHUFFLE_X_POS STATUSBAR_X_POS + \
69 STATUSBAR_BATTERY_WIDTH + \ 91 STATUSBAR_BATTERY_WIDTH + \
70 STATUSBAR_PLUG_WIDTH + \ 92 STATUSBAR_PLUG_WIDTH + \
@@ -102,6 +124,18 @@
102#endif 124#endif
103#define STATUSBAR_TIME_X_END(statusbar_width) statusbar_width - 1 - \ 125#define STATUSBAR_TIME_X_END(statusbar_width) statusbar_width - 1 - \
104 STATUSBAR_DISK_WIDTH 126 STATUSBAR_DISK_WIDTH
127#if defined(HAVE_RECORDING)
128/* analogue frequency numbers taken from the order of frequencies in sample_rate */
129#define FREQ_44 7
130#define FREQ_48 8
131#define FREQ_32 6
132#define FREQ_22 4
133#define FREQ_24 5
134#define FREQ_16 3
135#ifdef HAVE_SPDIF_IN
136#define SOURCE_SPDIF 2
137#endif
138#endif
105 139
106struct gui_syncstatusbar statusbars; 140struct gui_syncstatusbar statusbars;
107 141
@@ -234,28 +268,40 @@ void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw)
234 STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH, 268 STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH,
235 STATUSBAR_HEIGHT); 269 STATUSBAR_HEIGHT);
236#endif 270#endif
237 271#ifdef HAVE_RECORDING
238 bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume); 272 /* turn off volume display in recording screen */
273 if (!global_settings.recscreen_on)
274#endif
275 bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume);
239 gui_statusbar_icon_play_state(display, current_playmode() + Icon_Play); 276 gui_statusbar_icon_play_state(display, current_playmode() + Icon_Play);
240 277
241 switch (bar->info.repeat) { 278#ifdef HAVE_RECORDING
279 /* If in recording screen, replace repeat mode, volume
280 and shuffle icons with recording info */
281 if (global_settings.recscreen_on)
282 gui_statusbar_icon_recording_info(display);
283 else
284#endif
285 {
286 switch (bar->info.repeat) {
242#if (AB_REPEAT_ENABLE == 1) 287#if (AB_REPEAT_ENABLE == 1)
243 case REPEAT_AB: 288 case REPEAT_AB:
244 gui_statusbar_icon_play_mode(display, Icon_RepeatAB); 289 gui_statusbar_icon_play_mode(display, Icon_RepeatAB);
245 break; 290 break;
246#endif /* AB_REPEAT_ENABLE == 1 */ 291#endif /* AB_REPEAT_ENABLE == 1 */
247 292
248 case REPEAT_ONE: 293 case REPEAT_ONE:
249 gui_statusbar_icon_play_mode(display, Icon_RepeatOne); 294 gui_statusbar_icon_play_mode(display, Icon_RepeatOne);
250 break; 295 break;
251 296
252 case REPEAT_ALL: 297 case REPEAT_ALL:
253 case REPEAT_SHUFFLE: 298 case REPEAT_SHUFFLE:
254 gui_statusbar_icon_play_mode(display, Icon_Repeat); 299 gui_statusbar_icon_play_mode(display, Icon_Repeat);
255 break; 300 break;
301 }
302 if (bar->info.shuffle)
303 gui_statusbar_icon_shuffle(display);
256 } 304 }
257 if (bar->info.shuffle)
258 gui_statusbar_icon_shuffle(display);
259 if (bar->info.keylock) 305 if (bar->info.keylock)
260 gui_statusbar_icon_lock(display); 306 gui_statusbar_icon_lock(display);
261#ifdef HAS_REMOTE_BUTTON_HOLD 307#ifdef HAS_REMOTE_BUTTON_HOLD
@@ -553,6 +599,115 @@ void gui_statusbar_time(struct screen * display, int hour, int minute)
553} 599}
554#endif 600#endif
555 601
602#ifdef HAVE_RECORDING
603void gui_statusbar_icon_recording_info(struct screen * display)
604{
605 int width, height;
606 char buffer[4];
607 char* const sample_rate[12] =
608 {
609 "8",
610 "11",
611 "12",
612 "16",
613 "22",
614 "24",
615 "32",
616 "44",
617 "48",
618 "64",
619 "88",
620 "96"
621 };
622#if CONFIG_CODEC != SWCODEC
623 char* const bit_rate[9] =
624 {
625 "MQ0",
626 "MQ1",
627 "MQ2",
628 "MQ3",
629 "MQ4",
630 "MQ5",
631 "MQ6",
632 "MQ7",
633 "WAV"
634 };
635#endif
636
637 display->setfont(FONT_SYSFIXED);
638
639 /* Display Codec info in statusbar */
640#if CONFIG_CODEC == SWCODEC
641 /* Can't fit info for sw codec targets in statusbar using FONT_SYSFIXED
642 so must use icons */
643 display->mono_bitmap(bitmap_icons_18x8[global_settings.rec_quality],
644 STATUSBAR_ENCODER_X_POS, STATUSBAR_Y_POS,
645 STATUSBAR_ENCODER_WIDTH, STATUSBAR_HEIGHT);
646#else
647 snprintf(buffer, sizeof(buffer), "%s", bit_rate[global_settings.rec_quality]);
648 display->getstringsize(buffer, &width, &height);
649 if (height <= STATUSBAR_HEIGHT)
650 {
651 display->putsxy(STATUSBAR_ENCODER_X_POS, STATUSBAR_Y_POS, buffer);
652 }
653#endif
654
655 /* Display Samplerate info in statusbar */
656#if defined(HAVE_SPDIF_IN)
657 if (global_settings.rec_source == SOURCE_SPDIF)
658 {
659#if (CONFIG_CODEC != MAS3587F) && !defined(SIMULATOR)
660 snprintf(buffer, sizeof(buffer), "%s", sample_rate[audio_get_spdif_sample_rate()]);
661#else
662 /* Can't measure S/PDIF sample rate on Archos/Sim yet so just display input type */
663 snprintf(buffer, sizeof(buffer), "Dg");
664#endif
665 }
666 else
667#endif /* HAVE_SPDIF_IN */
668 {
669 /* Analogue frequency in wrong order so remap settings numbers */
670 int freq = global_settings.rec_frequency;
671 if (freq == 0)
672 freq = FREQ_44;
673 else if (freq == 1)
674 freq = FREQ_48;
675 else if (freq == 2)
676 freq = FREQ_32;
677 else if (freq == 3)
678 freq = FREQ_22;
679 else if (freq == 4)
680 freq = FREQ_24;
681 else if (freq == 5)
682 freq = FREQ_16;
683
684 snprintf(buffer, sizeof(buffer), "%s", sample_rate[freq]);
685 }
686
687 display->getstringsize(buffer, &width, &height);
688 if (height <= STATUSBAR_HEIGHT)
689 {
690 display->putsxy(STATUSBAR_RECFREQ_X_POS, STATUSBAR_Y_POS, buffer);
691 }
692
693 display->setfont(FONT_UI);
694
695 /* Display Channel status in status bar */
696 if(global_settings.rec_channels)
697 {
698 display->mono_bitmap(bitmap_icons_5x8[Icon_Mono],
699 STATUSBAR_RECCHANNELS_X_POS , STATUSBAR_Y_POS,
700 STATUSBAR_RECCHANNELS_WIDTH, STATUSBAR_HEIGHT);
701 }
702 else
703 {
704 display->mono_bitmap(bitmap_icons_5x8[Icon_Stereo],
705 STATUSBAR_RECCHANNELS_X_POS, STATUSBAR_Y_POS,
706 STATUSBAR_RECCHANNELS_WIDTH, STATUSBAR_HEIGHT);
707 }
708}
709#endif /* HAVE_RECORDING */
710
556#endif /* HAVE_LCD_BITMAP */ 711#endif /* HAVE_LCD_BITMAP */
557 712
558void gui_syncstatusbar_init(struct gui_syncstatusbar * bars) 713void gui_syncstatusbar_init(struct gui_syncstatusbar * bars)
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index a03c294523..5ab97d09ea 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -105,7 +105,9 @@ void gui_statusbar_icon_shuffle(struct screen * display);
105void gui_statusbar_icon_lock(struct screen * display); 105void gui_statusbar_icon_lock(struct screen * display);
106void gui_statusbar_icon_lock_remote(struct screen * display); 106void gui_statusbar_icon_lock_remote(struct screen * display);
107void gui_statusbar_led(struct screen * display); 107void gui_statusbar_led(struct screen * display);
108 108#ifdef HAVE_RECORDING
109void gui_statusbar_icon_recording_info(struct screen * display);
110#endif
109 111
110#ifdef CONFIG_RTC 112#ifdef CONFIG_RTC
111void gui_statusbar_time(struct screen * display, int hour, int minute); 113void gui_statusbar_time(struct screen * display, int hour, int minute);