This would take more hardware in the way of splitters and maybe some optical to analog convertor. I take it your TV does not support both at the same time so you get more hardware to make it happen.

The CHEAP EXIT is to connect a splitter to the headphone jack to run to the headphone and soundbar.