mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
[BugFix] pitch screen load config fd wasn't closed
check file_exist(PITCH_CFG_FILE) close fd when finished If you already have a setting saved and you reenter the pitch plugin with differing pitch settings you will be asked to restore your default settings update manual entry to be a clearer Change-Id: Iaaaf08983a355f9848412d1c6b0bba25d6ea8f39
This commit is contained in:
parent
a8f6ddc5ed
commit
c4ceea40bf
4 changed files with 49 additions and 31 deletions
|
@ -197,26 +197,29 @@ void INIT_ATTR audio_init(void)
|
|||
char* name;
|
||||
char* value;
|
||||
int32_t num;
|
||||
|
||||
fd = open_utf8(PITCH_CFG_FILE, O_RDONLY);
|
||||
if (fd >= 0)
|
||||
if (file_exists(PITCH_CFG_FILE))
|
||||
{
|
||||
while (read_line(fd, line, sizeof line) > 0)
|
||||
fd = open_utf8(PITCH_CFG_FILE, O_RDONLY);
|
||||
if (fd >= 0)
|
||||
{
|
||||
if (!settings_parseline(line, &name, &value))
|
||||
continue;
|
||||
if (strcasecmp(name, "pitch") == 0)
|
||||
while (read_line(fd, line, sizeof line) > 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);
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue