mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
parent
318bb0b442
commit
ca17672871
1 changed files with 10 additions and 6 deletions
|
|
@ -686,11 +686,15 @@ static float *read_closest(char **filenames, float gain, int delay, int offset,
|
|||
|
||||
int diff = INT_MAX;
|
||||
uint32_t best = 0, i;
|
||||
float *samples = NULL;
|
||||
|
||||
for (i = 0; i < MAX_RATES && filenames[i] && filenames[i][0]; i++) {
|
||||
fs[i] = sf_open(filenames[i], SFM_READ, &infos[i]);
|
||||
if (!fs[i])
|
||||
if (!fs[i]) {
|
||||
pw_log_error("Can't open file %s: %s", filenames[i],
|
||||
sf_strerror(fs[i]));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (labs((long)infos[i].samplerate - (long)*rate) < diff) {
|
||||
best = i;
|
||||
|
|
@ -698,11 +702,11 @@ static float *read_closest(char **filenames, float gain, int delay, int offset,
|
|||
pw_log_debug("new closest match: %d", infos[i].samplerate);
|
||||
}
|
||||
}
|
||||
|
||||
if (fs[best] != NULL) {
|
||||
pw_log_info("loading best rate:%u %s", infos[best].samplerate, filenames[best]);
|
||||
float *samples = read_samples_from_sf(fs[best], infos[best], gain, delay,
|
||||
samples = read_samples_from_sf(fs[best], infos[best], gain, delay,
|
||||
offset, length, channel, rate, n_samples);
|
||||
|
||||
}
|
||||
for (i = 0; i < MAX_RATES; i++)
|
||||
if (fs[i])
|
||||
sf_close(fs[i]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue