mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
[Feature] Persist pitch settings through reboots
saves the pitch setting across reboots adds option 'Reset Setting' Change-Id: I75d88f9653883a256c6cca0f7adcdccb2dd51406
This commit is contained in:
parent
5e8d3fec66
commit
13c3214d9c
7 changed files with 126 additions and 10 deletions
|
@ -38,6 +38,11 @@
|
|||
#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
|
||||
|
@ -185,4 +190,36 @@ 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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue