Index: apps/recorder/peakmeter.h =================================================================== --- apps/recorder/peakmeter.h (revision 18116) +++ apps/recorder/peakmeter.h (working copy) @@ -35,8 +35,8 @@ extern bool peak_meter_enabled; extern void peak_meter_playback(bool playback); -extern int peak_meter_draw_get_btn(int action_context, int x, int y[], - int height, int nb_screens); +extern int peak_meter_draw_get_btn(int action_context, int x[], int y[], + int height[], int nb_screens); extern void peak_meter_set_clip_hold(int time); extern void peak_meter_peek(void); extern void peak_meter_init_range( bool dbfs, int range_min, int range_max); Index: apps/recorder/recording.c =================================================================== --- apps/recorder/recording.c (revision 18116) +++ apps/recorder/recording.c (working copy) @@ -71,6 +71,7 @@ #include "radio.h" #include "sound_menu.h" #include "viewport.h" +#include "list.h" #ifdef HAVE_RECORDING /* This array holds the record timer interval lengths, in seconds */ @@ -164,7 +165,7 @@ return (rec_status & RCSTAT_IN_RECSCREEN) != 0; } -#define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1) +//#define PM_HEIGHT ((LCD_HEIGHT >= 72) ? 2 : 1) #if CONFIG_KEYPAD == RECORDER_PAD static bool f2_rec_screen(void); @@ -541,6 +542,7 @@ return str; } +#if 0 static int cursor; static void adjust_cursor(void) @@ -585,6 +587,7 @@ if(cursor > max_cursor) cursor = max_cursor; } +#endif /* the list below must match enum audio_sources in audio.h */ static const char* const prestr[] = @@ -807,7 +810,7 @@ /* tell recording_screen to reset the time */ last_seconds = 0; break; - + case 3: /* Stop and shutdown */ rec_command(RECORDING_CMD_STOP_SHUTDOWN); break; @@ -822,13 +825,128 @@ break; } } +/* Stuff for drawing the screen */ +static struct viewport vp_list[NB_SCREENS], vp_top[NB_SCREENS]; +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, +#endif + ITEM_COUNT, +}; + +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_COUNT_M = 4, +#else + ITEM_COUNT_M = 2, +#endif +}; + +static int listid_to_enum[ITEM_COUNT]; + +static char * reclist_get_name(int selected_item, void * data, + char * buffer, size_t buffer_len) +{ + char buf2[32]; + char buf3[32]; + data = data; /* not used */ + if(selected_item >= ITEM_COUNT) + return ""; + + switch (listid_to_enum[selected_item]) + { + case ITEM_VOLUME: + snprintf(buffer, buffer_len, "%s: %s", str(LANG_SYSFONT_VOLUME), + fmt_gain(SOUND_VOLUME, + global_settings.volume, + buf2, sizeof(buf2))); + break; + case ITEM_GAIN: + if(global_settings.rec_source == AUDIO_SRC_MIC) + { + /* Draw MIC recording gain */ + snprintf(buffer, buffer_len, "%s: %s", str(LANG_SYSFONT_GAIN), + fmt_gain(SOUND_MIC_GAIN, + global_settings.rec_mic_gain, + buf2, sizeof(buf2))); + } + else + { + int avg_gain = (global_settings.rec_left_gain + + global_settings.rec_right_gain) / 2; + snprintf(buffer, buffer_len, "%s: %s", str(LANG_SYSFONT_GAIN), + fmt_gain(SOUND_LEFT_GAIN, + avg_gain, + buf2, sizeof(buf2))); + } + break; + case ITEM_GAIN_L: + snprintf(buffer, buffer_len, "%s: %s", str(LANG_SYSFONT_RECORDING_LEFT), + fmt_gain(SOUND_LEFT_GAIN, + global_settings.rec_left_gain, + buf2, sizeof(buf2))); + break; + case ITEM_GAIN_R: + snprintf(buffer, buffer_len, "%s: %s", str(LANG_SYSFONT_RECORDING_RIGHT), + fmt_gain(SOUND_RIGHT_GAIN, + global_settings.rec_right_gain, + buf2, sizeof(buf2))); + break; +#ifdef HAVE_AGC + case ITEM_AGC_MODE: + snprintf(buffer, buffer_len, "%s: %s", + str(LANG_SYSFONT_RECORDING_AGC_PRESET), + agc_preset_str[agc_preset]); + break; + case ITEM_AGC_MAXDB: + if (agc_preset == 0) + snprintf(buffer, buffer_len, "%s: %s", + str(LANG_SYSFONT_RECORDING_AGC_MAXGAIN), + fmt_gain(SOUND_LEFT_GAIN, + agc_maxgain, buf2, sizeof(buf2))); + else if (global_settings.rec_source == AUDIO_SRC_MIC) + snprintf(buffer, buffer_len, "%s: %s (%s)", + str(LANG_SYSFONT_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 + snprintf(buffer, buffer_len, "%s: %s (%s)", + str(LANG_SYSFONT_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; +#endif + default: + return ""; + } + return buffer; +} + + bool recording_start_automatic = false; bool recording_screen(bool no_source) { - long button; - bool done = false; + int button; + int done = -1; /* negative to re-init, positive to quit, zero to run */ char buf[32]; char buf2[32]; int w, h; @@ -859,18 +977,20 @@ bool peak_valid = false; int peak_l, peak_r; int balance = 0; - bool display_agc[NB_SCREENS]; #endif - int line[NB_SCREENS]; int i; - int filename_offset[NB_SCREENS]; + int pm_x[NB_SCREENS]; int pm_y[NB_SCREENS]; + int pm_h[NB_SCREENS]; int trig_xpos[NB_SCREENS]; int trig_ypos[NB_SCREENS]; int trig_width[NB_SCREENS]; - /* pm_x = offset pm to put clipcount in front. - Use lcd_getstringsize() when not using SYSFONT */ - int pm_x = global_settings.peak_meter_clipcounter ? 30 : 0; + int top_lines_req; + struct viewport *v; + struct gui_synclist lists; +#ifdef HAVE_FMRADIO_REC + int prev_rec_source = global_settings.rec_source; +#endif static const unsigned char *byte_units[] = { ID2P(LANG_BYTE), @@ -879,29 +999,9 @@ ID2P(LANG_GIGABYTE) }; - int base_style = STYLE_INVERT; - int style; - struct viewport vp[NB_SCREENS]; - int ymargin = global_settings.cursor_style?0:10; -#ifdef HAVE_LCD_COLOR - if (global_settings.cursor_style == 2) { - base_style |= STYLE_COLORBAR; - } - else if (global_settings.cursor_style == 3) { - base_style |= STYLE_GRADIENT; - } -#endif - struct audio_recording_options rec_options; rec_status = RCSTAT_IN_RECSCREEN; - if (rec_create_directory() < 0) - { - rec_status = 0; - return false; - } - - cursor = 0; #if (CONFIG_LED == LED_REAL) && !defined(SIMULATOR) ata_set_led_enabled(false); #endif @@ -917,23 +1017,10 @@ peak_meter_playback(true); #endif - audio_init_recording(0); - sound_set_volume(global_settings.volume); - #ifdef HAVE_AGC peak_meter_get_peakhold(&peak_l, &peak_r); #endif - rec_init_recording_options(&rec_options); - rec_set_recording_options(&rec_options); - - set_gain(); - -#if CONFIG_RTC == 0 - /* Create new filename for recording start */ - rec_init_filename(); -#endif - pm_reset_clipcount(); pm_activate_clipcount(false); settings_apply_trigger(); @@ -945,41 +1032,128 @@ agc_preset_str[3] = str(LANG_SYSFONT_AGC_DJSET); agc_preset_str[4] = str(LANG_SYSFONT_AGC_MEDIUM); agc_preset_str[5] = str(LANG_SYSFONT_AGC_VOICE); - if (global_settings.rec_source == AUDIO_SRC_MIC) { - agc_preset = global_settings.rec_agc_preset_mic; - agc_maxgain = global_settings.rec_agc_maxgain_mic; - } - else { - agc_preset = global_settings.rec_agc_preset_line; - agc_maxgain = global_settings.rec_agc_maxgain_line; - } #endif /* HAVE_AGC */ - FOR_NB_SCREENS(i) + while(done <= 0) { - viewport_set_defaults(&vp[i], i); - vp[i].font = FONT_SYSFIXED; - screens[i].set_viewport(&vp[i]); - screens[i].getstringsize("M", &w, &h); - filename_offset[i] = ((vp[i].height >= 7*h) ? 1 : 0); - pm_y[i] = h * (2 + filename_offset[i]); - } + if(done < 0) + { + /* request to re-init a lot of stuff, done after settings screen */ + done = 0; +#ifdef HAVE_FMRADIO_REC + /* If input changes away from FM Radio, + radio will remain off when recording screen closes. */ + if (global_settings.rec_source != prev_rec_source + && prev_rec_source == AUDIO_SRC_FMRADIO) + radio_status = FMRADIO_OFF; + prev_rec_source = global_settings.rec_source; +#endif -#ifdef HAVE_REMOTE_LCD - if (!remote_display_on) - { - screens[1].clear_display(); - snprintf(buf, sizeof(buf), str(LANG_REMOTE_LCD_ON)); - screens[1].puts((vp[1].width/w - strlen(buf))/2 + 1, - vp[1].height/(h*2) + 1, buf); - screens[1].update(); - gui_syncsplash(0, str(LANG_REMOTE_LCD_OFF)); - } + if(global_settings.rec_trigger_mode == TRIG_MODE_OFF) + top_lines_req = 5; + else + top_lines_req = 6; + + FOR_NB_SCREENS(i) + { + /* top bit, 3 lines, force sys font if total screen < 7 lines */ + v = &vp_top[i]; + viewport_set_defaults(v, i); /*already takes care of statusbar*/ + if (viewport_get_nb_lines(v) < (top_lines_req+2)) /*min list=2*/ + v->font = FONT_SYSFIXED; + v->height = (font_get(v->font)->height)*top_lines_req; + + /* list section, rest of the screen */ + v = &vp_list[i]; + viewport_set_defaults(v, i); + v->font = vp_top[i].font; + v->y = vp_top[i].y + vp_top[i].height; + v->height = screens[i].lcdheight - v->y; /* the rest */ + + screens[i].getstringsize("C", &w, &h); + /* to do: use stringsize of translated string and must + be more than the size of the value below it! */ + if(global_settings.peak_meter_clipcounter) + pm_x[i] = font_get(vp_top[i].font)->maxwidth * 4; + else + pm_x[i] = 0; + pm_y[i] = font_get(vp_top[i].font)->height * 3; + pm_h[i] = font_get(vp_top[i].font)->height * 2; + trig_width[i] = vp_top[i].width - 14; + trig_xpos[i] = vp_top[i].width - trig_width[i]; + trig_ypos[i] = font_get(vp_top[i].font)->height * 4; + screens[i].clear_display(); + screens[i].update(); + } + +#if CONFIG_CODEC == SWCODEC + /* reinit after submenu exit */ + audio_close_recording(); + audio_init_recording(0); #endif + sound_set_volume(global_settings.volume); - while(!done) - { + rec_init_recording_options(&rec_options); + rec_set_recording_options(&rec_options); + + if(rec_create_directory() < 0) + { + rec_status = 0; + goto rec_abort; + } + +#if CONFIG_CODEC == SWCODEC && CONFIG_RTC == 0 + /* If format changed, a new number is required */ + rec_init_filename(); +#endif + +#ifdef HAVE_AGC + if (global_settings.rec_source == AUDIO_SRC_MIC) { + agc_preset = global_settings.rec_agc_preset_mic; + agc_maxgain = global_settings.rec_agc_maxgain_mic; + } + else { + agc_preset = global_settings.rec_agc_preset_line; + agc_maxgain = global_settings.rec_agc_maxgain_line; + } +#endif + + set_gain(); + update_countdown = 1; /* Update immediately */ + + /* populate translation table for list id -> enum */ + if(global_settings.rec_source == AUDIO_SRC_MIC) + { + 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; +#endif + } + 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; +#endif + } + + gui_synclist_init(&lists, reclist_get_name, NULL, false, 1, vp_list); + if(global_settings.rec_source == AUDIO_SRC_MIC) + gui_synclist_set_nb_items(&lists, ITEM_COUNT_M); /* mono */ + else + gui_synclist_set_nb_items(&lists, ITEM_COUNT); /* stereo */ + gui_synclist_set_title(&lists, NULL, Icon_NOICON); + gui_synclist_draw(&lists); + } audio_stat = audio_status(); + gui_syncstatusbar_draw(&statusbars, true); + /* draw the top text */ #if (CONFIG_LED == LED_REAL) @@ -1027,156 +1201,217 @@ } } #endif /* CONFIG_LED */ - /* Wait for a button a while (HZ/10) drawing the peak meter */ - button = peak_meter_draw_get_btn(CONTEXT_RECSCREEN, - pm_x, pm_y, h * PM_HEIGHT, - screen_update); + /* first set current vp */ + FOR_NB_SCREENS(i) + { + screens[i].set_viewport(&vp_top[i]); + } + seconds = audio_recorded_time() / HZ; - if (last_audio_stat != audio_stat) + update_countdown--; + if(update_countdown == 0 || seconds > last_seconds) { - if (audio_stat & AUDIO_STATUS_RECORD) + unsigned int dseconds, dhours, dminutes; + unsigned long num_recorded_bytes, dsize, dmb; +// int pos = 0; + + update_countdown = 5; + last_seconds = seconds; + + dseconds = rec_timesplit_seconds(); + dsize = rec_sizesplit_bytes(); + num_recorded_bytes = audio_num_recorded_bytes(); + +// style = base_style; + +#ifdef HAVE_LCD_COLOR + /* special action for gradient - set default for 1 line gradient */ +// if(global_settings.cursor_style == 3) +// style = base_style | CURLN_PACK(0) | NUMLN_PACK(1); +#endif /* HAVE_LCD_COLOR */ + +#if CONFIG_CODEC == SWCODEC + if ((audio_stat & AUDIO_STATUS_WARNING) + && (warning_counter++ % WARNING_PERIOD) < WARNING_PERIOD/2) { - rec_status |= RCSTAT_HAVE_RECORDED; + /* Switch back and forth displaying warning on first available + line to ensure visibility - the motion should also help + draw attention */ + /* Don't use language string unless agreed upon to make this + method permanent - could do something in the statusbar */ + snprintf(buf, sizeof(buf), "Warning: %08X", + pcm_rec_get_warnings()); } - last_audio_stat = audio_stat; - } + else +#endif /* CONFIG_CODEC == SWCODEC */ + if ((global_settings.rec_sizesplit) && + (global_settings.rec_split_method)) + { + dmb = dsize/1024/1024; + snprintf(buf, sizeof(buf), "%s %dMB", + str(LANG_SYSFONT_SPLIT_SIZE), dmb); + } + else + { + hours = seconds / 3600; + minutes = (seconds - (hours * 3600)) / 60; + snprintf(buf, sizeof(buf), "%s %02d:%02d:%02d", + str(LANG_SYSFONT_RECORDING_TIME), + hours, minutes, seconds%60); + } + FOR_NB_SCREENS(i) + { +// screens[i].set_viewport(&vp_top[i]); + screens[i].clear_viewport(); + screens[i].puts(0, 0, buf); + } - if (recording_start_automatic) - { - /* simulate a button press */ - button = ACTION_REC_PAUSE; - recording_start_automatic = false; - } - - switch(button) - { -#ifdef HAVE_REMOTE_LCD - case ACTION_REC_LCD: - if (remote_display_on) + if(audio_stat & AUDIO_STATUS_PRERECORD) + { + snprintf(buf, sizeof(buf), "%s...", + str(LANG_SYSFONT_RECORD_PRERECORD)); + } + else + { + /* Display the split interval if the record timesplit + is active */ + if ((global_settings.rec_timesplit) && + !(global_settings.rec_split_method)) { - remote_display_on = false; - screen_update = 1; - screens[1].clear_display(); - snprintf(buf, sizeof(buf), str(LANG_REMOTE_LCD_ON)); - screens[1].puts((screens[1].getwidth()/w - strlen(buf))/2 + - 1, - screens[1].getheight()/(h*2) + 1, buf); - screens[1].update(); - gui_syncsplash(0, str(LANG_REMOTE_LCD_OFF)); + /* Display the record timesplit interval rather + than the file size if the record timer is + active */ + dhours = dseconds / 3600; + dminutes = (dseconds - (dhours * 3600)) / 60; + snprintf(buf, sizeof(buf), "%s %02d:%02d", + str(LANG_SYSFONT_RECORD_TIMESPLIT_REC), + dhours, dminutes); } else { - remote_display_on = true; - screen_update = NB_SCREENS; + output_dyn_value(buf2, sizeof buf2, + num_recorded_bytes, + byte_units, true); + snprintf(buf, sizeof(buf), "%s %s", + str(LANG_SYSFONT_RECORDING_SIZE), buf2); } - break; -#endif - case ACTION_STD_CANCEL: - /* turn off the trigger */ - peak_meter_trigger(false); - peak_meter_set_trigger_listener(NULL); + } + FOR_NB_SCREENS(i) + { + screens[i].puts(0, 1, buf); + } - if(audio_stat & AUDIO_STATUS_RECORD) + FOR_NB_SCREENS(i) + { + *filename = '\0'; + if (audio_stat & AUDIO_STATUS_RECORD) { - rec_command(RECORDING_CMD_STOP); + strncpy(filename, path_buffer + + strlen(path_buffer) - 12, 13); + filename[12]='\0'; } - else - { -#if CONFIG_CODEC != SWCODEC - peak_meter_playback(true); - peak_meter_enabled = false; -#endif - done = true; - } - update_countdown = 1; /* Update immediately */ - break; - case ACTION_REC_PAUSE: - case ACTION_REC_NEWFILE: - /* Only act if the mpeg is stopped */ - if(!(audio_stat & AUDIO_STATUS_RECORD)) + snprintf(buf, sizeof(buf), "%s %s", + str(LANG_SYSFONT_RECORDING_FILENAME), filename); + screens[i].puts(0, 2, buf); +// screens[i].set_viewport(NULL); + } + /* We will do file splitting regardless, either at the end of + a split interval, or when the filesize approaches the 2GB + FAT file size (compatibility) limit. */ + if ((audio_stat && !(global_settings.rec_split_method) + && global_settings.rec_timesplit && (seconds >= dseconds)) + || (audio_stat && global_settings.rec_split_method + && global_settings.rec_sizesplit + && (num_recorded_bytes >= dsize)) + || (num_recorded_bytes >= MAX_FILE_SIZE)) + { + if (!(global_settings.rec_split_type) + || (num_recorded_bytes >= MAX_FILE_SIZE)) { - /* is this manual or triggered recording? */ - if ((global_settings.rec_trigger_mode == TRIG_MODE_OFF) || - (peak_meter_trigger_status() != TRIG_OFF)) - { - /* manual recording */ - rec_status |= RCSTAT_HAVE_RECORDED; - rec_command(RECORDING_CMD_START); - last_seconds = 0; - if (global_settings.talk_menu) - { - /* no voice possible here, but a beep */ - audio_beep(HZ/2); /* longer beep on start */ - } - } - /* this is triggered recording */ - else - { - /* we don't start recording now, but enable the - trigger and let the callback function - trigger_listener control when the recording starts */ - peak_meter_trigger(true); - peak_meter_set_trigger_listener(&trigger_listener); - } + rec_command(RECORDING_CMD_START_NEWFILE); + last_seconds = 0; } else { - /*if new file button pressed, start new file */ - if (button == ACTION_REC_NEWFILE) - { - rec_command(RECORDING_CMD_START_NEWFILE); - last_seconds = 0; - } + peak_meter_trigger(false); + peak_meter_set_trigger_listener(NULL); + if( global_settings.rec_split_type == 1) + rec_command(RECORDING_CMD_STOP); else - /* if pause button pressed, pause or resume */ - { - if(audio_stat & AUDIO_STATUS_PAUSE) - { - rec_command(RECORDING_CMD_RESUME); - if (global_settings.talk_menu) - { - /* no voice possible here, but a beep */ - audio_beep(HZ/4); /* short beep on resume */ - } - } - else - { - rec_command(RECORDING_CMD_PAUSE); - } - } + rec_command(RECORDING_CMD_STOP_SHUTDOWN); } - update_countdown = 1; /* Update immediately */ - break; + update_countdown = 1; + } - case ACTION_STD_PREV: - cursor--; - adjust_cursor(); - update_countdown = 1; /* Update immediately */ - break; + /* draw the clipcounter just in front of the peakmeter */ + if(global_settings.peak_meter_clipcounter) + { + char clpstr[32]; + snprintf(clpstr, 32, "%4d", pm_get_clipcount()); + FOR_NB_SCREENS(i) + { + screens[i].puts(0, 3,str(LANG_SYSFONT_PM_CLIPCOUNT)); + screens[i].puts(0, 4, clpstr); + } + } - case ACTION_STD_NEXT: - cursor++; - adjust_cursor(); - update_countdown = 1; /* Update immediately */ - break; + } +#ifdef HAVE_AGC + hist_time++; +#endif + + /* draw the trigger status */ + if (peak_meter_trigger_status() != TRIG_OFF) + { + peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width, + screen_update); + for(i = 0; i < screen_update; i++){ + screens[i].update_rect(trig_xpos[i], trig_ypos[i], + trig_width[i] + 2, TRIG_HEIGHT); + } + } + + button = peak_meter_draw_get_btn(CONTEXT_RECSCREEN, + pm_x, pm_y, pm_h, + screen_update); + + if (last_audio_stat != audio_stat) + { + if (audio_stat & AUDIO_STATUS_RECORD) + { + rec_status |= RCSTAT_HAVE_RECORDED; + } + last_audio_stat = audio_stat; + } + + + if (recording_start_automatic) + { + /* simulate a button press */ + button = ACTION_REC_PAUSE; + recording_start_automatic = false; + } + gui_synclist_do_button(&lists, &button, LIST_WRAP_UNLESS_HELD); + switch(button) + { case ACTION_SETTINGS_INC: case ACTION_SETTINGS_INCREPEAT: - switch(cursor) + switch (listid_to_enum[gui_synclist_get_sel_pos(&lists)]) { - case 0: + case ITEM_VOLUME: global_settings.volume++; setvol(); break; - case 1: + case ITEM_GAIN: if(global_settings.rec_source == AUDIO_SRC_MIC) { if(global_settings.rec_mic_gain < sound_max(SOUND_MIC_GAIN)) - global_settings.rec_mic_gain++; + global_settings.rec_mic_gain++; } else { @@ -1188,18 +1423,18 @@ global_settings.rec_right_gain++; } break; - case 2: + case ITEM_GAIN_L: if(global_settings.rec_left_gain < sound_max(SOUND_LEFT_GAIN)) global_settings.rec_left_gain++; break; - case 3: + case ITEM_GAIN_R: if(global_settings.rec_right_gain < sound_max(SOUND_RIGHT_GAIN)) global_settings.rec_right_gain++; break; #ifdef HAVE_AGC - case 4: + case ITEM_AGC_MODE: agc_preset = MIN(agc_preset + 1, AGC_MODE_SIZE); agc_enable = (agc_preset != 0); if (global_settings.rec_source == AUDIO_SRC_MIC) { @@ -1210,7 +1445,7 @@ agc_maxgain = global_settings.rec_agc_maxgain_line; } break; - case 5: + case ITEM_AGC_MAXDB: if (global_settings.rec_source == AUDIO_SRC_MIC) { agc_maxgain = MIN(agc_maxgain + 1, @@ -1226,19 +1461,16 @@ break; #endif /* HAVE_AGC */ } - set_gain(); - update_countdown = 1; /* Update immediately */ break; - case ACTION_SETTINGS_DEC: case ACTION_SETTINGS_DECREPEAT: - switch(cursor) + switch (listid_to_enum[gui_synclist_get_sel_pos(&lists)]) { - case 0: + case ITEM_VOLUME: global_settings.volume--; setvol(); break; - case 1: + case ITEM_GAIN: if(global_settings.rec_source == AUDIO_SRC_MIC) { if(global_settings.rec_mic_gain > @@ -1255,18 +1487,18 @@ global_settings.rec_right_gain--; } break; - case 2: + case ITEM_GAIN_L: if(global_settings.rec_left_gain > sound_min(SOUND_LEFT_GAIN)) global_settings.rec_left_gain--; break; - case 3: + case ITEM_GAIN_R: if(global_settings.rec_right_gain > sound_min(SOUND_RIGHT_GAIN)) global_settings.rec_right_gain--; break; #ifdef HAVE_AGC - case 4: + case ITEM_AGC_MODE: agc_preset = MAX(agc_preset - 1, 0); agc_enable = (agc_preset != 0); if (global_settings.rec_source == AUDIO_SRC_MIC) { @@ -1277,7 +1509,7 @@ agc_maxgain = global_settings.rec_agc_maxgain_line; } break; - case 5: + case ITEM_AGC_MAXDB: if (global_settings.rec_source == AUDIO_SRC_MIC) { agc_maxgain = MAX(agc_maxgain - 1, @@ -1293,28 +1525,118 @@ break; #endif /* HAVE_AGC */ } - set_gain(); - update_countdown = 1; /* Update immediately */ break; + case ACTION_STD_CANCEL: + /* turn off the trigger */ + peak_meter_trigger(false); + peak_meter_set_trigger_listener(NULL); + if(audio_stat & AUDIO_STATUS_RECORD) + { + rec_command(RECORDING_CMD_STOP); + } + else + { +#if CONFIG_CODEC != SWCODEC + peak_meter_playback(true); + peak_meter_enabled = false; +#endif + done = 1; + } + update_countdown = 1; /* Update immediately */ + break; +#ifdef HAVE_REMOTE_LCD + case ACTION_REC_LCD: + if (remote_display_on) + { + remote_display_on = false; + screen_update = 1; + screens[1].clear_display(); + snprintf(buf, sizeof(buf), str(LANG_REMOTE_LCD_ON)); + screens[1].puts((screens[1].getwidth()/w - strlen(buf))/2 + + 1, + screens[1].getheight()/(h*2) + 1, buf); + screens[1].update(); + gui_syncsplash(0, str(LANG_REMOTE_LCD_OFF)); + } + else + { + remote_display_on = true; + screen_update = NB_SCREENS; + } + break; +#endif + case ACTION_REC_PAUSE: + case ACTION_REC_NEWFILE: + /* Only act if the mpeg is stopped */ + if(!(audio_stat & AUDIO_STATUS_RECORD)) + { + /* is this manual or triggered recording? */ + if ((global_settings.rec_trigger_mode == TRIG_MODE_OFF) || + (peak_meter_trigger_status() != TRIG_OFF)) + { + /* manual recording */ + rec_status |= RCSTAT_HAVE_RECORDED; + rec_command(RECORDING_CMD_START); + last_seconds = 0; + if (global_settings.talk_menu) + { + /* no voice possible here, but a beep */ + audio_beep(HZ/2); /* longer beep on start */ + } + } + /* this is triggered recording */ + else + { + /* we don't start recording now, but enable the + trigger and let the callback function + trigger_listener control when the recording starts */ + peak_meter_trigger(true); + peak_meter_set_trigger_listener(&trigger_listener); + } + } + else + { + /*if new file button pressed, start new file */ + if (button == ACTION_REC_NEWFILE) + { + rec_command(RECORDING_CMD_START_NEWFILE); + last_seconds = 0; + } + else + /* if pause button pressed, pause or resume */ + { + if(audio_stat & AUDIO_STATUS_PAUSE) + { + rec_command(RECORDING_CMD_RESUME); + if (global_settings.talk_menu) + { + /* no voice possible here, but a beep */ + audio_beep(HZ/4); /* short beep on resume */ + } + } + else + { + rec_command(RECORDING_CMD_PAUSE); + } + } + } + update_countdown = 1; /* Update immediately */ + break; case ACTION_STD_MENU: #if CONFIG_CODEC == SWCODEC if(!(audio_stat & AUDIO_STATUS_RECORD)) #else - if(audio_stat != AUDIO_STATUS_RECORD) + if(audio_stat != AUDIO_STATUS_RECORD) #endif { -#ifdef HAVE_FMRADIO_REC - const int prev_rec_source = global_settings.rec_source; -#endif - #if (CONFIG_LED == LED_REAL) /* led is restored at begin of loop / end of function */ led(false); #endif if (recording_menu(no_source)) { - done = true; + done = 1; rec_status |= RCSTAT_BEEN_IN_USB_MODE; #ifdef HAVE_FMRADIO_REC radio_status = FMRADIO_OFF; @@ -1322,53 +1644,8 @@ } else { -#ifdef HAVE_FMRADIO_REC - /* If input changes away from FM Radio, radio will - remain off when recording screen closes. */ - if (global_settings.rec_source != prev_rec_source - && prev_rec_source == AUDIO_SRC_FMRADIO) - radio_status = FMRADIO_OFF; -#endif - -#if CONFIG_CODEC == SWCODEC - /* reinit after submenu exit */ - audio_close_recording(); - audio_init_recording(0); -#endif - - rec_init_recording_options(&rec_options); - rec_set_recording_options(&rec_options); - - if(rec_create_directory() < 0) - { - goto rec_abort; - } - -#if CONFIG_CODEC == SWCODEC && CONFIG_RTC == 0 - /* If format changed, a new number is required */ - rec_init_filename(); -#endif - -#ifdef HAVE_AGC - if (global_settings.rec_source == AUDIO_SRC_MIC) { - agc_preset = global_settings.rec_agc_preset_mic; - agc_maxgain = global_settings.rec_agc_maxgain_mic; - } - else { - agc_preset = global_settings.rec_agc_preset_line; - agc_maxgain = global_settings.rec_agc_maxgain_line; - } -#endif - - adjust_cursor(); - set_gain(); - update_countdown = 1; /* Update immediately */ - - FOR_NB_SCREENS(i) - { - screens[i].set_viewport(&vp[i]); - screens[i].setfont(FONT_SYSFIXED); - } + done = -1; + /* the init is now done at the beginning of the loop */ } } break; @@ -1426,12 +1703,32 @@ #endif } break; + } /*switch(button)*/ +#ifdef HAVE_AGC + if (global_settings.rec_source == AUDIO_SRC_MIC) + { + if(agc_maxgain < (global_settings.rec_mic_gain)) + change_recording_gain(false, true, true); + } + else + { + if(agc_maxgain < (global_settings.rec_left_gain)) + change_recording_gain(false, true, false); + if(agc_maxgain < (global_settings.rec_right_gain)) + change_recording_gain(false, false, true); + } +#endif /* HAVE_AGC */ + gui_synclist_draw(&lists); +// FOR_NB_SCREENS(i) +// { +// screens[i].set_viewport(NULL); +// gui_statusbar_draw(&(statusbars.statusbars[i]), true); +// screens[i].set_viewport(&vp_top[i]); +// peak_meter_screen(&screens[i], pm_x[i], pm_y[i], pm_h[i]); +// screens[i].update(); +// } - default: - default_event_handler(button); - break; - } /* end switch */ - +// TO DO: check if this is at the right location!!!! #ifdef HAVE_AGC peak_read = !peak_read; if (peak_read) { /* every 2nd run of loop */ @@ -1444,470 +1741,12 @@ auto_gain_control(&peak_l, &peak_r, &balance); #endif - FOR_NB_SCREENS(i) - screens[i].setfont(FONT_SYSFIXED); - - seconds = audio_recorded_time() / HZ; - - update_countdown--; - if(update_countdown == 0 || seconds > last_seconds) - { - unsigned int dseconds, dhours, dminutes; - unsigned long num_recorded_bytes, dsize, dmb; - int pos = 0; - - update_countdown = 5; - last_seconds = seconds; - - dseconds = rec_timesplit_seconds(); - dsize = rec_sizesplit_bytes(); - num_recorded_bytes = audio_num_recorded_bytes(); - - for(i = 0; i < screen_update; i++) - screens[i].clear_display(); - - style = base_style; - -#ifdef HAVE_LCD_COLOR - /* special action for gradient - set default for 1 line gradient */ - if(global_settings.cursor_style == 3) - style = base_style | CURLN_PACK(0) | NUMLN_PACK(1); -#endif /* HAVE_LCD_COLOR */ - -#if CONFIG_CODEC == SWCODEC - if ((audio_stat & AUDIO_STATUS_WARNING) - && (warning_counter++ % WARNING_PERIOD) < WARNING_PERIOD/2) - { - /* Switch back and forth displaying warning on first available - line to ensure visibility - the motion should also help - draw attention */ - /* Don't use language string unless agreed upon to make this - method permanent - could do something in the statusbar */ - snprintf(buf, sizeof(buf), "Warning: %08X", - pcm_rec_get_warnings()); - } - else -#endif /* CONFIG_CODEC == SWCODEC */ - if ((global_settings.rec_sizesplit) && - (global_settings.rec_split_method)) - { - dmb = dsize/1024/1024; - snprintf(buf, sizeof(buf), "%s %dMB", - str(LANG_SYSFONT_SPLIT_SIZE), dmb); - } - else - { - hours = seconds / 3600; - minutes = (seconds - (hours * 3600)) / 60; - snprintf(buf, sizeof(buf), "%s %02d:%02d:%02d", - str(LANG_SYSFONT_RECORDING_TIME), - hours, minutes, seconds%60); - } - - for(i = 0; i < screen_update; i++) - screens[i].puts(0, 0, buf); - - if(audio_stat & AUDIO_STATUS_PRERECORD) - { - snprintf(buf, sizeof(buf), "%s...", - str(LANG_SYSFONT_RECORD_PRERECORD)); - } - else - { - /* Display the split interval if the record timesplit - is active */ - if ((global_settings.rec_timesplit) && - !(global_settings.rec_split_method)) - { - /* Display the record timesplit interval rather - than the file size if the record timer is - active */ - dhours = dseconds / 3600; - dminutes = (dseconds - (dhours * 3600)) / 60; - snprintf(buf, sizeof(buf), "%s %02d:%02d", - str(LANG_SYSFONT_RECORD_TIMESPLIT_REC), - dhours, dminutes); - } - else - { - output_dyn_value(buf2, sizeof buf2, - num_recorded_bytes, - byte_units, true); - snprintf(buf, sizeof(buf), "%s %s", - str(LANG_SYSFONT_RECORDING_SIZE), buf2); - } - } - for(i = 0; i < screen_update; i++) - screens[i].puts(0, 1, buf); - - for(i = 0; i < screen_update; i++) - { - if (filename_offset[i] > 0) - { - *filename = '\0'; - if (audio_stat & AUDIO_STATUS_RECORD) - { - strncpy(filename, path_buffer + - strlen(path_buffer) - 12, 13); - filename[12]='\0'; - } - - snprintf(buf, sizeof(buf), "%s %s", - str(LANG_SYSFONT_RECORDING_FILENAME), filename); - screens[i].puts(0, 2, buf); - } - } - - /* We will do file splitting regardless, either at the end of - a split interval, or when the filesize approaches the 2GB - FAT file size (compatibility) limit. */ - if ((audio_stat && !(global_settings.rec_split_method) - && global_settings.rec_timesplit && (seconds >= dseconds)) - || (audio_stat && global_settings.rec_split_method - && global_settings.rec_sizesplit - && (num_recorded_bytes >= dsize)) - || (num_recorded_bytes >= MAX_FILE_SIZE)) - { - if (!(global_settings.rec_split_type) - || (num_recorded_bytes >= MAX_FILE_SIZE)) - { - rec_command(RECORDING_CMD_START_NEWFILE); - last_seconds = 0; - } - else - { - peak_meter_trigger(false); - peak_meter_set_trigger_listener(NULL); - if( global_settings.rec_split_type == 1) - rec_command(RECORDING_CMD_STOP); - else - rec_command(RECORDING_CMD_STOP_SHUTDOWN); - } - update_countdown = 1; - } - - /* draw the clipcounter just in front of the peakmeter */ - if(global_settings.peak_meter_clipcounter) - { - char clpstr[32]; - snprintf(clpstr, 32, "%4d", pm_get_clipcount()); - for(i = 0; i < screen_update; i++) - { - if(PM_HEIGHT > 1) - screens[i].puts(0, 2 + filename_offset[i], - str(LANG_SYSFONT_PM_CLIPCOUNT)); - screens[i].puts(0, 1 + PM_HEIGHT + filename_offset[i], - clpstr); - } - } - - snprintf(buf, sizeof(buf), "%s: %s", str(LANG_SYSFONT_VOLUME), - fmt_gain(SOUND_VOLUME, - global_settings.volume, - buf2, sizeof(buf2))); - - if (global_settings.cursor_style && (pos++ == cursor)) - { - for(i = 0; i < screen_update; i++) - screens[i].puts_style_offset(0, filename_offset[i] + - PM_HEIGHT + 2, buf, style,0); - } - else - { - for(i = 0; i < screen_update; i++) - screens[i].putsxy(ymargin, - SYSFONT_HEIGHT*(filename_offset[i]+ - PM_HEIGHT + 2), buf); - } - - if(global_settings.rec_source == AUDIO_SRC_MIC) - { - /* Draw MIC recording gain */ - snprintf(buf, sizeof(buf), "%s:%s", str(LANG_SYSFONT_GAIN), - fmt_gain(SOUND_MIC_GAIN, - global_settings.rec_mic_gain, - buf2, sizeof(buf2))); - if(global_settings.cursor_style && ((1==cursor)||(2==cursor))) - { - for(i = 0; i < screen_update; i++) - screens[i].puts_style_offset(0, filename_offset[i] + - PM_HEIGHT + 3, buf, style,0); - } - else - { - for(i = 0; i < screen_update; i++) - screens[i].putsxy(ymargin, - SYSFONT_HEIGHT*(filename_offset[i] + - PM_HEIGHT + 3), buf); - } - } - else if(0 - HAVE_LINE_REC_( || global_settings.rec_source == - AUDIO_SRC_LINEIN) - HAVE_FMRADIO_REC_( || global_settings.rec_source == - AUDIO_SRC_FMRADIO) - ) - { - /* Draw LINE or FMRADIO recording gain */ - snprintf(buf, sizeof(buf), "%s:%s", - str(LANG_SYSFONT_RECORDING_LEFT), - fmt_gain(SOUND_LEFT_GAIN, - global_settings.rec_left_gain, - buf2, sizeof(buf2))); -#ifdef HAVE_LCD_COLOR - /* special action for gradient - double line gradient - line1 */ - if((global_settings.cursor_style == 3) && - (1==cursor)) - style = base_style | CURLN_PACK(0) | NUMLN_PACK(2); -#endif /* HAVE_LCD_COLOR */ - if(global_settings.cursor_style && ((1==cursor)||(2==cursor))) - { - for(i = 0; i < screen_update; i++) - screens[i].puts_style_offset(0, filename_offset[i] + - PM_HEIGHT + 3, buf, style,0); - } - else - { - for(i = 0; i < screen_update; i++) - screens[i].putsxy(ymargin, - SYSFONT_HEIGHT*(filename_offset[i] + - PM_HEIGHT + 3), buf); - } - - snprintf(buf, sizeof(buf), "%s:%s", - str(LANG_SYSFONT_RECORDING_RIGHT), - fmt_gain(SOUND_RIGHT_GAIN, - global_settings.rec_right_gain, - buf2, sizeof(buf2))); -#ifdef HAVE_LCD_COLOR - /* special action for gradient - double line gradient - line2 */ - if((global_settings.cursor_style == 3) && - (1==cursor)) - style = base_style | CURLN_PACK(1) | NUMLN_PACK(2); -#endif /* HAVE_LCD_COLOR */ - if(global_settings.cursor_style && ((1==cursor)||(3==cursor))) - { - for(i = 0; i < screen_update; i++) - screens[i].puts_style_offset(0, filename_offset[i] + - PM_HEIGHT + 4, buf, style,0); - } - else - { - for(i = 0; i < screen_update; i++) - screens[i].putsxy(ymargin, - SYSFONT_HEIGHT*(filename_offset[i] + - PM_HEIGHT + 4), buf); - } - } -#ifdef HAVE_LCD_COLOR - /* special action for gradient - back to single line gradient */ - if(global_settings.cursor_style == 3) - style = base_style | CURLN_PACK(0) | NUMLN_PACK(1); -#endif /* HAVE_LCD_COLOR */ - - FOR_NB_SCREENS(i) - { - switch (global_settings.rec_source) - { - HAVE_LINE_REC_(case AUDIO_SRC_LINEIN:) - HAVE_FMRADIO_REC_(case AUDIO_SRC_FMRADIO:) - line[i] = 5; - break; - - case AUDIO_SRC_MIC: - line[i] = 4; - break; -#ifdef HAVE_SPDIF_REC - case AUDIO_SRC_SPDIF: - line[i] = 3; - break; -#endif - default: - line[i] = 5; /* to prevent uninitialisation - warnings for line[0] */ - break; - } /* end switch */ -#ifdef HAVE_AGC - if (vp[i].height < h * (2 + filename_offset[i] + - PM_HEIGHT + line[i])) - { - line[i] -= 1; - display_agc[i] = false; - } - else - display_agc[i] = true; - - if ((cursor==4) || (cursor==5)) - display_agc[i] = true; - } - - /************** AGC test info ****************** - snprintf(buf, sizeof(buf), "D:%d U:%d", - (agc_droptime+2)/5, (agc_risetime+2)/5); - lcd_putsxy(1, LCD_HEIGHT - 8, buf); - snprintf(buf, sizeof(buf), "B:%d", - (agc_baltime+2)/5); - lcd_putsxy(LCD_WIDTH/2 + 3, LCD_HEIGHT - 8, buf); - ***********************************************/ - - if (cursor == 5) - snprintf(buf, sizeof(buf), "%s: %s", - str(LANG_SYSFONT_RECORDING_AGC_MAXGAIN), - fmt_gain(SOUND_LEFT_GAIN, - agc_maxgain, buf2, sizeof(buf2))); - else if (agc_preset == 0) - snprintf(buf, sizeof(buf), "%s: %s", - str(LANG_SYSFONT_RECORDING_AGC_PRESET), - agc_preset_str[agc_preset]); - else if (global_settings.rec_source == AUDIO_SRC_MIC) - snprintf(buf, sizeof(buf), "%s: %s%s", - str(LANG_SYSFONT_RECORDING_AGC_PRESET), - agc_preset_str[agc_preset], - fmt_gain(SOUND_LEFT_GAIN, - agc_maxgain - - global_settings.rec_mic_gain, - buf2, sizeof(buf2))); - else - snprintf(buf, sizeof(buf), "%s: %s%s", - str(LANG_SYSFONT_RECORDING_AGC_PRESET), - agc_preset_str[agc_preset], - fmt_gain(SOUND_LEFT_GAIN, - agc_maxgain - - (global_settings.rec_left_gain + - global_settings.rec_right_gain)/2, - buf2, sizeof(buf2))); - - if(global_settings.cursor_style && ((cursor==4) || (cursor==5))) - { - for(i = 0; i < screen_update; i++) - screens[i].puts_style_offset(0, filename_offset[i] + - PM_HEIGHT + line[i], buf, style,0); - } - else if (global_settings.rec_source == AUDIO_SRC_MIC - HAVE_LINE_REC_(|| global_settings.rec_source == - AUDIO_SRC_LINEIN) - HAVE_FMRADIO_REC_(|| global_settings.rec_source == - AUDIO_SRC_FMRADIO) - ) - { - for(i = 0; i < screen_update; i++) { - if (display_agc[i]) { - screens[i].putsxy(ymargin, - SYSFONT_HEIGHT*(filename_offset[i] + - PM_HEIGHT + line[i]), buf); - } - } - } - - if (global_settings.rec_source == AUDIO_SRC_MIC) - { - if(agc_maxgain < (global_settings.rec_mic_gain)) - change_recording_gain(false, true, true); - } - else - { - if(agc_maxgain < (global_settings.rec_left_gain)) - change_recording_gain(false, true, false); - if(agc_maxgain < (global_settings.rec_right_gain)) - change_recording_gain(false, false, true); - } -#else /* !HAVE_AGC */ - } -#endif /* HAVE_AGC */ - - if(!global_settings.cursor_style) { - switch(cursor) - { - case 1: - for(i = 0; i < screen_update; i++) - screen_put_cursorxy(&screens[i], 0, - filename_offset[i] + - PM_HEIGHT + 3, true); - - if(global_settings.rec_source != AUDIO_SRC_MIC) - { - for(i = 0; i < screen_update; i++) - screen_put_cursorxy(&screens[i], 0, - filename_offset[i] + - PM_HEIGHT + 4, true); - } - break; - case 2: - for(i = 0; i < screen_update; i++) - screen_put_cursorxy(&screens[i], 0, - filename_offset[i] + - PM_HEIGHT + 3, true); - break; - case 3: - for(i = 0; i < screen_update; i++) - screen_put_cursorxy(&screens[i], 0, - filename_offset[i] + - PM_HEIGHT + 4, true); - break; -#ifdef HAVE_AGC - case 4: - case 5: - for(i = 0; i < screen_update; i++) - screen_put_cursorxy(&screens[i], 0, - filename_offset[i] + - PM_HEIGHT + line[i], true); - break; -#endif /* HAVE_AGC */ - default: - for(i = 0; i < screen_update; i++) - screen_put_cursorxy(&screens[i], 0, - filename_offset[i] + - PM_HEIGHT + 2, true); - } - } - -#ifdef HAVE_AGC - hist_time++; -#endif - - for(i = 0; i < screen_update; i++) - { - screens[i].set_viewport(NULL); - gui_statusbar_draw(&(statusbars.statusbars[i]), true); - screens[i].set_viewport(&vp[i]); - peak_meter_screen(&screens[i], pm_x, pm_y[i], h*PM_HEIGHT); - screens[i].update(); - } - - /* draw the trigger status */ - FOR_NB_SCREENS(i) - { - /* NOTE: UGLY width setting based on height! To be fixed! */ - trig_width[i] = ((vp[i].height < 64) || - ((vp[i].height < 72) && (PM_HEIGHT > 1))) ? - screens[i].getwidth() - 14 * w : - screens[i].getwidth(); - trig_xpos[i] = screens[i].getwidth() - trig_width[i]; - trig_ypos[i] = ((vp[i].height < 72) && (PM_HEIGHT > 1)) ? - h*2 : - h*(1 + filename_offset[i] + PM_HEIGHT + - line[i] -#ifdef HAVE_AGC - + 1 -#endif - ); - } - - if (peak_meter_trigger_status() != TRIG_OFF) - { - peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width, - screen_update); - for(i = 0; i < screen_update; i++){ - screens[i].update_rect(trig_xpos[i], trig_ypos[i], - trig_width[i] + 2, TRIG_HEIGHT); - } - } - } - if(audio_stat & AUDIO_STATUS_ERROR) { done = true; } + FOR_NB_SCREENS(i) + screens[i].update(); } /* end while(!done) */ audio_stat = audio_status(); Index: apps/recorder/peakmeter.c =================================================================== --- apps/recorder/peakmeter.c (revision 18116) +++ apps/recorder/peakmeter.c (working copy) @@ -813,8 +813,8 @@ get fooled by an old maximum value */ pm_max_left = pm_cur_left; -#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) - srand(current_tick); +#if defined(SIMULATOR)// && (CONFIG_CODEC != SWCODEC) + // srand(current_tick); retval = rand()%MAX_PEAK; #endif @@ -844,8 +844,8 @@ get fooled by an old maximum value */ pm_max_right = pm_cur_right; -#if defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) - srand(current_tick); +#if defined(SIMULATOR)// && (CONFIG_CODEC != SWCODEC) + // srand(current_tick); retval = rand()%MAX_PEAK; #endif @@ -1328,8 +1328,8 @@ } #endif -int peak_meter_draw_get_btn(int action_context, int x, int y[], - int height, int nb_screens) +int peak_meter_draw_get_btn(int action_context, int x[], int y[], + int height[], int nb_screens) { int button = BUTTON_NONE; long next_refresh = current_tick; @@ -1362,10 +1362,10 @@ if (TIME_AFTER(current_tick, next_refresh)) { for(i = 0; i < nb_screens; i++) { - peak_meter_screen(&screens[i], x, y[i], height); - screens[i].update_viewport_rect(x, y[i], - screens[i].getwidth() - x, - height); + peak_meter_screen(&screens[i], x[i], y[i], height[i]); + screens[i].update_viewport_rect(x[i], y[i], + screens[i].getwidth() - x[i], + height[i]); } next_refresh += HZ / PEAK_METER_FPS; dopeek = true; Index: apps/menus/recording_menu.c =================================================================== --- apps/menus/recording_menu.c (revision 18116) +++ apps/menus/recording_menu.c (working copy) @@ -441,12 +441,14 @@ int i, action = ACTION_REDRAW; bool done = false, changed = true; const struct settings_list *settings[TRIG_OPTION_COUNT]; - + + int pm_x[NB_SCREENS]; int pm_y[NB_SCREENS]; + int pm_h[NB_SCREENS]; int trig_xpos[NB_SCREENS]; int trig_ypos[NB_SCREENS]; int trig_width[NB_SCREENS]; - + int old_start_thres_db = global_settings.rec_start_thres_db; int old_start_thres_linear = global_settings.rec_start_thres_linear; int old_start_duration = global_settings.rec_start_duration; @@ -466,7 +468,9 @@ vp[i].height -= SYSFONT_HEIGHT*2; trig_xpos[i] = 0; trig_ypos[i] = vp[i].y + vp[i].height; + pm_x[i] = 0; pm_y[i] = screens[i].getheight() - SYSFONT_HEIGHT; + pm_h[i] = SYSFONT_HEIGHT; trig_width[i] = screens[i].getwidth(); } /* TODO: what to do if there is < 4 lines on the screen? */ @@ -518,8 +522,8 @@ } peak_meter_draw_trig(trig_xpos, trig_ypos, trig_width, NB_SCREENS); - action = peak_meter_draw_get_btn(CONTEXT_SETTINGS_RECTRIGGER, 0, pm_y, - SYSFONT_HEIGHT, NB_SCREENS); + action = peak_meter_draw_get_btn(CONTEXT_SETTINGS_RECTRIGGER, + pm_x, pm_y, pm_h, NB_SCREENS); FOR_NB_SCREENS(i) screens[i].update(); i = gui_synclist_get_sel_pos(&lists); Index: apps/keymaps/keymap-h1x0_h3x0.c =================================================================== --- apps/keymaps/keymap-h1x0_h3x0.c (revision 18116) +++ apps/keymaps/keymap-h1x0_h3x0.c (working copy) @@ -63,8 +63,8 @@ { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, { ACTION_STD_OK, BUTTON_ON|BUTTON_REL, BUTTON_NONE }, - { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE }, - + { ACTION_STD_REC, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE }, + LAST_ITEM_IN_LIST }; /* button_context_standard */