mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-19 07:30:34 +02:00
Read alsa_passthrough_ring even if volume is zero. Cache passthrough_volume in loop
This commit is contained in:
parent
7aa38dd6a5
commit
701eedcdcb
@ -362,22 +362,21 @@ void AlsaPlay2Callback(struct alsa_format *alsa_format)
|
||||
// Process Passthroughs
|
||||
//
|
||||
for(unsigned i=0;i<alsa_format->capture_channels;i+=2) {
|
||||
p=alsa_passthrough_ring[alsa_format->card][i/2]->
|
||||
read(alsa_format->passthrough_buffer,4*n)/4;
|
||||
bool zero_volume = true;
|
||||
for (unsigned j=0;j<alsa_format->channels && zero_volume;j+=1) {
|
||||
zero_volume = (alsa_passthrough_volume[alsa_format->card][i/2][j] == 0.0);
|
||||
}
|
||||
if (!zero_volume) {
|
||||
p=alsa_passthrough_ring[alsa_format->card][i/2]->
|
||||
read(alsa_format->passthrough_buffer,4*n)/4;
|
||||
for(unsigned j=0;j<alsa_format->channels;j+=2) {
|
||||
if (alsa_passthrough_volume[alsa_format->card][i/2][j/2] != 0.0) {
|
||||
double passthrough_volume = alsa_passthrough_volume[alsa_format->card][i/2][j/2];
|
||||
if (passthrough_volume != 0.0) {
|
||||
for(unsigned k=0;k<2;k++) {
|
||||
for(int l=0;l<p;l++) {
|
||||
((int16_t *)alsa_format->
|
||||
card_buffer)[alsa_format->channels*l+j+k]+=
|
||||
(int16_t)((double)((int16_t *)
|
||||
alsa_format->passthrough_buffer)[2*l+k]*
|
||||
alsa_passthrough_volume[alsa_format->card][i/2][j/2]);
|
||||
(int16_t)((double)((int16_t *)alsa_format->passthrough_buffer)[2*l+k]*passthrough_volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -485,22 +484,21 @@ void AlsaPlay2Callback(struct alsa_format *alsa_format)
|
||||
// Process Passthroughs
|
||||
//
|
||||
for(unsigned i=0;i<alsa_format->capture_channels;i+=2) {
|
||||
p=alsa_passthrough_ring[alsa_format->card][i/2]->
|
||||
read(alsa_format->passthrough_buffer,8*n)/8;
|
||||
bool zero_volume = true;
|
||||
for (unsigned j=0;j<alsa_format->channels && zero_volume;j+=1) {
|
||||
zero_volume = (alsa_passthrough_volume[alsa_format->card][i/2][j] == 0.0);
|
||||
}
|
||||
if (!zero_volume) {
|
||||
p=alsa_passthrough_ring[alsa_format->card][i/2]->
|
||||
read(alsa_format->passthrough_buffer,8*n)/8;
|
||||
for(unsigned j=0;j<alsa_format->channels;j+=2) {
|
||||
if (alsa_passthrough_volume[alsa_format->card][i/2][j/2] != 0.0) {
|
||||
double passthrough_volume = alsa_passthrough_volume[alsa_format->card][i/2][j/2];
|
||||
if (passthrough_volume != 0.0) {
|
||||
for(unsigned k=0;k<2;k++) {
|
||||
for(int l=0;l<p;l++) {
|
||||
((int32_t *)alsa_format->
|
||||
card_buffer)[alsa_format->channels*l+j+k]+=
|
||||
(int32_t)((double)((int32_t *)
|
||||
alsa_format->passthrough_buffer)[2*l+k]*
|
||||
alsa_passthrough_volume[alsa_format->card][i/2][j/2]);
|
||||
(int32_t)((double)((int32_t *)alsa_format->passthrough_buffer)[2*l+k]*passthrough_volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user