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
diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c
index cbd1709..72e681f 100644
--- a/apps/gui/statusbar.c
+++ b/apps/gui/statusbar.c
@@ -36,7 +36,9 @@
#include "status.h" /* needed for battery_state global var */
#include "action.h" /* for keys_locked */
#include "statusbar.h"
-
+#ifdef HAVE_RECORDING
+#include "audio.h"
+#endif
/* FIXME: should be removed from icon.h to avoid redefinition,
but still needed for compatibility with old system */
@@ -52,6 +54,11 @@
STATUSBAR_PLUG_WIDTH + \
2*ICONS_SPACING
#define STATUSBAR_VOLUME_WIDTH 16
+#define STATUSBAR_ENCODER_X_POS STATUSBAR_X_POS + \
+ STATUSBAR_BATTERY_WIDTH + \
+ STATUSBAR_PLUG_WIDTH + \
+ 2*ICONS_SPACING - 1
+#define STATUSBAR_ENCODER_WIDTH 18
#define STATUSBAR_PLAY_STATE_X_POS STATUSBAR_X_POS + \
STATUSBAR_BATTERY_WIDTH + \
STATUSBAR_PLUG_WIDTH + \
@@ -65,6 +72,21 @@
STATUSBAR_PLAY_STATE_WIDTH + \
4*ICONS_SPACING
#define STATUSBAR_PLAY_MODE_WIDTH 7
+#define STATUSBAR_RECFREQ_X_POS STATUSBAR_X_POS + \
+ STATUSBAR_BATTERY_WIDTH + \
+ STATUSBAR_PLUG_WIDTH + \
+ STATUSBAR_VOLUME_WIDTH + \
+ STATUSBAR_PLAY_STATE_WIDTH + \
+ 3*ICONS_SPACING
+#define STATUSBAR_RECFREQ_WIDTH 12
+#define STATUSBAR_RECCHANNELS_X_POS STATUSBAR_X_POS + \
+ STATUSBAR_BATTERY_WIDTH + \
+ STATUSBAR_PLUG_WIDTH + \
+ STATUSBAR_VOLUME_WIDTH + \
+ STATUSBAR_PLAY_STATE_WIDTH + \
+ STATUSBAR_RECFREQ_WIDTH + \
+ 4*ICONS_SPACING
+#define STATUSBAR_RECCHANNELS_WIDTH 5
#define STATUSBAR_SHUFFLE_X_POS STATUSBAR_X_POS + \
STATUSBAR_BATTERY_WIDTH + \
STATUSBAR_PLUG_WIDTH + \
@@ -102,6 +124,18 @@
#endif
#define STATUSBAR_TIME_X_END(statusbar_width) statusbar_width - 1 - \
STATUSBAR_DISK_WIDTH
+#if defined(HAVE_RECORDING)
+/* analogue frequency numbers taken from the order of frequencies in sample_rate */
+#define FREQ_44 7
+#define FREQ_48 8
+#define FREQ_32 6
+#define FREQ_22 4
+#define FREQ_24 5
+#define FREQ_16 3
+#ifdef HAVE_SPDIF_IN
+#define SOURCE_SPDIF 2
+#endif
+#endif
struct gui_syncstatusbar statusbars;
@@ -234,28 +268,40 @@
STATUSBAR_Y_POS, STATUSBAR_PLUG_WIDTH,
STATUSBAR_HEIGHT);
#endif
-
- bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume);
+#ifdef HAVE_RECORDING
+ /* turn off volume display in recording screen */
+ if (!global_settings.recscreen_on)
+#endif
+ bar->redraw_volume = gui_statusbar_icon_volume(bar, bar->info.volume);
gui_statusbar_icon_play_state(display, current_playmode() + Icon_Play);
-
- switch (bar->info.repeat) {
+
+#ifdef HAVE_RECORDING
+ /* If in recording screen, replace repeat mode, volume
+ and shuffle icons with recording info */
+ if (global_settings.recscreen_on)
+ gui_statusbar_icon_recording_info(display);
+ else
+#endif
+ {
+ switch (bar->info.repeat) {
#if (AB_REPEAT_ENABLE == 1)
- case REPEAT_AB:
- gui_statusbar_icon_play_mode(display, Icon_RepeatAB);
- break;
+ case REPEAT_AB:
+ gui_statusbar_icon_play_mode(display, Icon_RepeatAB);
+ break;
#endif /* AB_REPEAT_ENABLE == 1 */
- case REPEAT_ONE:
- gui_statusbar_icon_play_mode(display, Icon_RepeatOne);
- break;
+ case REPEAT_ONE:
+ gui_statusbar_icon_play_mode(display, Icon_RepeatOne);
+ break;
- case REPEAT_ALL:
- case REPEAT_SHUFFLE:
- gui_statusbar_icon_play_mode(display, Icon_Repeat);
- break;
+ case REPEAT_ALL:
+ case REPEAT_SHUFFLE:
+ gui_statusbar_icon_play_mode(display, Icon_Repeat);
+ break;
+ }
+ if (bar->info.shuffle)
+ gui_statusbar_icon_shuffle(display);
}
- if (bar->info.shuffle)
- gui_statusbar_icon_shuffle(display);
if (bar->info.keylock)
gui_statusbar_icon_lock(display);
#ifdef HAS_REMOTE_BUTTON_HOLD
@@ -553,6 +599,115 @@
}
#endif
+#ifdef HAVE_RECORDING
+void gui_statusbar_icon_recording_info(struct screen * display)
+{
+ int width, height;
+ char buffer[4];
+ char* const sample_rate[12] =
+ {
+ "8",
+ "11",
+ "12",
+ "16",
+ "22",
+ "24",
+ "32",
+ "44",
+ "48",
+ "64",
+ "88",
+ "96"
+ };
+#if CONFIG_CODEC != SWCODEC
+ char* const bit_rate[9] =
+ {
+ "MQ0",
+ "MQ1",
+ "MQ2",
+ "MQ3",
+ "MQ4",
+ "MQ5",
+ "MQ6",
+ "MQ7",
+ "WAV"
+ };
+#endif
+
+ display->setfont(FONT_SYSFIXED);
+
+ /* Display Codec info in statusbar */
+#if CONFIG_CODEC == SWCODEC
+ /* Can't fit info for sw codec targets in statusbar using FONT_SYSFIXED
+ so must use icons */
+ display->mono_bitmap(bitmap_icons_18x8[global_settings.rec_quality],
+ STATUSBAR_ENCODER_X_POS, STATUSBAR_Y_POS,
+ STATUSBAR_ENCODER_WIDTH, STATUSBAR_HEIGHT);
+#else
+ snprintf(buffer, sizeof(buffer), "%s", bit_rate[global_settings.rec_quality]);
+ display->getstringsize(buffer, &width, &height);
+ if (height <= STATUSBAR_HEIGHT)
+ {
+ display->putsxy(STATUSBAR_ENCODER_X_POS, STATUSBAR_Y_POS, buffer);
+ }
+#endif
+
+ /* Display Samplerate info in statusbar */
+#if defined(HAVE_SPDIF_IN)
+ if (global_settings.rec_source == SOURCE_SPDIF)
+ {
+#if (CONFIG_CODEC != MAS3587F) && !defined(SIMULATOR)
+ snprintf(buffer, sizeof(buffer), "%s", sample_rate[audio_get_spdif_sample_rate()]);
+#else
+ /* Can't measure S/PDIF sample rate on Archos/Sim yet so just display input type */
+ snprintf(buffer, sizeof(buffer), "Dg");
+#endif
+ }
+ else
+#endif /* HAVE_SPDIF_IN */
+ {
+ /* Analogue frequency in wrong order so remap settings numbers */
+ int freq = global_settings.rec_frequency;
+ if (freq == 0)
+ freq = FREQ_44;
+ else if (freq == 1)
+ freq = FREQ_48;
+ else if (freq == 2)
+ freq = FREQ_32;
+ else if (freq == 3)
+ freq = FREQ_22;
+ else if (freq == 4)
+ freq = FREQ_24;
+ else if (freq == 5)
+ freq = FREQ_16;
+
+ snprintf(buffer, sizeof(buffer), "%s", sample_rate[freq]);
+ }
+
+ display->getstringsize(buffer, &width, &height);
+ if (height <= STATUSBAR_HEIGHT)
+ {
+ display->putsxy(STATUSBAR_RECFREQ_X_POS, STATUSBAR_Y_POS, buffer);
+ }
+
+ display->setfont(FONT_UI);
+
+ /* Display Channel status in status bar */
+ if(global_settings.rec_channels)
+ {
+ display->mono_bitmap(bitmap_icons_5x8[Icon_Mono],
+ STATUSBAR_RECCHANNELS_X_POS , STATUSBAR_Y_POS,
+ STATUSBAR_RECCHANNELS_WIDTH, STATUSBAR_HEIGHT);
+ }
+ else
+ {
+ display->mono_bitmap(bitmap_icons_5x8[Icon_Stereo],
+ STATUSBAR_RECCHANNELS_X_POS, STATUSBAR_Y_POS,
+ STATUSBAR_RECCHANNELS_WIDTH, STATUSBAR_HEIGHT);
+ }
+}
+#endif /* HAVE_RECORDING */
+
#endif /* HAVE_LCD_BITMAP */
void gui_syncstatusbar_init(struct gui_syncstatusbar * bars)
diff --git a/apps/gui/statusbar.h b/apps/gui/statusbar.h
index a03c294..5ab97d0 100644
--- a/apps/gui/statusbar.h
+++ b/apps/gui/statusbar.h
@@ -105,7 +105,9 @@
void gui_statusbar_icon_lock(struct screen * display);
void gui_statusbar_icon_lock_remote(struct screen * display);
void gui_statusbar_led(struct screen * display);
-
+#ifdef HAVE_RECORDING
+void gui_statusbar_icon_recording_info(struct screen * display);
+#endif
#ifdef CONFIG_RTC
void gui_statusbar_time(struct screen * display, int hour, int minute);
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index 9fab6cf..fc271e8 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -31,7 +31,9 @@
const unsigned char bitmap_icons_5x8[][5] =
{
[Icon_Lock_Main] ={0x78,0x7f,0x49,0x7f,0x78}, /* Lock Main */
- [Icon_Lock_Remote]={0x78,0x7f,0x49,0x7f,0x78} /* Lock Remote */
+ [Icon_Lock_Remote]={0x78,0x7f,0x49,0x7f,0x78}, /* Lock Remote */
+ [Icon_Stereo]={0x1c, 0x22, 0x1c, 0x22, 0x1c}, /* Stereo recording */
+ [Icon_Mono]={0x00, 0x1c, 0x22, 0x1c, 0x00} /* Mono recording */
};
const unsigned char bitmap_icons_6x8[][6] =
@@ -75,6 +77,29 @@
{0x7f,0x04,0x4e,0x5f,0x44,0x38,0x7f} /* Repeat-AB playmode */
};
+const unsigned char bitmap_icons_18x8[][18] =
+{
+ {0x00, 0x00, 0x00, 0x00, 0x3e, 0x04, 0x08, 0x04, 0x3e, 0x00, 0x00, 0x1c, 0x2a,
+ 0x12, 0x00, 0x1e, 0x30, 0x10}, /* mp3 64kbps */
+ {0x00, 0x00, 0x00, 0x00, 0x3e, 0x04, 0x08, 0x04, 0x3e, 0x00, 0x00, 0x04, 0x0a,
+ 0x3e, 0x00, 0x1c, 0x2a, 0x12}, /* mp3 96kbps */
+ {0x00, 0x00, 0x3e, 0x04, 0x08, 0x04, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x32, 0x2a,
+ 0x24, 0x00, 0x14, 0x2a, 0x14}, /* mp3 128kbps */
+ {0x00, 0x00, 0x3e, 0x04, 0x08, 0x04, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x1c, 0x2a,
+ 0x12, 0x00, 0x1c, 0x22, 0x1c}, /* mp3 160kbps */
+ {0x00, 0x00, 0x3e, 0x04, 0x08, 0x04, 0x3e, 0x00, 0x00, 0x3e, 0x00, 0x04, 0x0a,
+ 0x3e, 0x00, 0x32, 0x2a, 0x24}, /* mp3 192kbps */
+ {0x3e, 0x04, 0x08, 0x04, 0x3e, 0x00, 0x00, 0x32, 0x2a, 0x24, 0x00, 0x32, 0x2a,
+ 0x24, 0x00, 0x1e, 0x30, 0x10}, /* mp3 224kbps */
+ {0x3e, 0x04, 0x08, 0x04, 0x3e, 0x00, 0x00, 0x22, 0x2a, 0x14, 0x00, 0x32, 0x2a,
+ 0x24, 0x00, 0x1c, 0x22, 0x1c}, /* mp3 320kbps */
+ {0x00, 0x00, 0x00, 0x00, 0x1e, 0x20, 0x18, 0x20, 0x1e, 0x00, 0x1e, 0x20, 0x18,
+ 0x06, 0x00, 0x00, 0x00, 0x00}, /* wv */
+ {0x00, 0x1e, 0x20, 0x18, 0x20, 0x1e, 0x00, 0x3c, 0x12, 0x12, 0x3c, 0x00, 0x1e,
+ 0x20, 0x18, 0x06, 0x00, 0x00} /* wav */
+};
+
+
/* Disk/MMC activity */
const unsigned char bitmap_icon_disk[12] =
#ifdef HAVE_MMC
diff --git a/apps/recorder/icons.h b/apps/recorder/icons.h
index d29b549..5e7f157 100644
--- a/apps/recorder/icons.h
+++ b/apps/recorder/icons.h
@@ -39,6 +39,8 @@
enum icons_5x8 {
Icon_Lock_Main,
Icon_Lock_Remote,
+ Icon_Stereo,
+ Icon_Mono,
Icon5x8Last
};
@@ -83,9 +85,22 @@
Icon7x8Last
};
+enum icons_18x8 {
+ Icon_mp364,
+ Icon_mp396,
+ Icon_mp3128,
+ Icon_mp3160,
+ Icon_mp3192,
+ Icon_mp3224,
+ Icon_mp3320,
+ Icon_wv,
+ Icon_wav,
+ Icon18x8Last
+};
extern const unsigned char bitmap_icons_5x8[Icon5x8Last][5];
extern const unsigned char bitmap_icons_6x8[Icon6x8Last][6];
extern const unsigned char bitmap_icons_7x8[Icon7x8Last][7];
+extern const unsigned char bitmap_icons_18x8[Icon18x8Last][18];
extern const unsigned char bitmap_icon_disk[];
#define STATUSBAR_X_POS 0
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index b39a96e..e964db1 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -810,6 +810,7 @@
ID2P(LANG_GIGABYTE)
};
+ global_settings.recscreen_on = true;
cursor = 0;
#if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR)
ata_set_led_enabled(false);
@@ -1353,7 +1354,6 @@
unsigned int dseconds, dhours, dminutes;
unsigned long num_recorded_bytes, dsize, dmb;
int pos = 0;
- char spdif_sfreq[8];
update_countdown = 5;
last_seconds = seconds;
@@ -1687,53 +1687,11 @@
PM_HEIGHT + 2, true);
}
}
-/* Can't measure S/PDIF sample rate on Archos yet */
-#if (CONFIG_CODEC != MAS3587F) && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
- if (global_settings.rec_source == AUDIO_SRC_SPDIF)
- snprintf(spdif_sfreq, 8, "%dHz", audio_get_spdif_sample_rate());
-#else
- (void)spdif_sfreq;
-#endif
- snprintf(buf, 32, "%s %s",
-#if (CONFIG_CODEC != MAS3587F) && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
- global_settings.rec_source == AUDIO_SRC_SPDIF ?
- spdif_sfreq :
-#endif
- freq_str[global_settings.rec_frequency],
- global_settings.rec_channels ?
- str(LANG_SYSFONT_CHANNEL_MONO) :
- str(LANG_SYSFONT_CHANNEL_STEREO));
-
- for(i = 0; i < screen_update; i++) {
-#ifdef HAVE_AGC
- if ((global_settings.rec_source == AUDIO_SRC_MIC)
- || (global_settings.rec_source == AUDIO_SRC_LINEIN)
- || (global_settings.rec_source == AUDIO_SRC_FMRADIO))
- screens[i].puts(0, filename_offset[i] + PM_HEIGHT + line[i] + 1, buf);
- else
-#endif
- screens[i].puts(0, filename_offset[i] + PM_HEIGHT + line[i], buf);
- }
#ifdef HAVE_AGC
hist_time++;
#endif
-#if CONFIG_CODEC == SWCODEC
- snprintf(buf, 32, "%s",
- REC_QUALITY_LABEL(global_settings.rec_quality));
- for(i = 0; i < screen_update; i++){
-#ifdef HAVE_AGC
- if ((global_settings.rec_source == AUDIO_SRC_MIC)
- || (global_settings.rec_source == AUDIO_SRC_LINEIN)
- || (global_settings.rec_source == AUDIO_SRC_FMRADIO))
- screens[i].puts(0, filename_offset[i] + PM_HEIGHT + line[i] + 2, buf);
- else
-#endif
- screens[i].puts(0, filename_offset[i] + PM_HEIGHT + line[i] + 1, buf);
- }
-#endif
-
for(i = 0; i < screen_update; i++)
{
gui_statusbar_draw(&(statusbars.statusbars[i]), true);
@@ -1758,7 +1716,6 @@
}
} /* end while(!done) */
-
#if CONFIG_CODEC == SWCODEC
audio_stat = pcm_rec_status();
#else
@@ -1806,6 +1763,7 @@
peak_meter_trigger(false);
peak_meter_set_trigger_listener(NULL);
+ global_settings.recscreen_on = false;
sound_settings_apply();
FOR_NB_SCREENS(i)
diff --git a/apps/settings.c b/apps/settings.c
index aa79946..d298ec8 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -92,7 +92,7 @@
#include "dsp.h"
#endif
-#define CONFIG_BLOCK_VERSION 51
+#define CONFIG_BLOCK_VERSION 52
#define CONFIG_BLOCK_SIZE 512
#define RTC_BLOCK_SIZE 44
@@ -464,6 +464,7 @@
#ifdef HAVE_RECORDING
/* recording */
+ {1, S_O(recscreen_on), false, "recscreen on", off_on },
{1, S_O(rec_startup), false, "rec screen on startup", off_on },
{4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
"off,00:05,00:10,00:15,00:30,01:00,01:14,01:20,02:00,04:00,06:00,08:00,10:00,12:00,18:00,24:00" },
@@ -1336,6 +1337,9 @@
RTC_BLOCK_SIZE*8);
}
+#ifdef HAVE_RECORDING
+ global_settings.recscreen_on = false;
+#endif
#ifdef HAVE_LCD_CONTRAST
if ( global_settings.contrast < MIN_CONTRAST_SETTING )
global_settings.contrast = lcd_default_contrast();
diff --git a/apps/settings.h b/apps/settings.h
index af0eef5..e4787f5 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -151,6 +151,7 @@
int rec_left_gain; /* 0-15 */
int rec_right_gain; /* 0-15 */
bool rec_editable; /* true means that the bit reservoir is off */
+ bool recscreen_on; /* true if using the recording screen */
/* note: timesplit setting is not saved */
int rec_timesplit; /* 0 = off,
diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c
index 4e4d5f2..68fc22b 100644
--- a/firmware/pcm_record.c
+++ b/firmware/pcm_record.c
@@ -289,7 +289,7 @@
if (diff2 > diff1) --i;
}
- return spdif_sample_rates[i];
+ return i;
}
#endif