--- ./rockbox-20070513/apps/recorder/recording.c 2007-05-18 00:10:25.000000000 -0400 +++ ./rockbox-20070513-original/apps/recorder/recording.c 2007-05-04 11:20:02.000000000 -0400 @@ -68,7 +68,6 @@ #include "screen_access.h" #include "action.h" #include "radio.h" -#include "plugin.h" #ifdef HAVE_RECORDING static bool in_screen = false; @@ -115,11 +114,6 @@ /* path for current file */ static char path_buffer[MAX_PATH]; -/* For displaying current recording path */ -#define MAX_PATH_DISPLAY 20 -static char path_buffer_display[MAX_PATH_DISPLAY] = ""; -static size_t path_length = 0; - /** Automatic Gain Control (AGC) **/ #ifdef HAVE_AGC /* Timing counters: @@ -476,15 +470,15 @@ switch(global_settings.rec_source) { case AUDIO_SRC_MIC: - if(cursor == 3) - cursor = 5; - else if(cursor == 4) - cursor = 2; + if(cursor == 2) + cursor = 4; + else if(cursor == 3) + cursor = 1; case AUDIO_SRC_LINEIN: #ifdef HAVE_FMRADIO_IN case AUDIO_SRC_FMRADIO: #endif - max_cursor = 6; + max_cursor = 5; break; default: max_cursor = 0; @@ -494,13 +488,13 @@ switch(global_settings.rec_source) { case AUDIO_SRC_MIC: - max_cursor = 2; + max_cursor = 1; break; case AUDIO_SRC_LINEIN: #ifdef HAVE_FMRADIO_IN case AUDIO_SRC_FMRADIO: #endif - max_cursor = 4; + max_cursor = 3; break; default: max_cursor = 0; @@ -512,15 +506,14 @@ cursor = max_cursor; } -/* buffer should already contain the path. */ char *rec_create_filename(char *buffer) { char ext[16]; - char *dir_name; - /* The buffer may contain the full file name from the previous recording, - remove the file name. */ - buffer[path_length] = '\0'; + if(global_settings.rec_directory) + getcwd(buffer, MAX_PATH); + else + strncpy(buffer, rec_base_directory, MAX_PATH); snprintf(ext, sizeof(ext), ".%s", REC_FILE_ENDING(global_settings.rec_format)); @@ -535,25 +528,19 @@ #endif } -/* path_buffer should already contain the path. */ int rec_create_directory(void) { int rc; /* Try to create the base directory if needed */ - if(global_settings.rec_directory != 1) + if(global_settings.rec_directory == 0) { - - /* The path_buffer may contain the full file name from the previous - recording. Remove the file name. */ - path_buffer[path_length] = '\0'; - - rc = mkdir(path_buffer); + rc = mkdir(rec_base_directory); if(rc < 0 && errno != EEXIST) { gui_syncsplash(HZ * 2, "Can't create the %s directory. Error code %d.", - path_buffer, rc); + rec_base_directory, rc); return -1; } else @@ -758,525 +745,6 @@ } } -#define REC_PATH_FILE ROCKBOX_DIR "/.rec_path" -#define MAX_NUM_USER_REC_PATH 15 - -unsigned int num_user_rec_dir = 0; -bool user_rec_path_in_ram = false; -bool rec_path_buffer_dirty = false; - -/* - .rec_path file contains the names of the user-defined recording paths. It - contains two different data types. - - Its zeroth element is an unsigned int indicating the number of paths contained - in the file. The first through the (MAX_NUM_USER_REC_PATH)th elements - are unsigned integers indicating the starting position of the path names - in the char block mentioned below. - - The (MAX_NUM_USER_REC_PATH + 2)th element through the end of file is a char - block containing the actual path name of the user-defined recording directories. - Each path name contains the null terminator in the end. - - The (num_user_rec_dir + 1)th element in the index portion of the buffer contain the - total number of characters in the char block. - - The max number of the paths contained in .rec_path is MAX_NUM_USER_REC_PATH. - - rec_path_buffer contains an exact replica of the .rec_path file. - - For fetching, viewing, and removing directory names, current implementation - temporarily loads the REC_PATH_FILE into the plugin buffer. Currently, - there is no mechanism to cope with the case in which the size of the content - of the file is bigger than the available plugin buffer. (This can be solved - with loading only the portion of the file into the buffer, as in the playlist - viewer implementation). - Thus, MAX_NUM_USER_REC_PATH should be kept relatively small under the current - implementation. -*/ - -/* Call once when the player initializes */ -void rec_path_init(void) -{ - int rec_path_fd; - ssize_t nread; - bool create_new_rec_path_file = false; - int i; - - rec_path_fd = open(REC_PATH_FILE, O_RDONLY); - - if( rec_path_fd != - 1) - { - nread = read(rec_path_fd, &num_user_rec_dir, sizeof(unsigned int)); - - if( (nread != (ssize_t)sizeof(unsigned int)) || - (num_user_rec_dir > MAX_NUM_USER_REC_PATH) ) - { - /* The file is corrupt. Create a new file. */ - create_new_rec_path_file = true; - num_user_rec_dir = 0; - } - - if( global_settings.rec_directory - 2 > (int)num_user_rec_dir ) - { - /* This should never happen. */ - /* Set the player to use the default directory */ - global_settings.rec_directory = 0; - } - - close(rec_path_fd); - } - else - { - create_new_rec_path_file = true; - } - - if( create_new_rec_path_file ) - { - if( global_settings.rec_directory > 1 ) - { - /* Set the player to use the default directory */ - global_settings.rec_directory = 0; - } - - rec_path_fd = open(REC_PATH_FILE, - O_CREAT|O_RDWR|O_TRUNC); - - if( rec_path_fd < 0 ) - { - if (check_rockboxdir()) - { - gui_syncsplash(HZ*2, (unsigned char *)"%s (%d)", - str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR), - rec_path_fd); - } - return; - } - else - { - /* Initialize the file. Write the header. */ - for( i = 0; i < MAX_NUM_USER_REC_PATH + 2; i++ ) - { - write(rec_path_fd, &num_user_rec_dir, sizeof(unsigned int)); - } - - close(rec_path_fd); - } - } /* End if( create_new_rec_path_file ) */ -} - -/* For writing rec_path_buffer onto .rec_path file */ -bool rec_path_save(void* rec_path_buffer) -{ - int rec_path_fd; - unsigned int *indices; - unsigned int num_path_chars; - size_t buffer_size; - - if(rec_path_buffer == NULL) return false; - - rec_path_fd = open(REC_PATH_FILE, O_WRONLY); - - if( rec_path_fd < 0 ) - { - if (check_rockboxdir()) - { - gui_syncsplash(HZ*2, (unsigned char *)"%s (%d)", - str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR), - rec_path_fd); - } - return false; - } - - indices = (unsigned int*)rec_path_buffer; - indices++; - - num_path_chars = indices[num_user_rec_dir]; - - buffer_size = sizeof(unsigned int) * (MAX_NUM_USER_REC_PATH + 2) + - sizeof(char) * (size_t)num_path_chars; - - write(rec_path_fd, rec_path_buffer, buffer_size ); - - close(rec_path_fd); - - return true; -} - -/* For reading .rec_path file into rec_path_buffer */ -bool rec_path_load(void* rec_path_buffer, size_t path_buffer_size) -{ - int rec_path_fd; - unsigned int num_path_chars; - size_t buffer_size; - ssize_t num_of_bytes_read; - unsigned int *indices; - size_t char_block_size; - - if(rec_path_buffer == NULL) return false; - - if( num_user_rec_dir == 0 ) - { - indices = (unsigned int*)rec_path_buffer; - indices[0] = 0; - indices[1] = 0; - return true; - } - - rec_path_fd = open(REC_PATH_FILE, O_RDONLY); - - if( rec_path_fd < 0 ) - { - if (check_rockboxdir()) - { - gui_syncsplash(HZ*2, (unsigned char *)"%s (%d)", - str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR), - rec_path_fd); - } - return false; - } - - /* First, read the index block. */ - buffer_size = sizeof(unsigned int) * (MAX_NUM_USER_REC_PATH + 2); - - if( buffer_size > path_buffer_size ) goto exit; - - num_of_bytes_read = read(rec_path_fd, rec_path_buffer, buffer_size ); - - if( num_of_bytes_read != (ssize_t)num_of_bytes_read ) goto exit; - - indices = (unsigned int*)rec_path_buffer; - - /* Get the number of characters in the char block. */ - num_path_chars = indices[num_user_rec_dir + 1]; - - /* Read the char block. */ - char_block_size = sizeof(char) * (size_t)num_path_chars; - if( buffer_size + char_block_size > path_buffer_size ) goto exit; - num_of_bytes_read = read(rec_path_fd, - (void*)(indices + MAX_NUM_USER_REC_PATH + 2), - char_block_size); - - close(rec_path_fd); - - if( num_of_bytes_read != (ssize_t)char_block_size ) - return false; - else - return true; - -exit: - close(rec_path_fd); - return false; -} - -/* For removing a directory in rec_path_buffer. idx is zero-based. */ -void rec_path_remove(void* rec_path_buffer, unsigned int idx) -{ - unsigned int *index_array; - char *char_array; - unsigned int num_path_chars; - unsigned int i; - unsigned int starting_pos; - unsigned int next_starting_pos; - unsigned int string_length; - - if(rec_path_buffer == NULL) return; - - if( idx >= num_user_rec_dir ) return; - - index_array = (unsigned int*)rec_path_buffer; - index_array++; - - char_array = (char*)(index_array + MAX_NUM_USER_REC_PATH + 1); - - starting_pos = index_array[idx]; - next_starting_pos = index_array[idx + 1]; - - string_length = next_starting_pos - starting_pos; - - /* Remove the path in the index array. */ - for( i = idx; i < num_user_rec_dir; i++ ) - { - index_array[i] = index_array[i+1] - string_length; - } - - /* Adjust the number of characters. */ - num_user_rec_dir--; - num_path_chars = index_array[num_user_rec_dir]; - - /* Remove the path in the character array. */ - for( i = starting_pos; i < num_path_chars; i++ ) - { - char_array[i] = char_array[i+string_length]; - } - - index_array[-1] = num_user_rec_dir; -} - -void rec_path_remove_all(void* rec_path_buffer) -{ - unsigned int *indices; - - if(rec_path_buffer == NULL) return; - - indices = (unsigned int*)rec_path_buffer; - indices[0] = 0; - indices[1] = 0; - - num_user_rec_dir = 0; - - return; -} - -/* idx==0 for the default directory. - idx==1 for the current directory. - idx >= 2 for the user defined directories. -*/ -char* rec_path_get(void* rec_path_buffer, int idx) -{ - - unsigned int *index_array; - char *char_array; - size_t string_length; - char *dir_name; - - if( rec_path_buffer == NULL || idx > (int)num_user_rec_dir + 1 ) - idx = 0; - - if( idx == 0 ) - { - strncpy(path_buffer, rec_base_directory, MAX_PATH); - } - else if( idx == 1 ) - { - getcwd(path_buffer, MAX_PATH); - } - else - { - idx -= 2; - - index_array = (unsigned int*)rec_path_buffer; - index_array++; - string_length = index_array[idx+1] - index_array[idx]; - - char_array = (char*)(index_array + MAX_NUM_USER_REC_PATH + 1); - - strncpy(path_buffer, &char_array[index_array[idx]], string_length); - } - - /* Get the recording directory name for display. */ - dir_name = strrchr(path_buffer, '/'); - if( dir_name ) - { - strncpy(path_buffer_display, dir_name, MAX_PATH_DISPLAY); - } - else - { - path_buffer_display[0] = '\0'; - } - - path_length = strlen(path_buffer); - return path_buffer; - -} - -/* This API directly writes onto REC_PATH_FILE. */ -bool rec_path_insert(char* path) -{ - int rec_path_fd; - unsigned int num_path_chars; - size_t num_of_bytes; - ssize_t num_of_bytes_ret; - size_t pathlen; - - if( path == NULL ) return false; - - if( num_user_rec_dir == 0 ) rec_path_init(); - - rec_path_fd = open(REC_PATH_FILE, O_RDWR); - - if( rec_path_fd < 0 ) - { - if (check_rockboxdir()) - { - gui_syncsplash(HZ*2, (unsigned char *)"%s (%d)", - str(LANG_PLAYLIST_DIRECTORY_ACCESS_ERROR), - rec_path_fd); - } - return false; - } - - pathlen = strlen(path); - pathlen++; - - /* Get the current number of characters in the char block. */ - lseek( rec_path_fd, - (off_t)(sizeof(unsigned int) * ((size_t)num_user_rec_dir + 1)), - SEEK_SET ); - num_of_bytes = sizeof(unsigned int); - num_of_bytes_ret = read(rec_path_fd, &num_path_chars, num_of_bytes); - - if( num_of_bytes_ret != (ssize_t)num_of_bytes ) goto exit; - - /* Update number of characters in the char block. */ - num_path_chars += (unsigned int)pathlen; - num_of_bytes = sizeof(unsigned int); - num_of_bytes_ret = write(rec_path_fd, &num_path_chars, num_of_bytes ); - - if( num_of_bytes_ret != (ssize_t)num_of_bytes ) goto exit; - - /* Write the path string. */ - lseek( rec_path_fd, - (off_t)(sizeof(unsigned int) * (MAX_NUM_USER_REC_PATH+2) + - sizeof(char)*(size_t)(num_path_chars-pathlen)), SEEK_SET ); - num_of_bytes = sizeof(char) * pathlen; - num_of_bytes_ret = write(rec_path_fd, (void*)path, num_of_bytes); - - if( num_of_bytes_ret != (ssize_t)num_of_bytes ) goto exit; - - /* Update the number of paths */ - num_user_rec_dir++; - lseek( rec_path_fd, 0, SEEK_SET ); - num_of_bytes = sizeof(unsigned int); - num_of_bytes_ret = write(rec_path_fd, &num_user_rec_dir, num_of_bytes); - - if( num_of_bytes_ret != (ssize_t)num_of_bytes ) goto exit; - - close(rec_path_fd); - return true; - -exit: - close(rec_path_fd); - return false; -} - -static char *rec_path_callback_name(int selected_item, void *data, char *buffer) -{ - - char* str; - - if( selected_item == 0 ) - { - str = str(LANG_REMOVE); - snprintf(buffer, strlen(str)+1, "%s", str); - } - else if( selected_item == 1 ) - { - strncpy(buffer, rec_base_directory, MAX_PATH); - } - else if( selected_item == 2 ) - { - str = str(LANG_RECORD_CURRENT_DIR); - snprintf(buffer, strlen(str)+1, "%s", str); - } - else - { - str = rec_path_get( data, selected_item - 1 ); - snprintf(buffer, strlen(str)+1, "%s", str ); - } - - return(buffer); -} - -/* Recording-directory menuitem function. */ -bool recording_directory_menu(void) -{ - bool ret = false; /* return value */ - bool exit=false; /* exit viewer */ - int button; - struct gui_synclist rec_path_lists; - void* rec_path_buffer; - size_t buffer_size; - int idx; - - rec_path_buffer = plugin_get_buffer(&buffer_size); - if(!rec_path_buffer) goto exit; - - rec_path_init(); - if(!rec_path_load(rec_path_buffer, buffer_size)) rec_path_remove_all(rec_path_buffer); - - gui_synclist_init(&rec_path_lists, rec_path_callback_name, rec_path_buffer, false, 1); - gui_synclist_set_nb_items(&rec_path_lists, (int)(num_user_rec_dir + 3)); - gui_synclist_select_item(&rec_path_lists, global_settings.rec_directory+1); - gui_synclist_set_title(&rec_path_lists, str(LANG_RECORD_DIRECTORY), Icon_NOICON); - gui_synclist_draw(&rec_path_lists); - action_signalscreenchange(); - while (!exit) - { - /* Timeout so we can determine if play status has changed */ - button = get_action(CONTEXT_TREE,HZ/2); - idx=gui_synclist_get_sel_pos(&rec_path_lists); - if( idx != 0 ) global_settings.rec_directory = idx - 1; - else global_settings.rec_directory = 0; - - int list_action; - if( (list_action=gui_synclist_do_button(&rec_path_lists, button,LIST_WRAP_UNLESS_HELD))!=0 ) - { - } - switch (button) - { - case ACTION_TREE_WPS: - case ACTION_STD_CANCEL: - rec_path_get(rec_path_buffer, global_settings.rec_directory); - /* Upon exit, save the recording directory list onto the disk if modified */ - if(rec_path_buffer_dirty) - { - rec_path_save(rec_path_buffer); - rec_path_buffer_dirty = false; - } - exit = true; - break; - case ACTION_STD_OK: - { - /* If "Remove All" is selected, remove all user-defined recording directories. */ - if( idx == 0 ) - { - rec_path_buffer_dirty = true; - rec_path_remove_all( rec_path_buffer ); - gui_synclist_set_nb_items(&rec_path_lists, (int)(num_user_rec_dir + 3)); - global_settings.rec_directory = 0; - gui_synclist_draw(&rec_path_lists); - } - break; - } - case ACTION_STD_CONTEXT: - { - /* Currently, no contenxt-menu feature for the "Recording Options:Directory" menu item.*/ - /* ON+PLAY menu */ - break; - } - case ACTION_STD_MENU: - /* If a user-defined recording directory, remove from the list. - Currently, there's no submenu inside the "Recording Options:Directory" menu. - It could be added in a later version. */ - if(idx > 2) - { - rec_path_buffer_dirty = true; - rec_path_remove( rec_path_buffer, (unsigned int)idx - 3 ); - gui_synclist_del_item(&rec_path_lists); - gui_synclist_draw(&rec_path_lists); - } - break; - - case ACTION_NONE: - gui_syncstatusbar_draw(&statusbars, false); - break; - - default: - if(default_event_handler(button) == SYS_USB_CONNECTED) - { - ret = true; - goto exit; - } - break; - } - } - -exit: - action_signalscreenchange(); - return ret; -} - bool recording_start_automatic = false; bool recording_screen(bool no_source) @@ -1325,8 +793,6 @@ int trig_xpos[NB_SCREENS]; int trig_ypos[NB_SCREENS]; int trig_width[NB_SCREENS]; - void* rec_path_buffer; - size_t buffer_size; static const unsigned char *byte_units[] = { ID2P(LANG_BYTE), @@ -1368,16 +834,6 @@ set_gain(); settings_apply_trigger(); - rec_path_init(); - rec_path_buffer = plugin_get_buffer(&buffer_size); - if(!rec_path_buffer || - !rec_path_load(rec_path_buffer, buffer_size)) - { - num_user_rec_dir = 0; - if( global_settings.rec_directory > 2 ) - global_settings.rec_directory = 0; - } - #ifdef HAVE_AGC agc_preset_str[0] = str(LANG_SYSFONT_OFF); agc_preset_str[1] = str(LANG_SYSFONT_AGC_SAFETY); @@ -1404,7 +860,6 @@ pm_y[i] = 8 + h * (2 + filename_offset[i]); } - rec_path_get( rec_path_buffer, global_settings.rec_directory); if(rec_create_directory() > 0) have_recorded = true; #ifdef HAVE_REMOTE_LCD @@ -1604,31 +1059,12 @@ switch(cursor) { case 0: - if(!((audio_stat & AUDIO_STATUS_RECORD) || - (audio_stat & AUDIO_STATUS_PAUSE))) - { - if( global_settings.rec_directory < - (int)(num_user_rec_dir + 1) ) - global_settings.rec_directory++; - - rec_path_get(rec_path_buffer, - global_settings.rec_directory ); - - if(rec_create_directory()) - { - global_settings.rec_directory = 0; - rec_path_get(rec_path_buffer, - global_settings.rec_directory ); - } - } - break; - case 1: if(global_settings.volume < sound_max(SOUND_VOLUME)) global_settings.volume++; sound_set_volume(global_settings.volume); break; - case 2: + case 1: if(global_settings.rec_source == AUDIO_SRC_MIC) { if(global_settings.rec_mic_gain < @@ -1645,18 +1081,18 @@ global_settings.rec_right_gain++; } break; - case 3: + case 2: if(global_settings.rec_left_gain < sound_max(SOUND_LEFT_GAIN)) global_settings.rec_left_gain++; break; - case 4: + case 3: if(global_settings.rec_right_gain < sound_max(SOUND_RIGHT_GAIN)) global_settings.rec_right_gain++; break; #ifdef HAVE_AGC - case 5: + case 4: agc_preset = MIN(agc_preset + 1, AGC_MODE_SIZE); agc_enable = (agc_preset != 0); if (global_settings.rec_source == AUDIO_SRC_MIC) { @@ -1667,7 +1103,7 @@ agc_maxgain = global_settings.rec_agc_maxgain_line; } break; - case 6: + case 5: if (global_settings.rec_source == AUDIO_SRC_MIC) { agc_maxgain = MIN(agc_maxgain + 1, @@ -1691,30 +1127,12 @@ switch(cursor) { case 0: - if(!((audio_stat & AUDIO_STATUS_RECORD) || - (audio_stat & AUDIO_STATUS_PAUSE))) - { - if( global_settings.rec_directory > 0 ) - global_settings.rec_directory--; - - rec_path_get(rec_path_buffer, - global_settings.rec_directory ); - - if(rec_create_directory()) - { - global_settings.rec_directory = 0; - rec_path_get(rec_path_buffer, - global_settings.rec_directory ); - } - } - break; - case 1: if(global_settings.volume > sound_min(SOUND_VOLUME)) global_settings.volume--; sound_set_volume(global_settings.volume); break; - case 2: + case 1: if(global_settings.rec_source == AUDIO_SRC_MIC) { if(global_settings.rec_mic_gain > @@ -1731,18 +1149,18 @@ global_settings.rec_right_gain--; } break; - case 3: + case 2: if(global_settings.rec_left_gain > sound_min(SOUND_LEFT_GAIN)) global_settings.rec_left_gain--; break; - case 4: + case 3: if(global_settings.rec_right_gain > sound_min(SOUND_RIGHT_GAIN)) global_settings.rec_right_gain--; break; #ifdef HAVE_AGC - case 5: + case 4: agc_preset = MAX(agc_preset - 1, 0); agc_enable = (agc_preset != 0); if (global_settings.rec_source == AUDIO_SRC_MIC) { @@ -1753,7 +1171,7 @@ agc_maxgain = global_settings.rec_agc_maxgain_line; } break; - case 6: + case 5: if (global_settings.rec_source == AUDIO_SRC_MIC) { agc_maxgain = MAX(agc_maxgain - 1, @@ -2040,37 +1458,21 @@ update_countdown = 1; } - /* Display the line for the Directory option */ - snprintf(buf, sizeof(buf), "%s: %s", str(LANG_RECORD_DIRECTORY), - path_buffer_display); - - if (global_settings.invert_cursor && (pos++ == cursor)) - { - for(i = 0; i < screen_update; i++) - screens[i].puts_style_offset(0, filename_offset[i] + - PM_HEIGHT + 2, buf, STYLE_INVERT,0); - } - else - { - for(i = 0; i < screen_update; i++) - screens[i].puts(0, filename_offset[i] + PM_HEIGHT + 2, buf); - } - snprintf(buf, sizeof(buf), "%s: %s", str(LANG_SYSFONT_VOLUME), fmt_gain(SOUND_VOLUME, global_settings.volume, buf2, sizeof(buf2))); - if (global_settings.invert_cursor && (1==cursor)) + if (global_settings.invert_cursor && (pos++ == cursor)) { for(i = 0; i < screen_update; i++) screens[i].puts_style_offset(0, filename_offset[i] + - PM_HEIGHT + 3, buf, STYLE_INVERT,0); + PM_HEIGHT + 2, buf, STYLE_INVERT,0); } else { for(i = 0; i < screen_update; i++) - screens[i].puts(0, filename_offset[i] + PM_HEIGHT + 3, buf); + screens[i].puts(0, filename_offset[i] + PM_HEIGHT + 2, buf); } if(global_settings.rec_source == AUDIO_SRC_MIC) @@ -2080,17 +1482,17 @@ fmt_gain(SOUND_MIC_GAIN, global_settings.rec_mic_gain, buf2, sizeof(buf2))); - if(global_settings.invert_cursor && ((2==cursor)||(3==cursor))) + if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) { for(i = 0; i < screen_update; i++) screens[i].puts_style_offset(0, filename_offset[i] + - PM_HEIGHT + 4, buf, STYLE_INVERT,0); + PM_HEIGHT + 3, buf, STYLE_INVERT,0); } else { for(i = 0; i < screen_update; i++) screens[i].puts(0, filename_offset[i] + - PM_HEIGHT + 4, buf); + PM_HEIGHT + 3, buf); } } else if(global_settings.rec_source == AUDIO_SRC_LINEIN @@ -2105,17 +1507,17 @@ fmt_gain(SOUND_LEFT_GAIN, global_settings.rec_left_gain, buf2, sizeof(buf2))); - if(global_settings.invert_cursor && ((2==cursor)||(3==cursor))) + if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) { for(i = 0; i < screen_update; i++) screens[i].puts_style_offset(0, filename_offset[i] + - PM_HEIGHT + 4, buf, STYLE_INVERT,0); + PM_HEIGHT + 3, buf, STYLE_INVERT,0); } else { for(i = 0; i < screen_update; i++) screens[i].puts(0, filename_offset[i] + - PM_HEIGHT + 4, buf); + PM_HEIGHT + 3, buf); } snprintf(buf, sizeof(buf), "%s:%s", @@ -2123,17 +1525,17 @@ fmt_gain(SOUND_RIGHT_GAIN, global_settings.rec_right_gain, buf2, sizeof(buf2))); - if(global_settings.invert_cursor && ((2==cursor)||(4==cursor))) + if(global_settings.invert_cursor && ((1==cursor)||(3==cursor))) { for(i = 0; i < screen_update; i++) screens[i].puts_style_offset(0, filename_offset[i] + - PM_HEIGHT + 5, buf, STYLE_INVERT,0); + PM_HEIGHT + 4, buf, STYLE_INVERT,0); } else { for(i = 0; i < screen_update; i++) screens[i].puts(0, filename_offset[i] + - PM_HEIGHT + 5, buf); + PM_HEIGHT + 4, buf); } } @@ -2145,18 +1547,18 @@ #ifdef HAVE_FMRADIO_IN case AUDIO_SRC_FMRADIO: #endif - line[i] = 6; + line[i] = 5; break; case AUDIO_SRC_MIC: - line[i] = 5; + line[i] = 4; break; #ifdef HAVE_SPDIF_IN case AUDIO_SRC_SPDIF: - line[i] = 4; + line[i] = 3; break; #endif default: - line[i] = 6; /* to prevent uninitialisation + line[i] = 5; /* to prevent uninitialisation warnings for line[0] */ break; } /* end switch */ @@ -2169,7 +1571,7 @@ else display_agc[i] = true; - if ((cursor==5) || (cursor==6)) + if ((cursor==4) || (cursor==5)) display_agc[i] = true; } @@ -2182,7 +1584,7 @@ lcd_putsxy(LCD_WIDTH/2 + 3, LCD_HEIGHT - 8, buf); ***********************************************/ - if (cursor == 6) + if (cursor == 5) snprintf(buf, sizeof(buf), "%s: %s", str(LANG_SYSFONT_RECORDING_AGC_MAXGAIN), fmt_gain(SOUND_LEFT_GAIN, @@ -2209,7 +1611,7 @@ global_settings.rec_right_gain)/2, buf2, sizeof(buf2))); - if(global_settings.invert_cursor && ((cursor==5) || (cursor==6))) + if(global_settings.invert_cursor && ((cursor==4) || (cursor==5))) { for(i = 0; i < screen_update; i++) screens[i].puts_style_offset(0, filename_offset[i] + @@ -2254,36 +1656,30 @@ screen_put_cursorxy(&screens[i], 0, filename_offset[i] + PM_HEIGHT + 3, true); - break; - case 2: - for(i = 0; i < screen_update; i++) - screen_put_cursorxy(&screens[i], 0, - filename_offset[i] + - PM_HEIGHT + 4, 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 + 5, true); + PM_HEIGHT + 4, true); } break; - case 3: + case 2: for(i = 0; i < screen_update; i++) screen_put_cursorxy(&screens[i], 0, filename_offset[i] + - PM_HEIGHT + 4, true); + PM_HEIGHT + 3, true); break; - case 4: + case 3: for(i = 0; i < screen_update; i++) screen_put_cursorxy(&screens[i], 0, filename_offset[i] + - PM_HEIGHT + 5, true); + PM_HEIGHT + 4, true); break; #ifdef HAVE_AGC + case 4: case 5: - case 6: for(i = 0; i < screen_update; i++) screen_put_cursorxy(&screens[i], 0, filename_offset[i] +