diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2010-03-08 22:30:11 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2010-03-08 22:30:11 +0000 |
commit | 1abda91faa7efa110628b7513f777b78c9a5c8f3 (patch) | |
tree | 6d428fb329d600ac301247bc0f932bc0fa894018 /apps/recorder | |
parent | 5c4659ab2958f0537414f3a299febda68670fca8 (diff) | |
download | rockbox-1abda91faa7efa110628b7513f777b78c9a5c8f3.tar.gz rockbox-1abda91faa7efa110628b7513f777b78c9a5c8f3.zip |
change histogram display principle to scrolling and simplify the code a bit
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25074 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/recording.c | 67 |
1 files changed, 28 insertions, 39 deletions
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index bcb9169c57..3af0ec8131 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -276,6 +276,7 @@ static long hist_time = 0; | |||
276 | #ifdef HAVE_RECORDING_HISTOGRAM | 276 | #ifdef HAVE_RECORDING_HISTOGRAM |
277 | static int hist_l = 0; | 277 | static int hist_l = 0; |
278 | static int hist_r = 0; | 278 | static int hist_r = 0; |
279 | #define HIST_BUF_SIZE (LCD_WIDTH) | ||
279 | #define HIST_Y (hist_pos_y+hist_size_h-1) | 280 | #define HIST_Y (hist_pos_y+hist_size_h-1) |
280 | #define HIST_W (LCD_WIDTH / 2 - 4) | 281 | #define HIST_W (LCD_WIDTH / 2 - 4) |
281 | #if LCD_DEPTH > 1 | 282 | #if LCD_DEPTH > 1 |
@@ -1056,7 +1057,7 @@ bool recording_screen(bool no_source) | |||
1056 | int peak_l, peak_r; | 1057 | int peak_l, peak_r; |
1057 | int balance = 0; | 1058 | int balance = 0; |
1058 | #endif | 1059 | #endif |
1059 | int i; | 1060 | int i,j; |
1060 | int pm_x[NB_SCREENS]; /* peakmeter (and trigger bar) x pos */ | 1061 | int pm_x[NB_SCREENS]; /* peakmeter (and trigger bar) x pos */ |
1061 | int pm_y[NB_SCREENS]; /* peakmeter y pos */ | 1062 | int pm_y[NB_SCREENS]; /* peakmeter y pos */ |
1062 | int pm_h[NB_SCREENS]; /* peakmeter height */ | 1063 | int pm_h[NB_SCREENS]; /* peakmeter height */ |
@@ -1073,8 +1074,8 @@ bool recording_screen(bool no_source) | |||
1073 | unsigned short hist_size_h = 0; | 1074 | unsigned short hist_size_h = 0; |
1074 | int history_pos = 0; | 1075 | int history_pos = 0; |
1075 | short hist_time_interval = 1; /* 1, 2, 4, 8 */ | 1076 | short hist_time_interval = 1; /* 1, 2, 4, 8 */ |
1076 | unsigned char history_l[HIST_W]; | 1077 | unsigned char history_l[HIST_BUF_SIZE]; |
1077 | unsigned char history_r[HIST_W]; | 1078 | unsigned char history_r[HIST_BUF_SIZE]; |
1078 | const char hist_level_marks[6] = { 29, 26, 23, 17, 9, 2}; | 1079 | const char hist_level_marks[6] = { 29, 26, 23, 17, 9, 2}; |
1079 | #endif | 1080 | #endif |
1080 | #ifdef HAVE_FMRADIO_REC | 1081 | #ifdef HAVE_FMRADIO_REC |
@@ -1204,8 +1205,8 @@ bool recording_screen(bool no_source) | |||
1204 | hist_pos_y = (compact_view[0] ? 3 : 4) * (font_get(vp_top[0].font)->height) | 1205 | hist_pos_y = (compact_view[0] ? 3 : 4) * (font_get(vp_top[0].font)->height) |
1205 | + 1; | 1206 | + 1; |
1206 | hist_size_h = font_get(vp_top[0].font)->height - 2; | 1207 | hist_size_h = font_get(vp_top[0].font)->height - 2; |
1207 | memset(history_l, 0, sizeof(unsigned char)*HIST_W); | 1208 | memset(history_l, 0, sizeof(unsigned char)*HIST_BUF_SIZE); |
1208 | memset(history_r, 0, sizeof(unsigned char)*HIST_W); | 1209 | memset(history_r, 0, sizeof(unsigned char)*HIST_BUF_SIZE); |
1209 | #endif | 1210 | #endif |
1210 | 1211 | ||
1211 | FOR_NB_SCREENS(i) | 1212 | FOR_NB_SCREENS(i) |
@@ -1865,12 +1866,13 @@ bool recording_screen(bool no_source) | |||
1865 | { | 1866 | { |
1866 | if (peak_valid && !(hist_time % hist_time_interval) && hist_l) | 1867 | if (peak_valid && !(hist_time % hist_time_interval) && hist_l) |
1867 | { | 1868 | { |
1869 | /* fill history buffer */ | ||
1868 | history_l[history_pos] = hist_l * hist_size_h / 32767; | 1870 | history_l[history_pos] = hist_l * hist_size_h / 32767; |
1869 | history_r[history_pos] = hist_r * hist_size_h / 32767; | 1871 | history_r[history_pos] = hist_r * hist_size_h / 32767; |
1870 | history_pos = (history_pos + 1) % HIST_W; | 1872 | history_pos = (history_pos + 1) % HIST_BUF_SIZE; |
1871 | history_l[history_pos] = history_r[history_pos] = 0; | 1873 | history_l[history_pos] = history_r[history_pos] = 0; |
1872 | history_l[(history_pos + 1) % HIST_W] = 0; | 1874 | history_l[(history_pos + 1) % HIST_BUF_SIZE] = 0; |
1873 | history_r[(history_pos + 1) % HIST_W] = 0; | 1875 | history_r[(history_pos + 1) % HIST_BUF_SIZE] = 0; |
1874 | hist_l = 0; | 1876 | hist_l = 0; |
1875 | hist_r = 0; | 1877 | hist_r = 0; |
1876 | } | 1878 | } |
@@ -1880,51 +1882,38 @@ bool recording_screen(bool no_source) | |||
1880 | lcd_drawrect(HIST_W + 6, hist_pos_y - 1, | 1882 | lcd_drawrect(HIST_W + 6, hist_pos_y - 1, |
1881 | HIST_W + 2, hist_size_h + 1); | 1883 | HIST_W + 2, hist_size_h + 1); |
1882 | lcd_set_drawmode(DRMODE_FG); | 1884 | lcd_set_drawmode(DRMODE_FG); |
1883 | #ifdef HAVE_LCD_COLOR | 1885 | |
1884 | for (i = 0; i < HIST_W; i++) | 1886 | j = history_pos; |
1887 | for (i = HIST_W-1; i >= 0; i--) | ||
1885 | { | 1888 | { |
1886 | if (history_l[i]) | 1889 | j--; |
1890 | if(j<0) | ||
1891 | j = HIST_BUF_SIZE-1; | ||
1892 | if (history_l[j]) | ||
1887 | { | 1893 | { |
1888 | if (history_l[i] == hist_size_h) | 1894 | if (history_l[j] == hist_size_h) |
1889 | lcd_set_foreground(LCD_HIST_OVER); | 1895 | lcd_set_foreground(LCD_HIST_OVER); |
1890 | else if (history_l[i] > hist_level_marks[1]) | 1896 | #ifdef HAVE_LCD_COLOR |
1897 | else if (history_l[j] > hist_level_marks[1]) | ||
1891 | lcd_set_foreground(LCD_HIST_HI); | 1898 | lcd_set_foreground(LCD_HIST_HI); |
1899 | #endif | ||
1892 | else | 1900 | else |
1893 | lcd_set_foreground(LCD_HIST_OK); | 1901 | lcd_set_foreground(LCD_HIST_OK); |
1894 | lcd_vline(1 + i, HIST_Y-1, HIST_Y - history_l[i]); | 1902 | lcd_vline(1 + i, HIST_Y-1, HIST_Y - history_l[j]); |
1895 | } | 1903 | } |
1896 | if (history_r[i]) | 1904 | if (history_r[j]) |
1897 | { | 1905 | { |
1898 | if (history_r[i] == hist_size_h) | 1906 | if (history_r[j] == hist_size_h) |
1899 | lcd_set_foreground(LCD_HIST_OVER); | 1907 | lcd_set_foreground(LCD_HIST_OVER); |
1900 | else if (history_r[i] > hist_level_marks[1]) | 1908 | #ifdef HAVE_LCD_COLOR |
1909 | else if (history_r[j] > hist_level_marks[1]) | ||
1901 | lcd_set_foreground(LCD_HIST_HI); | 1910 | lcd_set_foreground(LCD_HIST_HI); |
1911 | #endif | ||
1902 | else | 1912 | else |
1903 | lcd_set_foreground(LCD_HIST_OK); | 1913 | lcd_set_foreground(LCD_HIST_OK); |
1904 | lcd_vline(HIST_W+7 + i, HIST_Y-1, HIST_Y - history_r[i]); | 1914 | lcd_vline(HIST_W+7 + i, HIST_Y-1, HIST_Y - history_r[j]); |
1905 | } | ||
1906 | } | ||
1907 | #else | ||
1908 | for (i = 0; i < HIST_W; i++) | ||
1909 | { | ||
1910 | if (history_l[i]) | ||
1911 | { | ||
1912 | if (history_l[i] == hist_size_h) | ||
1913 | lcd_set_foreground(LCD_HIST_OVER); | ||
1914 | else | ||
1915 | lcd_set_foreground(LCD_HIST_OK); | ||
1916 | lcd_vline(1 + i, HIST_Y-1, HIST_Y - history_l[i]); | ||
1917 | } | ||
1918 | if (history_r[i]) | ||
1919 | { | ||
1920 | if (history_r[i] == hist_size_h) | ||
1921 | lcd_set_foreground(LCD_HIST_OVER); | ||
1922 | else | ||
1923 | lcd_set_foreground(LCD_HIST_OK); | ||
1924 | lcd_vline(HIST_W+7 + i, HIST_Y-1, HIST_Y - history_r[i]); | ||
1925 | } | 1915 | } |
1926 | } | 1916 | } |
1927 | #endif /* HAVE_LCD_COLOR */ | ||
1928 | lcd_set_foreground( | 1917 | lcd_set_foreground( |
1929 | #ifdef HAVE_LCD_COLOR | 1918 | #ifdef HAVE_LCD_COLOR |
1930 | global_settings.fg_color); | 1919 | global_settings.fg_color); |