Have a look at the Listen_to_LineIn_on_Speakers.sh script as an example of how this can be configured. But note you can't use that script out of the box, it also uses Input 1 of the speaker output mixer (same as the playback to speaker script).
It's best to copy the Playback_to_Speakers.sh script to the storage partition, let's say /storage/speaker-setup.sh and make some alterations. You probably also want to change the volumes of Kodi audio output, the signal received on line-in and the speaker output volume.
First, route the line-in signal (IN3L/IN3R) to the second input of speaker out, using the default input gain of 0dB (input volume 32)
amixer cset name="SPKOUTL Input 2" IN3L
amixer cset name="SPKOUTL Input 2 Volume" 32
amixer cset name="SPKOUTR Input 2" IN3R
amixer cset name="SPKOUTR Input 2 Volume" 32
There are several knobs to turn to control the volume. Let's go input-to-output:
"IN3L Volume"/"IN3R Volume" control the analog input gain (before the ADC). Default is 0 (0dB), 1 is +1dB etc. Usually values between 0 and 8 should be OK (depending on the analog signal level).
"IN3L Digital Volume"/"IN3R Digital Volume" control the gain in the digital domain (after the ADC). Usually it's best to keep that at the default 128 which means 0dB (i.e. no volume change).
"SPKOUTL Input 2 Volume"/"SPKOUTR Input 2 Volume" set the output mixer level. Default is 32 which again means 0dB (31 is -1dB, 33 +1dB etc). Adjust these and also the "SPKOUTL/R Input 1 Volume" (RPi/Kodi volume) settings so that the line-in signal and kodi signal are about the same level. But be careful: if you set it above 32 the signal might clip (especially for Kodi output).
"Speaker Digital Volume" sets the speaker output volume, that's your "master volume knob". Default is 128 / 0dB, 127 is -0.5dB etc. Again, better only use values lower or equal to 128 to attenuate the signal, values above 128 may cause clipping.
so long,
Hias
) for absolute beginners?