Exemple #1
0
static int playback_callback(int action,const struct menu_item_ex *this_item)
{
    static bool old_shuffle = false;
    switch (action)
    {
        case ACTION_ENTER_MENUITEM:
            if (this_item == &shuffle_item)
                old_shuffle = global_settings.playlist_shuffle;
            break;
        case ACTION_EXIT_MENUITEM: /* on exit */
            if ((this_item == &shuffle_item) &&
                (old_shuffle != global_settings.playlist_shuffle)
                && (audio_status() & AUDIO_STATUS_PLAY))
            {
#if CONFIG_CODEC == SWCODEC
                dsp_set_replaygain();
#endif
                if (global_settings.playlist_shuffle)
                {
                    playlist_randomise(NULL, current_tick, true);
                }
                else
                {
                    playlist_sort(NULL, true);
                }
            }
            break;
    }
    return action;
}
static bool replaygain_noclip(void)
{
    bool result = set_bool(str(LANG_REPLAYGAIN_NOCLIP), 
        &global_settings.replaygain_noclip);

    dsp_set_replaygain(true);
    return result;
}
static bool replaygain(void)
{
    bool result = set_bool(str(LANG_REPLAYGAIN_ENABLE), 
        &global_settings.replaygain);
        
    dsp_set_replaygain(true);
    return result;
}
static bool replaygain_preamp(void)
{
    bool result = set_int(str(LANG_REPLAYGAIN_PREAMP), str(LANG_UNIT_DB), 
        UNIT_DB, &global_settings.replaygain_preamp, NULL, 1, -120, 120, 
        replaygain_preamp_format);

    dsp_set_replaygain(true);
    return result;
}
Exemple #5
0
static int replaygain_callback(int action,const struct menu_item_ex *this_item)
{
    (void)this_item;
    switch (action)
    {
        case ACTION_EXIT_MENUITEM: /* on exit */    
            dsp_set_replaygain();
            break;
    }
    return action;
}
static bool replaygain_mode(void)
{
    bool result = set_bool_options(str(LANG_REPLAYGAIN_MODE), 
        &global_settings.replaygain_track, 
        STR(LANG_TRACK_GAIN), 
        STR(LANG_ALBUM_GAIN), 
        NULL);

    dsp_set_replaygain(true);
    return result;
}
Exemple #7
0
static int playback_callback(int action,const struct menu_item_ex *this_item)
{
    static bool old_shuffle = false;
    static int old_repeat = 0;
    switch (action)
    {
        case ACTION_ENTER_MENUITEM:
            if (this_item == &shuffle_item)
            {
                old_shuffle = global_settings.playlist_shuffle;
            }
            else if (this_item == &repeat_mode)
            {
                old_repeat = global_settings.repeat_mode;
            }
            break;

        case ACTION_EXIT_MENUITEM: /* on exit */
            if (!(audio_status() & AUDIO_STATUS_PLAY))
                break;

            if (this_item == &shuffle_item)
            {
                if (old_shuffle == global_settings.playlist_shuffle)
                    break;

#if CONFIG_CODEC == SWCODEC
                dsp_set_replaygain();
#endif
                if (global_settings.playlist_shuffle)
                {
                    playlist_randomise(NULL, current_tick, true);
                }
                else
                {
                    playlist_sort(NULL, true);
                }
            }
            else if (this_item == &repeat_mode)
            {
                if (old_repeat == global_settings.repeat_mode)
                    break;

                audio_flush_and_reload_tracks();
            }

            break;
    }
    return action;
}
bool quick_screen_quick(int button_enter)
{
    struct gui_quickscreen qs;
    bool oldshuffle = global_settings.playlist_shuffle;
    int oldrepeat = global_settings.repeat_mode;

    qs.items[QUICKSCREEN_TOP] =
            get_setting(global_settings.qs_items[QUICKSCREEN_TOP],
                        find_setting(&global_settings.party_mode, NULL));
    qs.items[QUICKSCREEN_LEFT] =
            get_setting(global_settings.qs_items[QUICKSCREEN_LEFT],
                        find_setting(&global_settings.playlist_shuffle, NULL));
    qs.items[QUICKSCREEN_RIGHT] =
            get_setting(global_settings.qs_items[QUICKSCREEN_RIGHT],
                        find_setting(&global_settings.repeat_mode, NULL));
    qs.items[QUICKSCREEN_BOTTOM] =
            get_setting(global_settings.qs_items[QUICKSCREEN_BOTTOM],
                        find_setting(&global_settings.dirfilter, NULL));

    qs.callback = NULL;
    if (gui_syncquickscreen_run(&qs, button_enter))
    {
        settings_save();
        settings_apply(false);
        /* make sure repeat/shuffle/any other nasty ones get updated */
        if ( oldrepeat != global_settings.repeat_mode &&
             (audio_status() & AUDIO_STATUS_PLAY) )
        {
            audio_flush_and_reload_tracks();
        }
        if (oldshuffle != global_settings.playlist_shuffle
            && audio_status() & AUDIO_STATUS_PLAY)
        {
#if CONFIG_CODEC == SWCODEC
            dsp_set_replaygain();
#endif
            if (global_settings.playlist_shuffle)
                playlist_randomise(NULL, current_tick, true);
            else
                playlist_sort(NULL, true);
        }
    }
    return(0);
}
Exemple #9
0
void settings_apply(bool read_disk)
{
    
    char buf[64];
#if CONFIG_CODEC == SWCODEC
    int i;
#endif
    sound_settings_apply();

#ifdef HAVE_DISK_STORAGE
    audio_set_buffer_margin(global_settings.buffer_margin);
#endif

#ifdef HAVE_LCD_CONTRAST
    lcd_set_contrast(global_settings.contrast);
#endif
    lcd_scroll_speed(global_settings.scroll_speed);
#ifdef HAVE_REMOTE_LCD
    lcd_remote_set_contrast(global_settings.remote_contrast);
    lcd_remote_set_invert_display(global_settings.remote_invert);

#ifdef HAVE_LCD_FLIP
    lcd_remote_set_flip(global_settings.remote_flip_display);
#endif

    lcd_remote_scroll_speed(global_settings.remote_scroll_speed);
    lcd_remote_scroll_step(global_settings.remote_scroll_step);
    lcd_remote_scroll_delay(global_settings.remote_scroll_delay);
    lcd_remote_bidir_scroll(global_settings.remote_bidir_limit);
#ifdef HAVE_REMOTE_LCD_TICKING
    lcd_remote_emireduce(global_settings.remote_reduce_ticking);
#endif
    remote_backlight_set_timeout(global_settings.remote_backlight_timeout);
#if CONFIG_CHARGING
    remote_backlight_set_timeout_plugged(global_settings.remote_backlight_timeout_plugged);
#endif
#ifdef HAS_REMOTE_BUTTON_HOLD
    remote_backlight_set_on_button_hold(global_settings.remote_backlight_on_button_hold);
#endif
#endif /* HAVE_REMOTE_LCD */
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
    backlight_set_brightness(global_settings.brightness);
#endif
#ifdef HAVE_BACKLIGHT
    backlight_set_timeout(global_settings.backlight_timeout);
#if CONFIG_CHARGING
    backlight_set_timeout_plugged(global_settings.backlight_timeout_plugged);
#endif
#if    defined(HAVE_BACKLIGHT_FADING_INT_SETTING) \
    || defined(HAVE_BACKLIGHT_FADING_BOOL_SETTING)
    backlight_set_fade_in(global_settings.backlight_fade_in);
    backlight_set_fade_out(global_settings.backlight_fade_out);
#endif
#endif
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
    buttonlight_set_brightness(global_settings.buttonlight_brightness);
#endif
#ifdef HAVE_BUTTON_LIGHT
    buttonlight_set_timeout(global_settings.buttonlight_timeout);
#endif
#ifdef HAVE_DISK_STORAGE
    storage_spindown(global_settings.disk_spindown);
#endif
#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
    dac_line_in(global_settings.line_in);
#endif
    set_poweroff_timeout(global_settings.poweroff);

    set_battery_capacity(global_settings.battery_capacity);
#if BATTERY_TYPES_COUNT > 1
    set_battery_type(global_settings.battery_type);
#endif

#ifdef HAVE_LCD_BITMAP
#ifdef HAVE_LCD_INVERT
    lcd_set_invert_display(global_settings.invert);
#endif
#ifdef HAVE_LCD_FLIP
    lcd_set_flip(global_settings.flip_display);
    button_set_flip(global_settings.flip_display);
#endif
    lcd_update(); /* refresh after flipping the screen */
    settings_apply_pm_range();
    peak_meter_init_times(
        global_settings.peak_meter_release, global_settings.peak_meter_hold,
        global_settings.peak_meter_clip_hold);
#endif

#ifdef HAVE_SPEAKER
    audiohw_enable_speaker(global_settings.speaker_enabled);
#endif

    if (read_disk)
    {
#ifdef HAVE_LCD_BITMAP
        /* fonts need to be loaded before the WPS */
        if ( global_settings.font_file[0]) {
            snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
                     global_settings.font_file);
            if (font_load(NULL, buf) < 0)
                font_reset(NULL);
        }
        else
            font_reset(NULL);
#ifdef HAVE_REMOTE_LCD        
        if ( global_settings.remote_font_file[0]) {
            snprintf(buf, sizeof buf, FONT_DIR "/%s.fnt",
                     global_settings.remote_font_file);
            if (font_load_remoteui(buf) < 0)
                font_load_remoteui(NULL);
        }
        else
            font_load_remoteui(NULL);
#endif
        if ( global_settings.kbd_file[0]) {
            snprintf(buf, sizeof buf, ROCKBOX_DIR "/%s.kbd",
                     global_settings.kbd_file);
            load_kbd(buf);
        }
        else
            load_kbd(NULL);
#endif

        if ( global_settings.lang_file[0]) {
            snprintf(buf, sizeof buf, LANG_DIR "/%s.lng",
                     global_settings.lang_file);
            lang_core_load(buf);
            talk_init(); /* use voice of same language */
        }

        /* reload wpses */
        settings_apply_skins();

        /* load the icon set */
        icons_init();

#ifdef HAVE_LCD_COLOR
        if (global_settings.colors_file[0])
            read_color_theme_file();
#endif
    }

#ifdef HAVE_LCD_COLOR
    screens[SCREEN_MAIN].set_foreground(global_settings.fg_color);
    screens[SCREEN_MAIN].set_background(global_settings.bg_color);
    screens[SCREEN_MAIN].set_selector_start(global_settings.lss_color);
    screens[SCREEN_MAIN].set_selector_end(global_settings.lse_color);
    screens[SCREEN_MAIN].set_selector_text(global_settings.lst_color);
#endif

#ifdef HAVE_LCD_BITMAP
    lcd_scroll_step(global_settings.scroll_step);
    gui_list_screen_scroll_step(global_settings.screen_scroll_step);
    gui_list_screen_scroll_out_of_view(global_settings.offset_out_of_view);
#else
    lcd_jump_scroll(global_settings.jump_scroll);
    lcd_jump_scroll_delay(global_settings.jump_scroll_delay);
#endif
    lcd_bidir_scroll(global_settings.bidir_limit);
    lcd_scroll_delay(global_settings.scroll_delay);


    set_codepage(global_settings.default_codepage);

#if CONFIG_CODEC == SWCODEC
#ifdef HAVE_CROSSFADE
    audio_set_crossfade(global_settings.crossfade);
#endif
    dsp_set_replaygain();
    dsp_set_crossfeed(global_settings.crossfeed);
    dsp_set_crossfeed_direct_gain(global_settings.crossfeed_direct_gain);
    dsp_set_crossfeed_cross_params(global_settings.crossfeed_cross_gain,
                                   global_settings.crossfeed_hf_attenuation,
                                   global_settings.crossfeed_hf_cutoff);

    /* Configure software equalizer, hardware eq is handled in audio_init() */
    dsp_set_eq(global_settings.eq_enabled);
    dsp_set_eq_precut(global_settings.eq_precut);
    for(i = 0; i < 5; i++) {
        dsp_set_eq_coefs(i);
    }

    dsp_dither_enable(global_settings.dithering_enabled);
    dsp_timestretch_enable(global_settings.timestretch_enabled);
    dsp_set_compressor(global_settings.compressor_threshold,
                       global_settings.compressor_makeup_gain,
                       global_settings.compressor_ratio,
                       global_settings.compressor_knee,
                       global_settings.compressor_release_time);
#endif

#ifdef HAVE_SPDIF_POWER
    spdif_power_enable(global_settings.spdif_enable);
#endif

#ifdef HAVE_BACKLIGHT
    set_backlight_filter_keypress(global_settings.bl_filter_first_keypress);
#ifdef HAVE_REMOTE_LCD
    set_remote_backlight_filter_keypress(global_settings.remote_bl_filter_first_keypress);
#endif
#ifdef HAS_BUTTON_HOLD
    backlight_set_on_button_hold(global_settings.backlight_on_button_hold);
#endif
#ifdef HAVE_LCD_SLEEP_SETTING
    lcd_set_sleep_after_backlight_off(global_settings.lcd_sleep_after_backlight_off);
#endif
#endif /* HAVE_BACKLIGHT */

#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
    touchpad_set_sensitivity(global_settings.touchpad_sensitivity);
#endif

#ifdef HAVE_USB_CHARGING_ENABLE
    usb_charging_enable(global_settings.usb_charging);
#endif

#ifdef HAVE_TOUCHSCREEN
    touchscreen_set_mode(global_settings.touch_mode);
    memcpy(&calibration_parameters, &global_settings.ts_calibration_data, sizeof(struct touchscreen_parameter));
#endif

    /* This should stay last */
#if defined(HAVE_RECORDING) && CONFIG_CODEC == SWCODEC
    enc_global_settings_apply();
#endif
#ifdef HAVE_LCD_BITMAP
    /* already called with THEME_STATUSBAR in settings_apply_skins() */
    viewportmanager_theme_changed(THEME_UI_VIEWPORT|THEME_LANGUAGE);
#endif
}