summaryrefslogtreecommitdiffstats
path: root/apps/recorder
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/albumart.c108
-rw-r--r--apps/recorder/albumart.h6
-rw-r--r--apps/recorder/jpeg_idct_arm.S12
-rw-r--r--apps/recorder/jpeg_load.c15
-rw-r--r--apps/recorder/jpeg_load.h7
-rw-r--r--apps/recorder/keyboard.c234
-rw-r--r--apps/recorder/pcm_record.c62
-rw-r--r--apps/recorder/peakmeter.c2
-rw-r--r--apps/recorder/recording.c263
-rw-r--r--apps/recorder/resize.c2
10 files changed, 407 insertions, 304 deletions
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c
index 5b3658a1cb..50794c06c8 100644
--- a/apps/recorder/albumart.c
+++ b/apps/recorder/albumart.c
@@ -39,6 +39,12 @@
#define USE_JPEG_COVER
#endif
+#ifdef PLUGIN
+ #define strmemccpy strlcpy
+ /* Note we don't use the return value so this works */
+ /* FIXME if strmemccpy gets added to the rb->plugin struct */
+#endif
+
/* Strip filename from a full path
*
* buf - buffer to extract directory to.
@@ -67,38 +73,12 @@ static char* strip_filename(char* buf, int buf_size, const char* fullpath)
}
len = MIN(sep - fullpath + 1, buf_size - 1);
- strlcpy(buf, fullpath, len + 1);
+ strmemccpy(buf, fullpath, len + 1);
return (sep + 1);
}
-/* Make sure part of path only contain chars valid for a FAT32 long name.
- * Double quotes are replaced with single quotes, other unsupported chars
- * are replaced with an underscore.
- *
- * path - path to modify.
- * offset - where in path to start checking.
- * count - number of chars to check.
- */
-static void fix_path_part(char* path, int offset, int count)
-{
- static const char invalid_chars[] = "*/:<>?\\|";
- int i;
-
- path += offset;
-
- for (i = 0; i <= count; i++, path++)
- {
- if (*path == 0)
- return;
- if (*path == '"')
- *path = '\'';
- else if (strchr(invalid_chars, *path))
- *path = '_';
- }
-}
-
#ifdef USE_JPEG_COVER
-static const char * extensions[] = { "jpeg", "jpg", "bmp" };
+static const char * const extensions[] = { "jpeg", "jpg", "bmp" };
static const unsigned char extension_lens[] = { 4, 3, 3 };
/* Try checking for several file extensions, return true if a file is found and
* leaving the path modified to include the matching extension.
@@ -266,7 +246,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
if (!found)
return false;
- strlcpy(buf, path, buflen);
+ strmemccpy(buf, path, buflen);
logf("Album art found: %s", path);
return true;
}
@@ -297,74 +277,4 @@ bool find_albumart(const struct mp3entry *id3, char *buf, int buflen,
return search_albumart_files(id3, size_string, buf, buflen);
}
-/* Draw the album art bitmap from the given handle ID onto the given WPS.
- Call with clear = true to clear the bitmap instead of drawing it. */
-void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear)
-{
- if (!gwps || !gwps->data || !gwps->display || handle_id < 0)
- return;
-
- struct wps_data *data = gwps->data;
- struct skin_albumart *aa = SKINOFFSETTOPTR(get_skin_buffer(data), data->albumart);
-
- if (!aa)
- return;
-
- struct bitmap *bmp;
- if (bufgetdata(handle_id, 0, (void *)&bmp) <= 0)
- return;
-
- short x = aa->x;
- short y = aa->y;
- short width = bmp->width;
- short height = bmp->height;
-
- if (aa->width > 0)
- {
- /* Crop if the bitmap is too wide */
- width = MIN(bmp->width, aa->width);
-
- /* Align */
- if (aa->xalign & WPS_ALBUMART_ALIGN_RIGHT)
- x += aa->width - width;
- else if (aa->xalign & WPS_ALBUMART_ALIGN_CENTER)
- x += (aa->width - width) / 2;
- }
-
- if (aa->height > 0)
- {
- /* Crop if the bitmap is too high */
- height = MIN(bmp->height, aa->height);
-
- /* Align */
- if (aa->yalign & WPS_ALBUMART_ALIGN_BOTTOM)
- y += aa->height - height;
- else if (aa->yalign & WPS_ALBUMART_ALIGN_CENTER)
- y += (aa->height - height) / 2;
- }
-
- if (!clear)
- {
- /* Draw the bitmap */
- gwps->display->bitmap_part((fb_data*)bmp->data, 0, 0,
- STRIDE(gwps->display->screen_type,
- bmp->width, bmp->height),
- x, y, width, height);
-#ifdef HAVE_LCD_INVERT
- if (global_settings.invert) {
- gwps->display->set_drawmode(DRMODE_COMPLEMENT);
- gwps->display->fillrect(x, y, width, height);
- gwps->display->set_drawmode(DRMODE_SOLID);
- }
-#endif
- }
- else
- {
- /* Clear the bitmap */
- gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
- gwps->display->fillrect(x, y, width, height);
- gwps->display->set_drawmode(DRMODE_SOLID);
- }
-}
-
#endif /* PLUGIN */
diff --git a/apps/recorder/albumart.h b/apps/recorder/albumart.h
index 80cacaf5f0..0d663d3d92 100644
--- a/apps/recorder/albumart.h
+++ b/apps/recorder/albumart.h
@@ -35,12 +35,6 @@
bool find_albumart(const struct mp3entry *id3, char *buf, int buflen,
const struct dim *dim);
-#ifndef PLUGIN
-/* Draw the album art bitmap from the given handle ID onto the given Skin.
- Call with clear = true to clear the bitmap instead of drawing it. */
-void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear);
-#endif
-
bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
char *buf, int buflen);
diff --git a/apps/recorder/jpeg_idct_arm.S b/apps/recorder/jpeg_idct_arm.S
index e7eb4b87f1..1f2603da1b 100644
--- a/apps/recorder/jpeg_idct_arm.S
+++ b/apps/recorder/jpeg_idct_arm.S
@@ -410,7 +410,7 @@ jpeg_idct8v:
#if ARM_ARCH < 5
mov r8, r4, lsl #16
orrs r9, r6, r7
- orreqs r9, r5, r4, lsr #16
+ orrseq r9, r5, r4, lsr #16
bne 2f
mov r8, r8, asr #14
strh r8, [r2]
@@ -505,7 +505,7 @@ jpeg_idct8v:
#else /* ARMv5+ */
mov r12, r4, lsl #16
orrs r9, r6, r7
- orreqs r9, r5, r4, lsr #16
+ orrseq r9, r5, r4, lsr #16
bne 2f
mov r12, r12, asr #14
strh r12, [r2]
@@ -615,7 +615,7 @@ jpeg_idct8h:
#if ARM_ARCH < 5
add r8, r14, r4, lsl #16
orrs r9, r6, r7
- orreqs r9, r5, r4, lsr #16
+ orrseq r9, r5, r4, lsr #16
bne 2f
mov r8, r8, asr #21
cmp r8, #255
@@ -727,7 +727,7 @@ jpeg_idct8h:
#else /* ARMv5+ */
add r12, r14, r4, lsl #16
orrs r9, r6, r7
- orreqs r9, r5, r4, lsr #16
+ orrseq r9, r5, r4, lsr #16
bne 2f
mov r12, r12, asr #21
cmp r12, #255
@@ -835,7 +835,7 @@ jpeg_idct8v:
1:
ldmia r0!, { r4-r7 }
orrs r9, r6, r7
- orreqs r9, r5, r4, lsr #16
+ orrseq r9, r5, r4, lsr #16
bne 2f
mov r4, r4, lsl #2
strh r4, [r2]
@@ -939,7 +939,7 @@ jpeg_idct8h:
ldmia r0!, { r4-r7 }
sadd16 r4, r4, r14
orrs r9, r6, r7
- orreqs r9, r5, r4, lsr #16
+ orrseq r9, r5, r4, lsr #16
bne 2f
sxth r4, r4
usat r4, #8, r4, asr #5
diff --git a/apps/recorder/jpeg_load.c b/apps/recorder/jpeg_load.c
index 9ab42b7a9f..34d543b56e 100644
--- a/apps/recorder/jpeg_load.c
+++ b/apps/recorder/jpeg_load.c
@@ -2024,7 +2024,7 @@ int clip_jpeg_fd(int fd,
#else
struct jpeg *p_jpeg = (struct jpeg*)bm->data;
int tmp_size = maxsize;
- ALIGN_BUFFER(p_jpeg, tmp_size, sizeof(int));
+ ALIGN_BUFFER(p_jpeg, tmp_size, sizeof(long));
/* not enough memory for our struct jpeg */
if ((size_t)tmp_size < sizeof(struct jpeg))
return -1;
@@ -2133,7 +2133,7 @@ int clip_jpeg_fd(int fd,
char *buf_end = (char *)bm->data + maxsize;
maxsize = buf_end - buf_start;
#ifndef JPEG_FROM_MEM
- ALIGN_BUFFER(buf_start, maxsize, sizeof(uint32_t));
+ ALIGN_BUFFER(buf_start, maxsize, sizeof(long));
if (maxsize < (int)sizeof(struct jpeg))
return -1;
memmove(buf_start, p_jpeg, sizeof(struct jpeg));
@@ -2228,4 +2228,15 @@ int read_jpeg_fd(int fd,
}
#endif
+const size_t JPEG_DECODE_OVERHEAD =
+ /* Reserve an arbitrary amount for the decode buffer
+ * FIXME: Somebody who knows what they're doing should look at this */
+ (32 * 1024)
+#ifndef JPEG_FROM_MEM
+ /* Unless the struct jpeg is defined statically, we need to allocate
+ * it in the bitmap buffer as well */
+ + sizeof(struct jpeg)
+#endif
+ ;
+
/**************** end JPEG code ********************/
diff --git a/apps/recorder/jpeg_load.h b/apps/recorder/jpeg_load.h
index 6ff96dabad..129b0fbf19 100644
--- a/apps/recorder/jpeg_load.h
+++ b/apps/recorder/jpeg_load.h
@@ -32,6 +32,13 @@
#ifndef _JPEG_LOAD_H
#define _JPEG_LOAD_H
+/* Approximate memory overhead required for JPEG decoding. This memory is
+ * taken from the bitmap buffer so you must ensure the buffer is big enough
+ * to contain all decoded pixel data plus decoder overhead, otherwise the
+ * image cannot be loaded. After the image is loaded this extra memory can
+ * be freed. */
+extern const size_t JPEG_DECODE_OVERHEAD;
+
int read_jpeg_file(const char* filename,
struct bitmap *bm,
int maxsize,
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index b211fad331..736e9738c8 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -37,6 +37,7 @@
#include "viewport.h"
#include "file.h"
#include "splash.h"
+#include "core_alloc.h"
#ifndef O_BINARY
#define O_BINARY 0
@@ -78,8 +79,17 @@
#define CHANGED_CURSOR 2
#define CHANGED_TEXT 3
+enum ekbd_viewports
+{
+ eKBD_VP_TEXT = 0,
+ eKBD_VP_PICKER,
+ eKBD_VP_MENU,
+ eKBD_COUNT_VP_COUNT
+};
+
struct keyboard_parameters
{
+ struct viewport *kbd_viewports;
unsigned short kbd_buf[KBD_BUF_SIZE];
unsigned short *kbd_buf_ptr;
unsigned short max_line_len;
@@ -142,6 +152,71 @@ static const unsigned char morse_codes[] = {
0x73,0x55,0x4c,0x61,0x5a,0x80 };
#endif
+static void keyboard_layout(struct viewport *kbd_vp,
+ struct keyboard_parameters *pm,
+ struct screen *sc)
+{
+ /*Note: viewports are initialized to vp_default by kbd_create_viewports */
+
+ int sc_w = sc->getwidth();
+ int sc_h = sc->getheight();
+
+ /* TEXT */
+ struct viewport *vp = &kbd_vp[eKBD_VP_TEXT];
+ /* make sure height is even for the text box */
+ int text_height = (MAX(pm->font_h, get_icon_height(sc->screen_type)) & ~1) + 2;
+ vp->x = 0; /* LEFT */
+ vp->y = 0; /* TOP */
+ vp->width = sc_w;
+ vp->height = text_height;
+ vp->font = pm->curfont;
+ text_height += vp->x + 3;
+
+ /* MENU */
+ vp = &kbd_vp[eKBD_VP_MENU];
+ int menu_w = 0;//pm->font_w * MENU_CHARS; /* NOT IMPLEMENTED */
+ vp->x = 0; /* LEFT */
+#ifdef HAVE_LCD_SPLIT
+ vp->y = MAX(LCD_SPLIT_POS, text_height); /* Sansa Clip/Clip+ */
+#else
+ vp->y = text_height; /* TOP */
+#endif
+ vp->width = menu_w;
+ vp->height = 0;
+ vp->font = pm->curfont;
+ menu_w += vp->x;
+
+ /* PICKER */
+ vp = &kbd_vp[eKBD_VP_PICKER];
+ vp->x = menu_w; /* LEFT */
+#ifdef HAVE_LCD_SPLIT
+ vp->y = MAX(LCD_SPLIT_POS, text_height - 2); /* Sansa Clip/Clip+ */
+#else
+ vp->y = text_height - 2; /* TOP */
+#endif
+ vp->width = sc_w - menu_w;
+ vp->height = sc_h - vp->y; /* (MAX SIZE) - OVERWRITTEN */
+ vp->font = pm->curfont;
+}
+
+static int kbd_create_viewports(struct keyboard_parameters * kbd_param)
+{
+ static struct viewport viewports[NB_SCREENS][eKBD_COUNT_VP_COUNT];
+ int i;
+ FOR_NB_SCREENS(l)
+ {
+ kbd_param[l].kbd_viewports = viewports[l];
+ for (i = 0; i < eKBD_COUNT_VP_COUNT; i++)
+ {
+ struct viewport *vp = &kbd_param[l].kbd_viewports[i];
+ viewport_set_defaults(vp, l);
+ vp->font = FONT_UI;
+ }
+ }
+
+ return sizeof(viewports);
+}
+
/* Loads a custom keyboard into memory
call with NULL to reset keyboard */
int load_kbd(unsigned char* filename)
@@ -309,8 +384,9 @@ static unsigned short get_kbd_ch(struct keyboard_parameters *pm, int x, int y)
k = k * pm->max_chars + x;
return (*pbuf != 0xFEFF && k < *pbuf)? pbuf[k+1]: ' ';
}
-
-static void kbd_calc_params(struct keyboard_parameters *pm,
+static void kbd_calc_pm_params(struct keyboard_parameters *pm,
+ struct screen *sc, struct edit_state *state);
+static void kbd_calc_vp_params(struct keyboard_parameters *pm,
struct screen *sc, struct edit_state *state);
static void kbd_draw_picker(struct keyboard_parameters *pm,
struct screen *sc, struct edit_state *state);
@@ -342,6 +418,18 @@ int kbd_input(char* text, int buflen, unsigned short *kbd)
viewportmanager_theme_enable(l, false, NULL);
}
+ if (kbd_create_viewports(param) <= 0)
+ {
+ splash(HZ * 2,"Error: No Viewport Allocated, OOM?");
+ goto cleanup;
+ }
+
+#ifdef HAVE_TOUCHSCREEN
+ /* keyboard is unusuable in pointing mode so force 3x3 for now.
+ * TODO - fix properly by using a bigger font and changing the layout */
+ enum touchscreen_mode old_mode = touchscreen_get_mode();
+ touchscreen_set_mode(TOUCHSCREEN_BUTTON);
+#endif
/* initialize state */
state.text = text;
state.buflen = buflen;
@@ -436,7 +524,15 @@ int kbd_input(char* text, int buflen, unsigned short *kbd)
pm->kbd_buf_ptr = pm->kbd_buf; /* internal layout buffer */
struct screen *sc = &screens[l];
- kbd_calc_params(pm, sc, &state);
+
+ kbd_calc_pm_params(pm, sc, &state);
+
+ keyboard_layout(pm->kbd_viewports, pm, sc);
+ /* have all the params we need lets set up our viewports */
+ kbd_calc_vp_params(pm, sc, &state);
+ /* We want these the same height */
+ pm->kbd_viewports[eKBD_VP_MENU].height = pm->main_y;
+ pm->kbd_viewports[eKBD_VP_PICKER].height = pm->main_y;
}
if (global_settings.talk_menu) /* voice UI? */
@@ -461,8 +557,8 @@ int kbd_input(char* text, int buflen, unsigned short *kbd)
{
/* declare scoped pointers inside screen loops - hide the
declarations from previous block level */
- struct keyboard_parameters *pm = &param[l];
struct screen *sc = &screens[l];
+ pm = &param[l];
sc->clear_display();
kbd_draw_picker(pm, sc, &state);
kbd_draw_edit_line(pm, sc, &state);
@@ -680,6 +776,10 @@ int kbd_input(char* text, int buflen, unsigned short *kbd)
if (ret < 0)
splash(HZ/2, ID2P(LANG_CANCEL));
+#ifdef HAVE_TOUCHSCREEN
+ touchscreen_set_mode(old_mode);
+#endif
+
#if defined(HAVE_MORSE_INPUT) && defined(KBD_TOGGLE_INPUT)
if (global_settings.morse_input != state.morse_mode)
{
@@ -687,7 +787,7 @@ int kbd_input(char* text, int buflen, unsigned short *kbd)
settings_save();
}
#endif /* HAVE_MORSE_INPUT && KBD_TOGGLE_INPUT */
-
+cleanup:
FOR_NB_SCREENS(l)
{
screens[l].setfont(FONT_UI);
@@ -695,18 +795,14 @@ int kbd_input(char* text, int buflen, unsigned short *kbd)
}
return ret;
}
-
-static void kbd_calc_params(struct keyboard_parameters *pm,
+static void kbd_calc_pm_params(struct keyboard_parameters *pm,
struct screen *sc, struct edit_state *state)
{
struct font* font;
const unsigned char *p;
unsigned short ch, *pbuf;
- int icon_w, sc_w, sc_h, w;
- int i, total_lines;
+ int i, w;
#ifdef HAVE_TOUCHSCREEN
- int button_h = 0;
- bool flippage_button = false;
pm->show_buttons = (sc->screen_type == SCREEN_MAIN &&
(touchscreen_get_mode() == TOUCHSCREEN_POINT));
#endif
@@ -754,9 +850,21 @@ static void kbd_calc_params(struct keyboard_parameters *pm,
#ifdef HAVE_TOUCHSCREEN
pm->font_w = GRID_SIZE(sc->screen_type, pm->font_w);
#endif
+
+}
+
+static void kbd_calc_vp_params(struct keyboard_parameters *pm,
+ struct screen *sc, struct edit_state *state)
+{
+ (void) state;
+ struct viewport *vp = &pm->kbd_viewports[eKBD_VP_PICKER];
+ int icon_w, sc_w, sc_h;
+ int i, total_lines;
+ unsigned short *pbuf;
/* calculate how many characters to put in a row. */
icon_w = get_icon_width(sc->screen_type);
- sc_w = sc->getwidth();
+
+ sc_w = vp->width; /**sc->getwidth();**/
if (pm->font_w < sc_w / pm->max_line_len)
pm->font_w = sc_w / pm->max_line_len;
pm->max_chars = sc_w / pm->font_w;
@@ -765,8 +873,10 @@ static void kbd_calc_params(struct keyboard_parameters *pm,
pm->max_chars_text = sc_w / pm->text_w - 2;
/* calculate pm->pages and pm->lines */
- sc_h = sc->getheight();
+ sc_h = vp->height;/**sc->getheight()**/;
#ifdef HAVE_TOUCHSCREEN
+ int button_h = 0;
+ bool flippage_button = false;
/* add space for buttons */
if (pm->show_buttons)
{
@@ -813,7 +923,7 @@ recalc_param:
pm->main_y = pm->font_h*pm->lines + pm->keyboard_margin;
pm->keyboard_margin -= pm->keyboard_margin/2;
#ifdef HAVE_TOUCHSCREEN
- /* flip page button is put between piker and edit line */
+ /* flip page button is put between picker and edit line */
if (flippage_button)
pm->main_y += button_h;
#endif
@@ -832,13 +942,18 @@ recalc_param:
static void kbd_draw_picker(struct keyboard_parameters *pm,
struct screen *sc, struct edit_state *state)
{
+ struct viewport *last;
+ struct viewport *vp = &pm->kbd_viewports[eKBD_VP_PICKER];
+ last = sc->set_viewport(vp);
+ sc->clear_viewport();
+
char outline[8];
#ifdef HAVE_MORSE_INPUT
if (state->morse_mode)
{
const int w = 6, h = 8; /* sysfixed font width, height */
int i, j, x, y;
- int sc_w = sc->getwidth(), sc_h = pm->main_y - pm->keyboard_margin - 1;
+ int sc_w = vp->width, sc_h = vp->height;//pm->main_y - pm->keyboard_margin - 1;
/* Draw morse code screen with sysfont */
sc->setfont(FONT_SYSFIXED);
@@ -915,6 +1030,7 @@ static void kbd_draw_picker(struct keyboard_parameters *pm,
sc->set_drawmode(DRMODE_SOLID);
}
}
+ sc->set_viewport(last);
}
static void kbd_draw_edit_line(struct keyboard_parameters *pm,
@@ -922,37 +1038,49 @@ static void kbd_draw_edit_line(struct keyboard_parameters *pm,
{
char outline[8];
unsigned char *utf8;
- int i = 0, j = 0, icon_w, w;
- int sc_w = sc->getwidth();
- int y = pm->main_y - pm->keyboard_margin;
+ int i = 0, j = 0, w;
+ int icon_w, icon_y;
+ struct viewport *last;
+ struct viewport *vp = &pm->kbd_viewports[eKBD_VP_TEXT];
+ last = sc->set_viewport(vp);
+ sc->clear_viewport();
+ sc->hline(1, vp->width - 1, vp->height - 1);
+
+ int sc_w = vp->width;
+ int y = (vp->height - pm->font_h) / 2;
+
+
int text_margin = (sc_w - pm->text_w * pm->max_chars_text) / 2;
+#if 0
/* Clear text area one pixel above separator line so any overdraw
doesn't collide */
screen_clear_area(sc, 0, y - 1, sc_w, pm->font_h + 6);
sc->hline(0, sc_w - 1, y);
-
+#endif
/* write out the text */
sc->setfont(pm->curfont);
pm->leftpos = MAX(0, MIN(state->len_utf8, state->editpos + 2)
- pm->max_chars_text);
+
pm->curpos = state->editpos - pm->leftpos;
utf8 = state->text + utf8seek(state->text, pm->leftpos);
while (*utf8 && i < pm->max_chars_text)
{
j = utf8seek(utf8, 1);
- strlcpy(outline, utf8, j+1);
+ strmemccpy(outline, utf8, j+1);
sc->getstringsize(outline, &w, NULL);
sc->putsxy(text_margin + i*pm->text_w + (pm->text_w-w)/2,
- pm->main_y, outline);
+ y, outline);
utf8 += j;
i++;
}
icon_w = get_icon_width(sc->screen_type);
+ icon_y = (vp->height - get_icon_height(sc->screen_type)) / 2;
if (pm->leftpos > 0)
{
/* Draw nicer bitmap arrow if room, else settle for "<". */
@@ -960,12 +1088,12 @@ static void kbd_draw_edit_line(struct keyboard_parameters *pm,
{
screen_put_icon_with_offset(sc, 0, 0,
(text_margin - icon_w) / 2,
- pm->main_y, Icon_Reverse_Cursor);
+ icon_y, Icon_Reverse_Cursor);
}
else
{
sc->getstringsize("<", &w, NULL);
- sc->putsxy(text_margin - w, pm->main_y, "<");
+ sc->putsxy(text_margin - w, y, "<");
}
}
@@ -976,11 +1104,11 @@ static void kbd_draw_edit_line(struct keyboard_parameters *pm,
{
screen_put_icon_with_offset(sc, 0, 0,
sc_w - (text_margin + icon_w) / 2,
- pm->main_y, Icon_Cursor);
+ icon_y, Icon_Cursor);
}
else
{
- sc->putsxy(sc_w - text_margin, pm->main_y, ">");
+ sc->putsxy(sc_w - text_margin, y, ">");
}
}
@@ -988,17 +1116,19 @@ static void kbd_draw_edit_line(struct keyboard_parameters *pm,
i = text_margin + pm->curpos * pm->text_w;
if (state->cur_blink)
- sc->vline(i, pm->main_y, pm->main_y + pm->font_h - 1);
+ sc->vline(i, y, y + pm->font_h - 1);
if (state->hangul) /* draw underbar */
- sc->hline(i - pm->text_w, i, pm->main_y + pm->font_h - 1);
+ sc->hline(i - pm->text_w, i, y + pm->font_h - 1);
if (pm->line_edit)
{
sc->set_drawmode(DRMODE_COMPLEMENT);
- sc->fillrect(0, y + 2, sc_w, pm->font_h + 2);
+ sc->fillrect(0, y - 1, sc_w, pm->font_h + 2);
sc->set_drawmode(DRMODE_SOLID);
}
+
+ sc->set_viewport(last);
}
#ifdef HAVE_TOUCHSCREEN
@@ -1215,16 +1345,18 @@ static void kbd_move_cursor(struct edit_state *state, int dir)
{
state->changed = CHANGED_CURSOR;
}
- else if (state->editpos > state->len_utf8)
+ else if (global_settings.list_wraparound && state->editpos > state->len_utf8)
{
state->editpos = 0;
if (global_settings.talk_menu) beep_play(1000, 150, 1500);
}
- else if (state->editpos < 0)
+ else if (global_settings.list_wraparound && state->editpos < 0)
{
state->editpos = state->len_utf8;
if (global_settings.talk_menu) beep_play(1000, 150, 1500);
}
+ else if (!global_settings.list_wraparound)
+ state->editpos -= dir;
}
static void kbd_move_picker_horizontal(struct keyboard_parameters *pm,
@@ -1235,12 +1367,22 @@ static void kbd_move_picker_horizontal(struct keyboard_parameters *pm,
pm->x += dir;
if (pm->x < 0)
{
+ if (!global_settings.list_wraparound && pm->page == 0)
+ {
+ pm->x = 0;
+ return;
+ }
if (--pm->page < 0)
pm->page = pm->pages - 1;
pm->x = pm->max_chars - 1;
}
else if (pm->x >= pm->max_chars)
{
+ if (!global_settings.list_wraparound && pm->page == pm->pages - 1)
+ {
+ pm->x = pm->max_chars - 1;
+ return;
+ }
if (++pm->page >= pm->pages)
pm->page = 0;
pm->x = 0;
@@ -1261,6 +1403,38 @@ static void kbd_move_picker_vertical(struct keyboard_parameters *pm,
#endif /* HAVE_MORSE_INPUT */
pm->y += dir;
+
+ if (!global_settings.list_wraparound)
+ {
+#if 0 /* edit line below picker */
+ if (pm->y >= pm->lines)
+ {
+ pm->y = pm->lines;
+ pm->line_edit = true;
+ }
+ else if (pm->y < 0)
+ pm->y = 0;
+ else if (pm->line_edit)
+ pm->line_edit = false;
+#else /* edit line above picker */
+ if (pm->y >= pm->lines)
+ {
+ pm->y = pm->lines;
+ }
+ else if (pm->y < 0)
+ {
+ pm->line_edit = true;
+ pm->y = 0;
+ }
+ else if (pm->line_edit)
+ {
+ pm->line_edit = false;
+ pm->y = 0;
+ }
+#endif
+ return;
+ }
+
if (pm->line_edit)
{
pm->y = (dir > 0 ? 0 : pm->lines - 1);
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c
index 9b0e779485..8dc2c150fd 100644
--- a/apps/recorder/pcm_record.c
+++ b/apps/recorder/pcm_record.c
@@ -878,53 +878,37 @@ copy_buffer_mono_lr(void *dst, const void *src, size_t src_size)
ssize_t copy_size = src_size;
/* mono = (L + R) / 2 */
- do
- {
- *d++ = ((int32_t){s[0]} + s[1] + 1) >> 1;
- s+=2;
+ while(copy_size > 0) {
+ *d++ = ((int32_t)s[0] + (int32_t)s[1] + 1) >> 1;
+ s += 2;
+ copy_size -= PCM_SAMP_SIZE;
}
- while ((copy_size -= PCM_SAMP_SIZE) > 0);
return dst;
}
-/* Copy with mono conversion - output 1/2 size of input */
static void * ICODE_ATTR
-copy_buffer_mono_r(void *dst, const void *src, size_t src_size)
+copy_buffer_mono_l(void *dst, const void *src, size_t src_size)
{
- int16_t *d = (int16_t*)dst;
- int16_t const *s = (int16_t const*)src - 1;
+ int16_t *d = (int16_t*) dst;
+ int16_t const *s = (int16_t const*) src;
ssize_t copy_size = src_size;
- /* mono = R */
- do
- *d++ = *(s += 2);
- while ((copy_size -= PCM_SAMP_SIZE) > 0);
+
+ /* mono = L */
+ while(copy_size > 0) {
+ *d++ = *s;
+ s += 2;
+ copy_size -= PCM_SAMP_SIZE;
+ }
return dst;
}
-#if 1
-static void * ICODE_ATTR
-copy_buffer_mono_l(void *dst, const void *src, size_t src_size)
-{
- return copy_buffer_mono_r(dst, src -1, src_size);
-}
-#else
-/* Copy with mono conversion - output 1/2 size of input */
static void * ICODE_ATTR
-copy_buffer_mono_l(void *dst, const void *src, size_t src_size)
+copy_buffer_mono_r(void *dst, const void *src, size_t src_size)
{
- int16_t *d = (int16_t*)dst;
- int16_t const *s = (int16_t const*)src - 2;
- ssize_t copy_size = src_size;
- /* mono = L */
- do
- *d++ = *(s += 2);
- while ((copy_size -= PCM_SAMP_SIZE) > 0);
-
- return dst;
+ return copy_buffer_mono_l(dst, src + 2, src_size);
}
-#endif
/** pcm_rec_* group **/
@@ -1368,7 +1352,7 @@ static void mark_stream(const char *path, enum mark_stream_action action)
file->hdr.type = CHUNK_T_STREAM_START;
file->hdr.size = count;
- strlcpy(file->path, path, MAX_PATH);
+ strmemccpy(file->path, path, MAX_PATH);
}
}
@@ -1422,12 +1406,9 @@ static int pcmrec_handle;
static void on_init_recording(void)
{
send_event(RECORDING_EVENT_START, NULL);
- /* dummy ops with no callbacks, needed because by
- * default buflib buffers can be moved around which must be avoided
- * FIXME: This buffer should play nicer and be shrinkable/movable */
- static struct buflib_callbacks dummy_ops;
+ /* FIXME: This buffer should play nicer and be shrinkable/movable */
talk_buffer_set_policy(TALK_BUFFER_LOOSE);
- pcmrec_handle = core_alloc_maximum("pcmrec", &rec_buffer_size, &dummy_ops);
+ pcmrec_handle = core_alloc_maximum(&rec_buffer_size, &buflib_ops_locked);
if (pcmrec_handle <= 0)
/* someone is abusing core_alloc_maximum(). Fix this evil guy instead of
* trying to handle OOM without hope */
@@ -1456,8 +1437,7 @@ static void on_close_recording(void)
audio_set_output_source(AUDIO_SRC_PLAYBACK);
pcm_apply_settings();
- if (pcmrec_handle > 0)
- pcmrec_handle = core_free(pcmrec_handle);
+ pcmrec_handle = core_free(pcmrec_handle);
talk_buffer_set_policy(TALK_BUFFER_DEFAULT);
send_event(RECORDING_EVENT_STOP, NULL);
@@ -1602,7 +1582,7 @@ static void on_record(const char *filename)
/* Copy path and let caller go */
char path[MAX_PATH];
- strlcpy(path, filename, MAX_PATH);
+ strmemccpy(path, filename, MAX_PATH);
queue_reply(&audio_queue, 0);
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 900bb6d7c3..c9e92b5762 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -58,6 +58,8 @@ static int pm_max_right;
#if defined(HAVE_AGC) || defined(HAVE_HISTOGRAM)
static int pm_peakhold_left; /* max. peak values between peakhold calls */
static int pm_peakhold_right; /* used for AGC and histogram display */
+#endif
+#ifdef HAVE_HISTOGRAM
static long next_histogram_update;
#endif
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index bf69e8f781..6c52adf5d3 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -68,7 +68,9 @@
#include "splash.h"
#include "screen_access.h"
#include "action.h"
-#include "radio.h"
+#ifdef HAVE_FMRADIO_REC
+# include "radio.h"
+#endif
#include "viewport.h"
#include "list.h"
#include "general.h"
@@ -187,6 +189,7 @@ static short balance_mem[BAL_MEM_SIZE];
#define AGC_MODE_SIZE 5
#define AGC_SAFETY_MODE 0
+/* Note iriver devices overwrite these strings */
static const char* agc_preset_str[] =
{ "Off", "S", "L", "D", "M", "V" };
/* "Off",
@@ -233,9 +236,9 @@ static long hist_time = 0;
static void set_gain(void)
{
+ switch(global_settings.rec_source) {
#ifdef HAVE_MIC_REC
- if(global_settings.rec_source == AUDIO_SRC_MIC)
- {
+ case AUDIO_SRC_MIC:
if (global_settings.rec_mic_gain > sound_max(SOUND_MIC_GAIN))
global_settings.rec_mic_gain = sound_max(SOUND_MIC_GAIN);
@@ -244,10 +247,11 @@ static void set_gain(void)
audio_set_recording_gain(global_settings.rec_mic_gain,
0, AUDIO_GAIN_MIC);
- }
- else
+ break;
#endif /* MIC */
- {
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
+ HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:)
+ HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:)
if (global_settings.rec_left_gain > sound_max(SOUND_LEFT_GAIN))
global_settings.rec_left_gain = sound_max(SOUND_LEFT_GAIN);
@@ -260,11 +264,13 @@ static void set_gain(void)
if (global_settings.rec_right_gain < sound_min(SOUND_RIGHT_GAIN))
global_settings.rec_right_gain = sound_min(SOUND_RIGHT_GAIN);
- /* AUDIO_SRC_LINEIN, AUDIO_SRC_FMRADIO, AUDIO_SRC_SPDIF */
audio_set_recording_gain(global_settings.rec_left_gain,
global_settings.rec_right_gain,
AUDIO_GAIN_LINEIN);
+ break;
+#endif
}
+
/* reset the clipping indicators */
peak_meter_set_clip_hold(global_settings.peak_meter_clip_hold);
update_list = true;
@@ -332,6 +338,11 @@ static bool agc_gain_is_max(bool left, bool right)
static void change_recording_gain(bool increment, bool left, bool right)
{
+#if !defined(HAVE_LINE_REC) || !defined(HAVE_FMRADIO_REC)
+ (void)left;
+ (void)right;
+#endif
+
int factor = (increment ? 1 : -1);
switch (global_settings.rec_source)
@@ -729,43 +740,24 @@ static void trigger_listener(int trigger_status)
/* Stuff for drawing the screen */
enum rec_list_items_stereo {
- ITEM_VOLUME = 0,
- ITEM_GAIN = 1,
- ITEM_GAIN_L = 2,
- ITEM_GAIN_R = 3,
-#ifdef HAVE_AGC
- ITEM_AGC_MODE = 4,
- ITEM_AGC_MAXDB = 5,
- ITEM_FILENAME = 7,
- ITEM_COUNT = 7,
-#else
- ITEM_FILENAME = 7,
- ITEM_COUNT = 5,
+#ifndef HAVE_RECORDING_WITHOUT_MONITORING
+ ITEM_VOLUME,
+#endif
+ ITEM_GAIN,
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
+ ITEM_GAIN_L,
+ ITEM_GAIN_R,
#endif
-};
-
-enum rec_list_items_mono {
- ITEM_VOLUME_M = 0,
- ITEM_GAIN_M = 1,
#ifdef HAVE_AGC
- ITEM_AGC_MODE_M = 4,
- ITEM_AGC_MAXDB_M = 5,
- ITEM_FILENAME_M = 7,
- ITEM_COUNT_M = 5,
-#else
- ITEM_FILENAME_M = 7,
- ITEM_COUNT_M = 3,
+ ITEM_AGC_MODE,
+ ITEM_AGC_MAXDB,
#endif
-};
-
#ifdef HAVE_SPDIF_REC
-enum rec_list_items_spdif {
- ITEM_VOLUME_D = 0,
- ITEM_SAMPLERATE_D = 6,
- ITEM_FILENAME_D = 7,
- ITEM_COUNT_D = 3,
-};
+ ITEM_SAMPLERATE,
#endif
+ ITEM_FILENAME,
+ ITEM_COUNT,
+};
static int listid_to_enum[ITEM_COUNT];
@@ -782,33 +774,39 @@ static const char* reclist_get_name(int selected_item, void * data,
switch (listid_to_enum[selected_item])
{
+#ifndef HAVE_RECORDING_WITHOUT_MONITORING
case ITEM_VOLUME:
snprintf(buffer, buffer_len, "%s: %s", str(LANG_VOLUME),
fmt_gain(SOUND_VOLUME,
global_settings.volume,
buf2, sizeof(buf2)));
break;
+#endif
case ITEM_GAIN:
+ switch(global_settings.rec_source) {
#ifdef HAVE_MIC_REC
- if(global_settings.rec_source == AUDIO_SRC_MIC)
- {
+ case AUDIO_SRC_MIC:
/* Draw MIC recording gain */
snprintf(buffer, buffer_len, "%s: %s", str(LANG_GAIN),
fmt_gain(SOUND_MIC_GAIN,
global_settings.rec_mic_gain,
buf2, sizeof(buf2)));
- }
- else
+ break;
#endif /* MIC */
- {
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
+ HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:)
+ HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:) {
int avg_gain = (global_settings.rec_left_gain +
global_settings.rec_right_gain) / 2;
snprintf(buffer, buffer_len, "%s: %s", str(LANG_GAIN),
fmt_gain(SOUND_LEFT_GAIN,
avg_gain,
buf2, sizeof(buf2)));
+ } break;
+#endif
}
break;
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
case ITEM_GAIN_L:
snprintf(buffer, buffer_len, "%s: %s",
str(LANG_GAIN_LEFT),
@@ -823,42 +821,46 @@ static const char* reclist_get_name(int selected_item, void * data,
global_settings.rec_right_gain,
buf2, sizeof(buf2)));
break;
+#endif
#ifdef HAVE_AGC
case ITEM_AGC_MODE:
snprintf(buffer, buffer_len, "%s: %s",
str(LANG_RECORDING_AGC_PRESET),
agc_preset_str[agc_preset]);
break;
- case ITEM_AGC_MAXDB:
- if (agc_preset == 0)
+ case ITEM_AGC_MAXDB: {
+ int bias, which;
+ switch(global_settings.rec_source) {
+ default:
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
+ HAVE_LINE_IN_(case AUDIO_SRC_LINEIN:)
+ HAVE_FMRADIO_IN_(case AUDIO_SRC_FMRADIO:)
+ which = SOUND_LEFT_GAIN;
+ bias = (global_settings.rec_left_gain + global_settings.rec_right_gain) / 2;
+ break;
+#endif
+#if defined(HAVE_MIC_REC)
+ case AUDIO_SRC_MIC:
+ which = SOUND_MIC_GAIN;
+ bias = global_settings.rec_mic_gain;
+ break;
+#endif /* MIC*/
+ }
+
+ if(agc_preset == 0) {
snprintf(buffer, buffer_len, "%s: %s",
str(LANG_RECORDING_AGC_MAXGAIN),
- fmt_gain(SOUND_LEFT_GAIN,
- agc_maxgain, buf2, sizeof(buf2)));
-#ifdef HAVE_MIC_REC
- else if (global_settings.rec_source == AUDIO_SRC_MIC)
+ fmt_gain(which, agc_maxgain, buf2, sizeof(buf2)));
+ } else {
snprintf(buffer, buffer_len, "%s: %s (%s)",
str(LANG_RECORDING_AGC_MAXGAIN),
- fmt_gain(SOUND_MIC_GAIN,
- agc_maxgain, buf2, sizeof(buf2)),
- fmt_gain(SOUND_MIC_GAIN,
- agc_maxgain - global_settings.rec_mic_gain,
- buf3, sizeof(buf3)));
- else
-#endif /* MIC */
- snprintf(buffer, buffer_len, "%s: %s (%s)",
- str(LANG_RECORDING_AGC_MAXGAIN),
- fmt_gain(SOUND_LEFT_GAIN,
- agc_maxgain, buf2, sizeof(buf2)),
- fmt_gain(SOUND_LEFT_GAIN,
- agc_maxgain -
- (global_settings.rec_left_gain +
- global_settings.rec_right_gain)/2,
- buf3, sizeof(buf3)));
- break;
+ fmt_gain(which, agc_maxgain, buf2, sizeof(buf2)),
+ fmt_gain(which, agc_maxgain - bias, buf3, sizeof(buf3)));
+ }
+ } break;
#endif
#ifdef HAVE_SPDIF_REC
- case ITEM_SAMPLERATE_D:
+ case ITEM_SAMPLERATE:
snprintf(buffer, buffer_len, "%s: %lu",
str(LANG_FREQUENCY), pcm_rec_sample_rate());
break;
@@ -902,12 +904,14 @@ static void recording_step_levels(int setting_id, int steps)
global_settings.volume += steps;
setvol();
break;
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
case SOUND_LEFT_GAIN:
global_settings.rec_left_gain += steps;
break;
case SOUND_RIGHT_GAIN:
global_settings.rec_right_gain += steps;
break;
+#endif
#ifdef HAVE_MIC_REC
case SOUND_MIC_GAIN:
global_settings.rec_mic_gain += steps;
@@ -1150,46 +1154,41 @@ bool recording_screen(bool no_source)
set_gain();
update_countdown = 0; /* Update immediately */
+ int listi = 0;
+
/* populate translation table for list id -> enum */
#ifdef HAVE_SPDIF_REC
if(global_settings.rec_source == AUDIO_SRC_SPDIF)
{
- listid_to_enum[0] = ITEM_VOLUME_D;
- listid_to_enum[1] = ITEM_SAMPLERATE_D;
- listid_to_enum[2] = ITEM_FILENAME_D;
+#ifndef HAVE_RECORDING_WITHOUT_MONITORING
+ listid_to_enum[listi++] = ITEM_VOLUME;
+#endif
+ listid_to_enum[listi++] = ITEM_SAMPLERATE;
+ listid_to_enum[listi++] = ITEM_FILENAME;
- gui_synclist_set_nb_items(&lists, ITEM_COUNT_D); /* spdif */
+ gui_synclist_set_nb_items(&lists, listi); /* spdif */
}
else
#endif
- if(HAVE_MIC_REC_((global_settings.rec_source == AUDIO_SRC_MIC) || )
- (global_settings.rec_channels == 1))
{
- listid_to_enum[0] = ITEM_VOLUME_M;
- listid_to_enum[1] = ITEM_GAIN_M;
-#ifdef HAVE_AGC
- listid_to_enum[2] = ITEM_AGC_MODE_M;
- listid_to_enum[3] = ITEM_AGC_MAXDB_M;
- listid_to_enum[4] = ITEM_FILENAME_M;
-#else
- listid_to_enum[2] = ITEM_FILENAME_M;
+#ifndef HAVE_RECORDING_WITHOUT_MONITORING
+ listid_to_enum[listi++] = ITEM_VOLUME;
+#endif
+ listid_to_enum[listi++] = ITEM_GAIN;
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
+ if(HAVE_MIC_REC_((global_settings.rec_source != AUDIO_SRC_MIC) || )
+ (global_settings.rec_channels != 1)) {
+ listid_to_enum[listi++] = ITEM_GAIN_L;
+ listid_to_enum[listi++] = ITEM_GAIN_R;
+ }
#endif
- gui_synclist_set_nb_items(&lists, ITEM_COUNT_M); /* mono */
- }
- else
- {
- listid_to_enum[0] = ITEM_VOLUME;
- listid_to_enum[1] = ITEM_GAIN;
- listid_to_enum[2] = ITEM_GAIN_L;
- listid_to_enum[3] = ITEM_GAIN_R;
#ifdef HAVE_AGC
- listid_to_enum[4] = ITEM_AGC_MODE;
- listid_to_enum[5] = ITEM_AGC_MAXDB;
- listid_to_enum[6] = ITEM_FILENAME;
-#else
- listid_to_enum[4] = ITEM_FILENAME;
+ listid_to_enum[listi++] = ITEM_AGC_MODE;
+ listid_to_enum[listi++] = ITEM_AGC_MAXDB;
#endif
- gui_synclist_set_nb_items(&lists, ITEM_COUNT); /* stereo */
+ listid_to_enum[listi++] = ITEM_FILENAME;
+
+ gui_synclist_set_nb_items(&lists, listi); /* stereo */
}
gui_synclist_draw(&lists);
@@ -1266,7 +1265,7 @@ bool recording_screen(bool no_source)
}
/* let list handle the button */
- gui_synclist_do_button(&lists, &button, LIST_WRAP_UNLESS_HELD);
+ gui_synclist_do_button(&lists, &button);
switch(button)
@@ -1275,26 +1274,35 @@ bool recording_screen(bool no_source)
case ACTION_SETTINGS_INCREPEAT:
switch (listid_to_enum[gui_synclist_get_sel_pos(&lists)])
{
+#ifndef HAVE_RECORDING_WITHOUT_MONITORING
case ITEM_VOLUME:
recording_step_levels(SOUND_VOLUME, 1);
break;
+#endif
case ITEM_GAIN:
+ switch(global_settings.rec_source) {
#ifdef HAVE_MIC_REC
- if(global_settings.rec_source == AUDIO_SRC_MIC)
+ case AUDIO_SRC_MIC:
recording_step_levels(SOUND_MIC_GAIN, 1);
- else
+ break;
#endif /* MIC */
- {
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
+ HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:)
+ HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:)
recording_step_levels(SOUND_LEFT_GAIN, 1);
recording_step_levels(SOUND_RIGHT_GAIN, 1);
+ break;
+#endif
}
break;
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
case ITEM_GAIN_L:
recording_step_levels(SOUND_LEFT_GAIN, 1);
break;
case ITEM_GAIN_R:
recording_step_levels(SOUND_RIGHT_GAIN, 1);
break;
+#endif
#ifdef HAVE_AGC
case ITEM_AGC_MODE:
agc_preset = MIN(agc_preset + 1, AGC_MODE_SIZE);
@@ -1311,19 +1319,22 @@ bool recording_screen(bool no_source)
}
break;
case ITEM_AGC_MAXDB:
+ switch(global_settings.rec_source) {
+#if defined(HAVE_LINE_IN) || defined(HAVE_FMRADIO_IN)
+ HAVE_LINE_IN_(case AUDIO_SRC_LINEIN:)
+ HAVE_FMRADIO_IN_(case AUDIO_SRC_FMRADIO:)
+ agc_maxgain = MIN(agc_maxgain + 1,
+ sound_max(SOUND_LEFT_GAIN));
+ global_settings.rec_agc_maxgain_line = agc_maxgain;
+ break;
+#endif
#ifdef HAVE_MIC_REC
- if (global_settings.rec_source == AUDIO_SRC_MIC)
- {
+ case AUDIO_SRC_MIC:
agc_maxgain = MIN(agc_maxgain + 1,
sound_max(SOUND_MIC_GAIN));
global_settings.rec_agc_maxgain_mic = agc_maxgain;
- }
- else
+ break;
#endif /* MIC */
- {
- agc_maxgain = MIN(agc_maxgain + 1,
- sound_max(SOUND_LEFT_GAIN));
- global_settings.rec_agc_maxgain_line = agc_maxgain;
}
break;
#endif /* HAVE_AGC */
@@ -1335,26 +1346,35 @@ bool recording_screen(bool no_source)
case ACTION_SETTINGS_DECREPEAT:
switch (listid_to_enum[gui_synclist_get_sel_pos(&lists)])
{
+#ifndef HAVE_RECORDING_WITHOUT_MONITORING
case ITEM_VOLUME:
recording_step_levels(SOUND_VOLUME, -1);
break;
+#endif
case ITEM_GAIN:
+ switch(global_settings.rec_source) {
#ifdef HAVE_MIC_REC
- if(global_settings.rec_source == AUDIO_SRC_MIC)
+ case AUDIO_SRC_MIC:
recording_step_levels(SOUND_MIC_GAIN, -1);
- else
+ break;
#endif /* MIC */
- {
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
+ HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:)
+ HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:)
recording_step_levels(SOUND_LEFT_GAIN, -1);
recording_step_levels(SOUND_RIGHT_GAIN, -1);
+ break;
+#endif
}
break;
+#if defined(HAVE_LINE_REC) || defined(HAVE_FMRADIO_REC)
case ITEM_GAIN_L:
recording_step_levels(SOUND_LEFT_GAIN, -1);
break;
case ITEM_GAIN_R:
recording_step_levels(SOUND_RIGHT_GAIN, -1);
break;
+#endif
#ifdef HAVE_AGC
case ITEM_AGC_MODE:
agc_preset = MAX(agc_preset - 1, 0);
@@ -1371,18 +1391,22 @@ bool recording_screen(bool no_source)
}
break;
case ITEM_AGC_MAXDB:
+ switch(global_settings.rec_source) {
+#if defined(HAVE_LINE_IN) || defined(HAVE_FMRADIO_IN)
+ HAVE_LINE_IN_(case AUDIO_SRC_LINEIN:)
+ HAVE_FMRADIO_IN_(case AUDIO_SRC_FMRADIO:)
+ agc_maxgain = MAX(agc_maxgain - 1,
+ sound_min(SOUND_LEFT_GAIN));
+ global_settings.rec_agc_maxgain_line = agc_maxgain;
+ break;
+#endif
#ifdef HAVE_MIC_REC
- if (global_settings.rec_source == AUDIO_SRC_MIC)
- {
+ case AUDIO_SRC_MIC:
agc_maxgain = MAX(agc_maxgain - 1,
sound_min(SOUND_MIC_GAIN));
global_settings.rec_agc_maxgain_mic = agc_maxgain;
- } else
+ break;
#endif /* MIC */
- {
- agc_maxgain = MAX(agc_maxgain - 1,
- sound_min(SOUND_LEFT_GAIN));
- global_settings.rec_agc_maxgain_line = agc_maxgain;
}
break;
#endif /* HAVE_AGC */
@@ -1511,7 +1535,8 @@ bool recording_screen(bool no_source)
break;
case SYS_POWEROFF:
- default_event_handler(SYS_POWEROFF);
+ case SYS_REBOOT:
+ default_event_handler(button);
done = true;
break;
diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c
index 6f561039c3..c16cec9dc9 100644
--- a/apps/recorder/resize.c
+++ b/apps/recorder/resize.c
@@ -593,7 +593,7 @@ static inline bool scale_v_linear(struct rowset *rset,
static void output_row_32_native_fromyuv(uint32_t row, void * row_in,
struct scaler_context *ctx)
{
-#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
+#if LCD_STRIDEFORMAT == VERTICAL_STRIDE
#define DEST_STEP (ctx->bm->height)
#define Y_STEP (1)
#else