mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-26 23:36:37 -04:00
[Feature] Persist pitch settings through reboots part deux
Revisit this after discussion with chris_s on IRC and forum Pitch menu now changes icon when pitch has been changed uses NVRAM to save the pitch settings unconditionally Manual updated Change-Id: Idcb4c2b7fe42f7a203dc4bfc46285657f370d0fd
This commit is contained in:
parent
3e57ca15a5
commit
4e271642df
12 changed files with 62 additions and 103 deletions
|
|
@ -22,11 +22,6 @@
|
|||
#include "plugin.h"
|
||||
#include "lib/icon_helper.h"
|
||||
#include "lib/arg_helper.h"
|
||||
#include "lib/configfile.h"
|
||||
#include "../gui/pitchscreen.h" /*PITCH_CFG_FILE*/
|
||||
|
||||
#define CFG_FILE PITCH_CFG_FILE
|
||||
#define CFG_VER 1
|
||||
|
||||
#define ICON_BORDER 12 /* icons are currently 7x8, so add ~2 pixels */
|
||||
/* on both sides when drawing */
|
||||
|
|
@ -54,12 +49,6 @@ struct pvars
|
|||
};
|
||||
static struct pvars pitch_vars;
|
||||
|
||||
static struct configdata pitchcfg[] =
|
||||
{
|
||||
{TYPE_INT, PITCH_MIN, PITCH_MAX, { .int32_p = &pitch_vars.pitch }, "pitch", NULL},
|
||||
{TYPE_INT, STRETCH_MIN, STRETCH_MAX, { .int32_p = &pitch_vars.stretch }, "stretch", NULL},
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PITCH_TOP = 0,
|
||||
|
|
@ -1229,9 +1218,6 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
bool gui = false;
|
||||
rb->pcmbuf_set_low_latency(true);
|
||||
|
||||
struct pvars cur;
|
||||
fill_pitchvars(&cur);
|
||||
|
||||
/* Figure out whether to be in timestretch mode */
|
||||
if (parameter == NULL) /* gui mode */
|
||||
{
|
||||
|
|
@ -1241,24 +1227,11 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
rb->settings_save();
|
||||
}
|
||||
gui = true;
|
||||
if (rb->file_exists(CFG_FILE))
|
||||
{
|
||||
if (configfile_load(CFG_FILE, pitchcfg, 2, CFG_VER) >= 0)
|
||||
{
|
||||
if (pitch_vars.pitch != cur.pitch || pitch_vars.stretch != cur.stretch)
|
||||
{
|
||||
if (rb->yesno_pop(ID2P(LANG_REVERT_TO_DEFAULT_SETTINGS)))
|
||||
{
|
||||
rb->sound_set_pitch(pitch_vars.pitch);
|
||||
rb->dsp_set_timestretch(pitch_vars.stretch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
struct pvars cur;
|
||||
fill_pitchvars(&cur);
|
||||
fill_pitchvars(&pitch_vars);
|
||||
argparse((const char*) parameter, -1, NULL, &arg_callback);
|
||||
if (pitch_vars.pitch != cur.pitch)
|
||||
|
|
@ -1302,17 +1275,6 @@ enum plugin_status plugin_start(const void* parameter)
|
|||
|
||||
if (gui && gui_syncpitchscreen_run() == 1)
|
||||
return PLUGIN_USB_CONNECTED;
|
||||
|
||||
if (gui)
|
||||
{
|
||||
fill_pitchvars(&pitch_vars);
|
||||
|
||||
if (pitch_vars.pitch != cur.pitch || pitch_vars.stretch != cur.stretch)
|
||||
{
|
||||
if (configfile_save(CFG_FILE, pitchcfg, 2, CFG_VER) < 0)
|
||||
rb->splash(HZ, ID2P(LANG_ERROR_WRITING_CONFIG));
|
||||
}
|
||||
}
|
||||
rb->pcmbuf_set_low_latency(false);
|
||||
return PLUGIN_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue