From 8cb555460ff79e636a7907fb2589e16db98c8600 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 17 Jul 2020 00:01:32 -0400 Subject: [3/4] Completely remove HWCODEC support 'swcodec' is now always set (and recording_swcodec for recording-capable units) in feature.txt so the manual and language strings don't need to all be fixed up. Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0 --- apps/gui/list.c | 9 --- apps/gui/list.h | 2 - apps/gui/pitchscreen.c | 78 ---------------------- apps/gui/skin_engine/skin_display.c | 2 - apps/gui/skin_engine/skin_tokens.c | 39 +---------- apps/gui/splash.c | 2 +- apps/gui/statusbar.c | 49 +------------- apps/gui/wps.c | 128 ------------------------------------ 8 files changed, 5 insertions(+), 304 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/list.c b/apps/gui/list.c index ce444cc9c2..b1120aa794 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c @@ -317,10 +317,6 @@ static void gui_list_put_selection_on_screen(struct gui_synclist * gui_list, static void edge_beep(struct gui_synclist * gui_list, bool wrap) { -#if CONFIG_CODEC != SWCODEC - (void)gui_list; - (void)wrap; -#else if (global_settings.keyclick) { list_speak_item *cb = gui_list->callback_speak_item; @@ -354,7 +350,6 @@ static void edge_beep(struct gui_synclist * gui_list, bool wrap) talk_force_shutup(); } } -#endif } static void _gui_synclist_speak_item(struct gui_synclist *lists) @@ -615,7 +610,6 @@ static void gui_synclist_scroll_left(struct gui_synclist * lists) } #endif /* HAVE_LCD_BITMAP */ -#if CONFIG_CODEC == SWCODEC bool gui_synclist_keyclick_callback(int action, void* data) { struct gui_synclist *lists = (struct gui_synclist *)data; @@ -633,7 +627,6 @@ bool gui_synclist_keyclick_callback(int action, void* data) return action != ACTION_NONE; } -#endif /* * Magic to make sure the list gets updated correctly if the skin does @@ -864,9 +857,7 @@ bool list_do_action(int context, int timeout, do_button, and places the action from get_action in *action. */ { timeout = list_do_action_timeout(lists, timeout); -#if CONFIG_CODEC == SWCODEC keyclick_set_callback(gui_synclist_keyclick_callback, lists); -#endif *action = get_action(context, timeout); return gui_synclist_do_button(lists, action, wrap); } diff --git a/apps/gui/list.h b/apps/gui/list.h index 1be9da496a..9107bf0591 100644 --- a/apps/gui/list.h +++ b/apps/gui/list.h @@ -170,9 +170,7 @@ extern void gui_synclist_hide_selection_marker(struct gui_synclist *lists, extern bool gui_synclist_item_is_onscreen(struct gui_synclist *lists, enum screen_type screen, int item); -#if CONFIG_CODEC == SWCODEC extern bool gui_synclist_keyclick_callback(int action, void* data); -#endif /* * Do the action implied by the given button, * returns true if the action was handled. diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index bf016fdd5f..0d31193fa6 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c @@ -38,9 +38,7 @@ #include "misc.h" #include "pitchscreen.h" #include "settings.h" -#if CONFIG_CODEC == SWCODEC #include "tdspeed.h" -#endif #define ICON_BORDER 12 /* icons are currently 7x8, so add ~2 pixels */ /* on both sides when drawing */ @@ -167,13 +165,9 @@ static bool at_limit = false; static void speak_pitch_mode(bool enqueue) { -#if CONFIG_CODEC == SWCODEC bool timestretch_mode = global_settings.pitch_mode_timestretch && dsp_timestretch_available(); if (timestretch_mode) talk_id(VOICE_PITCH_TIMESTRETCH_MODE, enqueue); -#else -#define timestretch_mode 0 -#endif if (global_settings.pitch_mode_semitone) talk_id(VOICE_PITCH_SEMITONE_MODE, timestretch_mode ? true : enqueue); else @@ -238,9 +232,7 @@ static void pitchscreen_draw_icons(struct screen *display, static void pitchscreen_draw(struct screen *display, int max_lines, struct viewport pitch_viewports[PITCH_ITEM_COUNT], int32_t pitch, int32_t semitone -#if CONFIG_CODEC == SWCODEC ,int32_t speed -#endif ) { const char* ptr; @@ -308,7 +300,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines, /* Middle section upper line - hide for a small screen */ if ((show_lang_pitch = (max_lines >= 3))) { -#if CONFIG_CODEC == SWCODEC if(global_settings.pitch_mode_timestretch) { /* Pitch:XXX.X% */ @@ -330,7 +321,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines, } } else -#endif { /* Rate */ snprintf(buf, sizeof(buf), "%s:", str(LANG_PLAYBACK_RATE)); @@ -344,7 +334,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines, /* Middle section lower line */ /* "Speed:XXX%" */ -#if CONFIG_CODEC == SWCODEC if(global_settings.pitch_mode_timestretch) { snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_SPEED), @@ -352,7 +341,6 @@ static void pitchscreen_draw(struct screen *display, int max_lines, (speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); } else -#endif { if(global_settings.pitch_mode_semitone) { @@ -396,13 +384,11 @@ static void pitchscreen_draw(struct screen *display, int max_lines, /* Middle section left/right labels */ const char *leftlabel = "-2%"; const char *rightlabel = "+2%"; -#if CONFIG_CODEC == SWCODEC if (global_settings.pitch_mode_timestretch) { leftlabel = "<<"; rightlabel = ">>"; } -#endif /* Only display if they fit */ display->getstringsize(leftlabel, &w, &h); @@ -423,16 +409,12 @@ static void pitchscreen_draw(struct screen *display, int max_lines, } static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cutoff -#if CONFIG_CODEC == SWCODEC /* need this to maintain correct pitch/speed caps */ , int32_t speed -#endif ) { int32_t new_pitch; -#if CONFIG_CODEC == SWCODEC int32_t new_stretch; -#endif at_limit = false; if (pitch_delta < 0) @@ -480,7 +462,6 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut /* pitch_delta == 0 -> no real change */ return pitch; } -#if CONFIG_CODEC == SWCODEC if (dsp_timestretch_available()) { /* increase the multiple to increase precision of this calculation */ @@ -504,7 +485,6 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut at_limit = true; } } -#endif sound_set_pitch(new_pitch); @@ -579,9 +559,7 @@ static int32_t get_pitch_from_semitone(int32_t semitone) static int32_t pitch_increase_semitone(int32_t pitch, int32_t current_semitone, int32_t semitone_delta -#if CONFIG_CODEC == SWCODEC , int32_t speed -#endif ) { int32_t new_semitone = current_semitone; @@ -613,7 +591,6 @@ static int32_t pitch_increase_semitone(int32_t pitch, int32_t new_pitch = get_pitch_from_semitone(new_semitone); -#if CONFIG_CODEC == SWCODEC int32_t new_stretch = GET_STRETCH(new_pitch, speed); /* clamp the pitch so it doesn't go beyond the stretch limits */ @@ -629,12 +606,9 @@ static int32_t pitch_increase_semitone(int32_t pitch, new_semitone = get_semitone_from_pitch(new_pitch); at_limit = true; } -#endif pitch_increase(pitch, new_pitch - pitch, false -#if CONFIG_CODEC == SWCODEC , speed -#endif ); return new_semitone; @@ -765,7 +739,6 @@ int gui_syncpitchscreen_run(void) push_current_activity(ACTIVITY_PITCHSCREEN); -#if CONFIG_CODEC == SWCODEC int32_t new_speed = 0, new_stretch; /* the speed variable holds the apparent speed of the playback */ @@ -785,7 +758,6 @@ int gui_syncpitchscreen_run(void) global_settings.pitch_mode_timestretch = false; settings_save(); } -#endif /* Count decimals for speaking */ for (i = PITCH_SPEED_PRECISION; i >= 10; i /= 10) @@ -806,23 +778,17 @@ int gui_syncpitchscreen_run(void) /* also, draw the icons now, it's only needed once */ pitchscreen_draw_icons(&screens[i], &parent[i]); } -#if CONFIG_CODEC == SWCODEC pcmbuf_set_low_latency(true); -#endif while (!exit) { FOR_NB_SCREENS(i) pitchscreen_draw(&screens[i], max_lines[i], pitch_viewports[i], pitch, semitone -#if CONFIG_CODEC == SWCODEC , speed -#endif ); pitch_delta = 0; -#if CONFIG_CODEC == SWCODEC new_speed = 0; -#endif if (global_settings.talk_menu && updated) { @@ -835,29 +801,23 @@ int gui_syncpitchscreen_run(void) else talk_value_decimal(pitch, UNIT_PERCENT, decimals, false); break; -#if CONFIG_CODEC == SWCODEC case 2: talk_value_decimal(speed, UNIT_PERCENT, decimals, false); break; -#endif case 3: speak_pitch_mode(false); break; case 4: -#if CONFIG_CODEC == SWCODEC if (global_settings.pitch_mode_timestretch && dsp_timestretch_available()) talk_id(LANG_PITCH, false); else -#endif talk_id(LANG_PLAYBACK_RATE, false); talk_value_decimal(pitch, UNIT_PERCENT, decimals, true); -#if CONFIG_CODEC == SWCODEC if (global_settings.pitch_mode_timestretch && dsp_timestretch_available()) { talk_id(LANG_SPEED, true); talk_value_decimal(speed, UNIT_PERCENT, decimals, true); } -#endif speak_pitch_mode(true); break; default: @@ -910,24 +870,17 @@ int gui_syncpitchscreen_run(void) break; case ACTION_PS_NUDGE_RIGHT: -#if CONFIG_CODEC == SWCODEC if (!global_settings.pitch_mode_timestretch) { -#endif new_pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false -#if CONFIG_CODEC == SWCODEC , speed -#endif ); nudged = (new_pitch != pitch); pitch = new_pitch; semitone = get_semitone_from_pitch(pitch); -#if CONFIG_CODEC == SWCODEC speed = pitch; -#endif updated = nudged ? 1 : 0; break; -#if CONFIG_CODEC == SWCODEC } else { @@ -948,19 +901,14 @@ int gui_syncpitchscreen_run(void) updated = 2; } break; -#endif case ACTION_PS_NUDGE_RIGHTOFF: if (nudged) { pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false -#if CONFIG_CODEC == SWCODEC , speed -#endif ); -#if CONFIG_CODEC == SWCODEC speed = pitch; -#endif semitone = get_semitone_from_pitch(pitch); nudged = false; updated = 1; @@ -968,24 +916,17 @@ int gui_syncpitchscreen_run(void) break; case ACTION_PS_NUDGE_LEFT: -#if CONFIG_CODEC == SWCODEC if (!global_settings.pitch_mode_timestretch) { -#endif new_pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false -#if CONFIG_CODEC == SWCODEC , speed -#endif ); nudged = (new_pitch != pitch); pitch = new_pitch; semitone = get_semitone_from_pitch(pitch); -#if CONFIG_CODEC == SWCODEC speed = pitch; -#endif updated = nudged ? 1 : 0; break; -#if CONFIG_CODEC == SWCODEC } else { @@ -1006,19 +947,14 @@ int gui_syncpitchscreen_run(void) updated = 2; } break; -#endif case ACTION_PS_NUDGE_LEFTOFF: if (nudged) { pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false -#if CONFIG_CODEC == SWCODEC , speed -#endif ); -#if CONFIG_CODEC == SWCODEC speed = pitch; -#endif semitone = get_semitone_from_pitch(pitch); nudged = false; updated = 1; @@ -1028,21 +964,18 @@ int gui_syncpitchscreen_run(void) case ACTION_PS_RESET: pitch = PITCH_SPEED_100; sound_set_pitch(pitch); -#if CONFIG_CODEC == SWCODEC speed = PITCH_SPEED_100; if (dsp_timestretch_available()) { dsp_set_timestretch(PITCH_SPEED_100); at_limit = false; } -#endif semitone = get_semitone_from_pitch(pitch); updated = 4; break; case ACTION_PS_TOGGLE_MODE: global_settings.pitch_mode_semitone = !global_settings.pitch_mode_semitone; -#if CONFIG_CODEC == SWCODEC if (dsp_timestretch_available() && !global_settings.pitch_mode_semitone) { @@ -1055,7 +988,6 @@ int gui_syncpitchscreen_run(void) } } settings_save(); -#endif updated = 3; break; @@ -1073,22 +1005,17 @@ int gui_syncpitchscreen_run(void) if (global_settings.pitch_mode_semitone) { semitone = pitch_increase_semitone(pitch, semitone, pitch_delta -#if CONFIG_CODEC == SWCODEC , speed -#endif ); pitch = get_pitch_from_semitone(semitone); } else { pitch = pitch_increase(pitch, pitch_delta, true -#if CONFIG_CODEC == SWCODEC , speed -#endif ); semitone = get_semitone_from_pitch(pitch); } -#if CONFIG_CODEC == SWCODEC if (global_settings.pitch_mode_timestretch) { /* do this to make sure we properly obey the stretch limits */ @@ -1098,10 +1025,8 @@ int gui_syncpitchscreen_run(void) { speed = pitch; } -#endif } -#if CONFIG_CODEC == SWCODEC if(new_speed) { new_stretch = GET_STRETCH(pitch, new_speed); @@ -1135,11 +1060,8 @@ int gui_syncpitchscreen_run(void) /* when needed */ new_speed = 0; } -#endif } -#if CONFIG_CODEC == SWCODEC pcmbuf_set_low_latency(false); -#endif pop_current_activity(); return 0; } diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 7ee349b346..345d74b65c 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -57,9 +57,7 @@ #endif #include "cuesheet.h" -#if CONFIG_CODEC == SWCODEC #include "playback.h" -#endif #include "backdrop.h" #include "viewport.h" #if CONFIG_TUNER diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 50704fd66e..2528a0af55 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -47,10 +47,8 @@ #include "albumart.h" #endif #include "playlist.h" -#if CONFIG_CODEC == SWCODEC #include "playback.h" #include "tdspeed.h" -#endif #include "viewport.h" #include "tagcache.h" @@ -558,18 +556,16 @@ static struct mp3entry* get_mp3entry_from_offset(int offset, char **filename) static char filename_buf[MAX_PATH + 1]; fname = playlist_peek(offset, filename_buf, sizeof(filename_buf)); *filename = (char*)fname; -#if CONFIG_CODEC == SWCODEC static struct mp3entry tempid3; if ( #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) tagcache_fill_tags(&tempid3, fname) || -#endif +#endif audio_peek_track(&tempid3, offset) ) { pid3 = &tempid3; } -#endif } return pid3; } @@ -1224,7 +1220,6 @@ const char *get_token_value(struct gui_wps *gwps, } #endif -#if (CONFIG_CODEC == SWCODEC) case SKIN_TOKEN_CROSSFADE: #ifdef HAVE_CROSSFADE if (intval) @@ -1277,7 +1272,6 @@ const char *get_token_value(struct gui_wps *gwps, } return buf; } -#endif /* (CONFIG_CODEC == SWCODEC) */ #if defined (HAVE_PITCHCONTROL) case SKIN_TOKEN_SOUND_PITCH: @@ -1294,7 +1288,7 @@ const char *get_token_value(struct gui_wps *gwps, } #endif -#if (CONFIG_CODEC == SWCODEC) && defined (HAVE_PITCHCONTROL) +#if defined (HAVE_PITCHCONTROL) case SKIN_TOKEN_SOUND_SPEED: { int32_t pitch = sound_get_pitch(); @@ -1462,7 +1456,6 @@ const char *get_token_value(struct gui_wps *gwps, return NULL; case SKIN_TOKEN_REC_FREQ: /* order from REC_FREQ_CFG_VAL_LIST */ { -#if CONFIG_CODEC == SWCODEC unsigned long samprk; int rec_freq = global_settings.rec_frequency; @@ -1528,26 +1521,8 @@ const char *get_token_value(struct gui_wps *gwps, } } snprintf(buf, buf_size, "%lu.%1lu", samprk/1000,samprk%1000); -#else /* HWCODEC */ - - static const char * const freq_strings[] = - {"--", "44", "48", "32", "22", "24", "16"}; - int freq = 1 + global_settings.rec_frequency; -#ifdef HAVE_SPDIF_REC - if (global_settings.rec_source == AUDIO_SRC_SPDIF) - { - /* Can't measure S/PDIF sample rate on Archos/Sim yet */ - freq = 0; - } -#endif /* HAVE_SPDIF_IN */ - if (intval) - *intval = freq+1; /* so the token gets a value 1<=x<=7 */ - snprintf(buf, buf_size, "%s\n", - freq_strings[global_settings.rec_frequency]); -#endif return buf; } -#if CONFIG_CODEC == SWCODEC case SKIN_TOKEN_REC_ENCODER: { int rec_format = global_settings.rec_format+1; /* WAV, AIFF, WV, MPEG */ @@ -1568,9 +1543,7 @@ const char *get_token_value(struct gui_wps *gwps, } break; } -#endif case SKIN_TOKEN_REC_BITRATE: -#if CONFIG_CODEC == SWCODEC if (global_settings.rec_format == REC_FORMAT_MPA_L3) { if (intval) @@ -1632,17 +1605,11 @@ const char *get_token_value(struct gui_wps *gwps, } else return NULL; /* Fixme later */ -#else /* CONFIG_CODEC == HWCODEC */ - if (intval) - *intval = global_settings.rec_quality+1; - snprintf(buf, buf_size, "%d", global_settings.rec_quality); - return buf; -#endif case SKIN_TOKEN_REC_MONO: if (!global_settings.rec_channels) return "m"; return NULL; - + case SKIN_TOKEN_REC_SECONDS: { int time = (audio_recorded_time() / HZ) % 60; diff --git a/apps/gui/splash.c b/apps/gui/splash.c index 56df77d57a..fa2c21768a 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c @@ -199,7 +199,7 @@ void splashf(int ticks, const char *fmt, ...) void splash(int ticks, const char *str) { -#if !defined(SIMULATOR) || CONFIG_CODEC == SWCODEC +#if !defined(SIMULATOR) long id; /* fmt may be a so called virtual pointer. See settings.h. */ if((id = P2ID((const unsigned char*)str)) >= 0) diff --git a/apps/gui/statusbar.c b/apps/gui/statusbar.c index 90d04a7930..0c8f54f749 100644 --- a/apps/gui/statusbar.c +++ b/apps/gui/statusbar.c @@ -27,9 +27,7 @@ #include "sound.h" #include "settings.h" #include "viewport.h" -#if CONFIG_CODEC == SWCODEC #include "metadata.h" -#endif #include "icons.h" #include "powermgmt.h" #include "usb.h" @@ -602,7 +600,6 @@ static void gui_statusbar_time(struct screen * display, struct tm *time) #endif #ifdef HAVE_RECORDING -#if CONFIG_CODEC == SWCODEC /** * Write a number to the display using bitmaps and return new position */ @@ -650,7 +647,7 @@ static void gui_statusbar_write_format_info(struct screen * display) xpos += BM_GLYPH_WIDTH; } } - + /* Show bitmap - clipping right edge if needed */ display->mono_bitmap_part(bm, 0, 0, STATUSBAR_ENCODER_WIDTH, @@ -695,58 +692,14 @@ static void gui_statusbar_write_samplerate_info(struct screen * display) STATUSBAR_Y_POS, BM_GLYPH_WIDTH, STATUSBAR_HEIGHT); } -#endif /* CONFIG_CODEC == SWCODEC */ static void gui_statusbar_icon_recording_info(struct screen * display) { -#if CONFIG_CODEC != SWCODEC - char buffer[3]; - const char *p = buffer; - int width, height; - display->setfont(FONT_SYSFIXED); -#endif /* CONFIG_CODEC != SWCODEC */ - /* Display Codec info in statusbar */ -#if CONFIG_CODEC == SWCODEC gui_statusbar_write_format_info(display); -#else /* !SWCODEC */ - display->mono_bitmap(bitmap_icons_5x8[Icon_q], - STATUSBAR_ENCODER_X_POS + 8, STATUSBAR_Y_POS, - 5, STATUSBAR_HEIGHT); - - snprintf(buffer, sizeof(buffer), "%d", global_settings.rec_quality); - display->getstringsize(buffer, &width, &height); - if (height <= STATUSBAR_HEIGHT) - display->putsxy(STATUSBAR_ENCODER_X_POS + 13, STATUSBAR_Y_POS, buffer); -#endif /* CONFIG_CODEC == SWCODEC */ /* Display Samplerate info in statusbar */ -#if CONFIG_CODEC == SWCODEC - /* SWCODEC targets use bitmaps for glyphs */ gui_statusbar_write_samplerate_info(display); -#else /* !SWCODEC */ - /* hwcodec targets have sysfont characters */ -#ifdef HAVE_SPDIF_REC - if (global_settings.rec_source == AUDIO_SRC_SPDIF) - { - /* Can't measure S/PDIF sample rate on Archos/Sim yet */ - p = "--"; - } - else -#endif /* HAVE_SPDIF_IN */ - { - static const char * const freq_strings[] = - {"44", "48", "32", "22", "24", "16"}; - p = freq_strings[global_settings.rec_frequency]; - } - - display->getstringsize(p, &width, &height); - - if (height <= STATUSBAR_HEIGHT) - display->putsxy(STATUSBAR_RECFREQ_X_POS, STATUSBAR_Y_POS, p); - - display->setfont(FONT_UI); -#endif /* CONFIG_CODEC == SWCODEC */ /* Display Channel status in status bar */ if(global_settings.rec_channels) diff --git a/apps/gui/wps.c b/apps/gui/wps.c index b417f82922..82321ff945 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -33,7 +33,6 @@ #include "filetypes.h" #include "settings.h" #include "skin_engine/skin_engine.h" -#include "mp3_playback.h" #include "audio.h" #include "usb.h" #include "status.h" @@ -124,26 +123,17 @@ static void update_non_static(void) void pause_action(bool may_fade, bool updatewps) { -#if CONFIG_CODEC == SWCODEC /* Do audio first, then update, unless skin were to use its local status in which case, reverse it */ audio_pause(); if (updatewps) update_non_static(); -#else - if (may_fade && global_settings.fade_on_stop) - fade(false, updatewps); - else - audio_pause(); -#endif if (global_settings.pause_rewind) { long newpos; -#if (CONFIG_CODEC == SWCODEC) audio_pre_ff_rewind(); -#endif newpos = audio_current_track()->elapsed - global_settings.pause_rewind * 1000; audio_ff_rewind(newpos > 0 ? newpos : 0); @@ -154,80 +144,16 @@ void pause_action(bool may_fade, bool updatewps) void unpause_action(bool may_fade, bool updatewps) { -#if CONFIG_CODEC == SWCODEC /* Do audio first, then update, unless skin were to use its local status in which case, reverse it */ audio_resume(); if (updatewps) update_non_static(); -#else - if (may_fade && global_settings.fade_on_stop) - fade(true, updatewps); - else - audio_resume(); -#endif (void)may_fade; } -#if CONFIG_CODEC != SWCODEC -void fade(bool fade_in, bool updatewps) -{ - int fp_global_vol = global_settings.volume << 8; - int fp_min_vol = sound_min(SOUND_VOLUME) << 8; - int fp_step = (fp_global_vol - fp_min_vol) / 10; - - skin_get_global_state()->is_fading = !fade_in; - if (fade_in) { - /* fade in */ - int fp_volume = fp_min_vol; - - /* zero out the sound */ - sound_set_volume(fp_min_vol >> 8); - - sleep(HZ/10); /* let audio thread run */ - audio_resume(); - - if (updatewps) - update_non_static(); - - while (fp_volume < fp_global_vol - fp_step) { - fp_volume += fp_step; - sound_set_volume(fp_volume >> 8); - sleep(1); - } - sound_set_volume(global_settings.volume); - } - else { - /* fade out */ - int fp_volume = fp_global_vol; - - if (updatewps) - update_non_static(); - - while (fp_volume > fp_min_vol + fp_step) { - fp_volume -= fp_step; - sound_set_volume(fp_volume >> 8); - sleep(1); - } - audio_pause(); - - skin_get_global_state()->is_fading = false; -#if CONFIG_CODEC != SWCODEC -#ifndef SIMULATOR - /* let audio thread run and wait for the mas to run out of data */ - while (!mp3_pause_done()) -#endif - sleep(HZ/10); -#endif - - /* reset volume to what it was before the fade */ - sound_set_volume(global_settings.volume); - } -} -#endif /* SWCODEC */ - static bool update_onvol_change(enum screen_type screen) { skin_update(WPS, screen, SKIN_REFRESH_NON_STATIC); @@ -264,17 +190,8 @@ static int skintouch_to_wps(struct wps_data *data) #endif case ACTION_TOUCH_SCROLLBAR: skin_get_global_state()->id3->elapsed = skin_get_global_state()->id3->length*offset/100; -#if (CONFIG_CODEC == SWCODEC) audio_pre_ff_rewind(); -#else - if (!skin_get_global_state()->paused) - audio_pause(); -#endif audio_ff_rewind(skin_get_global_state()->id3->elapsed); -#if (CONFIG_CODEC != SWCODEC) - if (!skin_get_global_state()->paused) - audio_resume(); -#endif return ACTION_TOUCHSCREEN; case ACTION_TOUCH_VOLUME: { @@ -344,12 +261,7 @@ bool ffwd_rew(int button) if ( (audio_status() & AUDIO_STATUS_PLAY) && skin_get_global_state()->id3 && skin_get_global_state()->id3->length ) { -#if (CONFIG_CODEC == SWCODEC) audio_pre_ff_rewind(); -#else - if (!skin_get_global_state()->paused) - audio_pause(); -#endif if (direction > 0) status_set_ffmode(STATUS_FASTFORWARD); else @@ -393,10 +305,6 @@ bool ffwd_rew(int button) skin_get_global_state()->ff_rewind_count = 0; skin_get_global_state()->ff_rewind = false; status_set_ffmode(0); -#if (CONFIG_CODEC != SWCODEC) - if (!skin_get_global_state()->paused) - audio_resume(); -#endif exit = true; break; @@ -495,19 +403,8 @@ static void prev_track(unsigned long skip_thresh) return; } -#if (CONFIG_CODEC == SWCODEC) audio_pre_ff_rewind(); -#else - if (!state->paused) - audio_pause(); -#endif - audio_ff_rewind(0); - -#if (CONFIG_CODEC != SWCODEC) - if (!state->paused) - audio_resume(); -#endif } } @@ -573,9 +470,7 @@ static void play_hop(int direction) } else if (direction == 1 && step >= remaining) { -#if CONFIG_CODEC == SWCODEC system_sound_play(SOUND_TRACK_NO_MORE); -#endif return; } else if (direction == -1 && elapsed < step) @@ -588,21 +483,10 @@ static void play_hop(int direction) } if(audio_status() & AUDIO_STATUS_PLAY) { -#if (CONFIG_CODEC == SWCODEC) audio_pre_ff_rewind(); -#else - if (!state->paused) - audio_pause(); -#endif } -#if (CONFIG_CODEC == SWCODEC) audio_ff_rewind(elapsed); -#else - audio_ff_rewind(state->id3->elapsed = elapsed); - if (!state->paused) - audio_resume(); -#endif } @@ -867,12 +751,7 @@ long gui_wps_show(void) { if (state->id3->cuesheet) { -#if (CONFIG_CODEC == SWCODEC) audio_pre_ff_rewind(); -#else - if (!state->paused) - audio_pause(); -#endif audio_ff_rewind(0); } else @@ -1128,13 +1007,8 @@ long gui_wps_show(void) } if (exit) { -#if CONFIG_CODEC != SWCODEC - if (global_settings.fade_on_stop) - fade(false, true); -#else audio_pause(); update_non_static(); -#endif if (bookmark) bookmark_autobookmark(true); audio_stop(); @@ -1200,11 +1074,9 @@ static void wps_state_init(void) /* add the WPS track event callbacks */ add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_info_callback); add_event(PLAYBACK_EVENT_NEXTTRACKID3_AVAILABLE, track_info_callback); -#if CONFIG_CODEC == SWCODEC /* Use the same callback as ..._TRACK_CHANGE for when remaining handles have finished */ add_event(PLAYBACK_EVENT_CUR_TRACK_READY, track_info_callback); -#endif #ifdef AUDIO_FAST_SKIP_PREVIEW add_event(PLAYBACK_EVENT_TRACK_SKIP, track_info_callback); #endif -- cgit v1.2.3