I have TV connected by optical toslink to speakers. But thay have no remote control. So I bought hifiberry with input/output toslinks. What I want to do is just set volume with rpi.
Everything works, but can’t find how to connect input and output with working volume control.
What works for me is alsaloop, which resends data from input to output.
alsaloop -C hw:1,0 -P hw:0,0
But this command do not send data to mixer, so I cannot regulate volume.
My first thought was just volume control. But I wasn’t able to remap keys on OSMC IR remote to control volume. Remote do not use standard keys for volume.
So, I tried to install OSMC and everything started work. So my next thought was to implement it with OSMC. In this instalation, yes, I just want to create remote volume control for TV. Due to working remote, want to use OSMC.
Toslink does not allow for volume control. Kodi allows you to adjust the volume from within the program lowering it in the PCM stream before it goes out, but it has no way to control another device (like you could with HDMI CEC). If you are trying to control the volume outside of Kodi then this is not possible at all with just a toslink connection.
Why is it impossible? On another installation, using OSMC as media center with TOSLINK connected into receiver and volume controle with Kody works fine.
The volume control works on PCM sound which is generated from the files you play with OSMC/Kodi. OSMC can’t take an audio input from somewhere else, decode it to PCM, adjust the volume, then feed it to TOSlink.
That seems to be what you want. Have I understood it, correctly?
The ALSA ‘bridge’ you have tested will be completely separate from Kodi and its volume control. Kodi doesn’t use alsamixer/amixer controls.
I’m sorry but this is well outside of the scope of this forum and operating system so we would not be able to provide further support.
If your speakers have an analog input I would suggest you look at purchasing a cheap D/A converter with a remote as that would probably be the path of least resistance.
@darwindesign is right - this doesn’t have a lot to do with OSMC, but to get what you have in mind you would first have to get your head round ALSA (the documentation is not great) to get amixer into the audio chain then have to find a way to link remote signals to amixer which could be done direct (search RPi forums) or by making a custom action in Kodi (v steep learning curve).