An obvious first is studying computer audio file formats.
Lets assume we are ripping a CD.
A CD contains 2 channel PCM audio with sample of 16 bit and a sample rate of 44.1 kHz.
We can rip to lossless formats like WAV or AIFF.
We can also rip to a lossless compressed format like FLAC, ALAC, etc.
This saves space but you still have large file sizes.
As in the 90’s HD was very expensive, they invented lossy compression and MP3 is the mother of lossy compression. You throw out information, all that is masked first, then you start to roll of the treble, Huffman encoding, etc.
Obvious, what you throw out is lost forever.
https://www.thewelltemperedcomputer.com/Intro/SQ/audio_formats.html
What happens on playback?
If you look at the back of a DAC you probably see inputs like Toslink (SPDIF over optical), coax (SPDIF over electrical), USB and maybe AES/EBU.
What you don’t see is an input for FLAC, an input for 320 VBR, etc. Luckily as there is a plethora of audio file formats out there.
On playback, you choose a file e.g. a 256 VBR MP3. The media player invokes the appropriate codec e.g. LAME and this codec will decode the MP3 into PCM so we have our 16 bit / 44.1 PCM and this will be send to the DAC using one of its protocols.
What happens if you have different sample rates?
If you do nothing, all files will be played at the rate as set in de audio panel.
If you want automatic sample rate switching, you need a driver bypassing the audio stack of the OS.
In Win this is WASAPI/Exclusive, on a Mac it is hog mode, on Linux it is probably using
hw or
plughw in ALSA but my Linux knowledge is a bit feeble.
So if your DAC don’t switch it is very likely not a problem with the DAC but with the system configuration.