Old CD version have problem with Microsoft "security updates" that broke music loop play in some old games on WinVista\+higher. If OGG not looping...
Are you sure it is not how old Windows version always work? Maybe only DOS was looped? .cda will not play properly on current Windows without compatibility wrapping fixes (custom dll, yes). But OGG already use some Win7+ compatible one dll... hm...
I can be wrong here... Not sure how it actually should be for CD and for GOG. Can you double check everything?
If this is compatibility issue fix dll file (not heroes2 specific, but general one) - it not needed normally for OGG (and so for GOG Win buidl), but only for playing music from CD disk or image file.
and maybe you want to keep first drive for actual physical drive
Did that needed for some things?
second, it is a problem if you want to create custom soundtrack
If you mean LOSSLESS quality - it is .cda, not flac. Especially not flac that can be founded online (mp3->flac converts, usually happened for GOG's soundtracks too, did they do that or found existed flac on music torrents). be careful with any "LOSSLESS" downloads. best variant - make it by yourself.
Maybe there is a way to grab it and put to the game as WAV tracks...? Shuld be another dll solution than...
In general, OGG is enough quality to listen in game. IMO... But sometimes GOG indeed can do very_\poor quality releases sometimes, especially if Win version is actually a "bonus_content" and never be updated\fixed since build created.
I am not sure how it interacts, if at all, with the music
Something was changed\wrapped. At least choose between original\remade (addon or windows gold cd version) soundtracks - same as music changer exe file from GOG do.
---------------
Also i cant say for sure for poor quality Windows 10 and 11 updates. They can broke even more things, so even current OS way to play music can be stopped working.
Again, it shouldnt not look like compatibility issue (exactly for compatibility issue). So mentioned winmm.dll file should be Heroes2 specific fix for something initially broken in GOG release. If it is really something broken. Or it just mod to the game to work as it never work for Windows version. If there is a differences in music between DOS and Windows (something was changed along with Windows CD Gold edition).