alsaloop: Renamed field capt_pitch to ctl_pitch

Renaming capt_pitch to ctl_pitch to respect the naming style of
snd_ctl_elem_value_t fields in loopback_handle. Also making the variable
name suitable for planned support of playback pitch.

Signed-off-by: Pavel Hofman <pavel.hofman@ivitera.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Pavel Hofman 2021-10-24 10:31:54 +02:00 committed by Jaroslav Kysela
parent af62c72e2d
commit 59464effec
2 changed files with 9 additions and 9 deletions

View file

@ -122,7 +122,7 @@ struct loopback_handle {
unsigned int ctl_pollfd_count; unsigned int ctl_pollfd_count;
snd_ctl_elem_value_t *ctl_notify; snd_ctl_elem_value_t *ctl_notify;
snd_ctl_elem_value_t *ctl_rate_shift; snd_ctl_elem_value_t *ctl_rate_shift;
snd_ctl_elem_value_t *capt_pitch; snd_ctl_elem_value_t *ctl_pitch;
snd_ctl_elem_value_t *ctl_active; snd_ctl_elem_value_t *ctl_active;
snd_ctl_elem_value_t *ctl_format; snd_ctl_elem_value_t *ctl_format;
snd_ctl_elem_value_t *ctl_rate; snd_ctl_elem_value_t *ctl_rate;

View file

@ -1063,9 +1063,9 @@ static int set_rate_shift(struct loopback_handle *lhandle, double pitch)
if (lhandle->ctl_rate_shift) { if (lhandle->ctl_rate_shift) {
snd_ctl_elem_value_set_integer(lhandle->ctl_rate_shift, 0, pitch * 100000); snd_ctl_elem_value_set_integer(lhandle->ctl_rate_shift, 0, pitch * 100000);
err = snd_ctl_elem_write(lhandle->ctl, lhandle->ctl_rate_shift); err = snd_ctl_elem_write(lhandle->ctl, lhandle->ctl_rate_shift);
} else if (lhandle->capt_pitch) { } else if (lhandle->ctl_pitch) {
snd_ctl_elem_value_set_integer(lhandle->capt_pitch, 0, (1 / pitch) * 1000000); snd_ctl_elem_value_set_integer(lhandle->ctl_pitch, 0, (1 / pitch) * 1000000);
err = snd_ctl_elem_write(lhandle->ctl, lhandle->capt_pitch); err = snd_ctl_elem_write(lhandle->ctl, lhandle->ctl_pitch);
} else { } else {
return 0; return 0;
} }
@ -1252,7 +1252,7 @@ static int openctl(struct loopback_handle *lhandle, int device, int subdevice)
openctl_elem(lhandle, device, subdevice, "PCM Rate Shift 100000", openctl_elem(lhandle, device, subdevice, "PCM Rate Shift 100000",
&lhandle->ctl_rate_shift); &lhandle->ctl_rate_shift);
openctl_elem(lhandle, device, subdevice, "Capture Pitch 1000000", openctl_elem(lhandle, device, subdevice, "Capture Pitch 1000000",
&lhandle->capt_pitch); &lhandle->ctl_pitch);
set_rate_shift(lhandle, 1); set_rate_shift(lhandle, 1);
openctl_elem(lhandle, device, subdevice, "PCM Slave Active", openctl_elem(lhandle, device, subdevice, "PCM Slave Active",
&lhandle->ctl_active); &lhandle->ctl_active);
@ -1338,9 +1338,9 @@ static int closeit(struct loopback_handle *lhandle)
if (lhandle->ctl_rate_shift) if (lhandle->ctl_rate_shift)
snd_ctl_elem_value_free(lhandle->ctl_rate_shift); snd_ctl_elem_value_free(lhandle->ctl_rate_shift);
lhandle->ctl_rate_shift = NULL; lhandle->ctl_rate_shift = NULL;
if (lhandle->capt_pitch) if (lhandle->ctl_pitch)
snd_ctl_elem_value_free(lhandle->capt_pitch); snd_ctl_elem_value_free(lhandle->ctl_pitch);
lhandle->capt_pitch = NULL; lhandle->ctl_pitch = NULL;
if (lhandle->ctl) if (lhandle->ctl)
err = snd_ctl_close(lhandle->ctl); err = snd_ctl_close(lhandle->ctl);
lhandle->ctl = NULL; lhandle->ctl = NULL;
@ -1386,7 +1386,7 @@ int pcmjob_init(struct loopback *loop)
snprintf(id, sizeof(id), "%s/%s", loop->play->id, loop->capt->id); snprintf(id, sizeof(id), "%s/%s", loop->play->id, loop->capt->id);
id[sizeof(id)-1] = '\0'; id[sizeof(id)-1] = '\0';
loop->id = strdup(id); loop->id = strdup(id);
if (loop->sync == SYNC_TYPE_AUTO && (loop->capt->ctl_rate_shift || loop->capt->capt_pitch)) if (loop->sync == SYNC_TYPE_AUTO && (loop->capt->ctl_rate_shift || loop->capt->ctl_pitch))
loop->sync = SYNC_TYPE_CAPTRATESHIFT; loop->sync = SYNC_TYPE_CAPTRATESHIFT;
if (loop->sync == SYNC_TYPE_AUTO && loop->play->ctl_rate_shift) if (loop->sync == SYNC_TYPE_AUTO && loop->play->ctl_rate_shift)
loop->sync = SYNC_TYPE_PLAYRATESHIFT; loop->sync = SYNC_TYPE_PLAYRATESHIFT;