1
0
Fork 0
forked from len0rd/rockbox

[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:
William Wilgus 2025-01-18 23:50:33 -05:00 committed by William Wilgus
parent 3e57ca15a5
commit 4e271642df
12 changed files with 62 additions and 103 deletions

View file

@ -38,11 +38,6 @@
#include "talk.h"
#include "settings.h"
#if defined(HAVE_PITCHCONTROL)
#include "pitchscreen.h"
#include "misc.h"
#include "strcasecmp.h"
#endif
/* Macros to enable logf for queues
logging on SYS_TIMEOUT can be disabled */
#ifdef SIMULATOR
@ -190,39 +185,4 @@ void INIT_ATTR audio_init(void)
audio_is_initialized = true;
sound_settings_apply();
#if defined(HAVE_PITCHCONTROL)
int fd;
char line[64];
char* name;
char* value;
int32_t num;
if (file_exists(PITCH_CFG_FILE))
{
fd = open_utf8(PITCH_CFG_FILE, O_RDONLY);
if (fd >= 0)
{
while (read_line(fd, line, sizeof line) > 0)
{
if (!settings_parseline(line, &name, &value))
continue;
if (strcasecmp(name, "pitch") == 0)
{
num = atoi(value);
if (num != PITCH_SPEED_100)
sound_set_pitch(num);
}
if (strcasecmp(name, "stretch") == 0)
{
num = atoi(value);
if (num != PITCH_SPEED_100)
dsp_set_timestretch(num);
}
}
close(fd);
}
}
#endif
}