The topic pretty much says what I want. I would like to create an executable file which plays a sound from the playback device I want. For example, I want my music to be played through my headphones and while the music is playing, I would like the .exe to play a specified sound file through speakers.
Is this even possible to do with C++? I'm very new to programming, so I don't know much about this kind of stuff. I've looked from around the internet, but I couldn't get a simple answer how to do this, so any help would be highly appreciated.
The first step would be to see if it's even possible to do this on your hardware.
Go in the control panel and open up "Hardware and Sound"... then open up "Sound".
The playback tab will list all of your output devices. If you do not have a different device for your speaker and your headphone jack... then it simply is not possible with your hardware/drivers.
If you DO have separate devices (which is extremely unlikely).... then I'm pretty sure this is possible with DirectSound by enumerating the available output devices and selecting which one you want your output buffer to use.
Most abstracted audio libs simplify the process of playback by assuming only 1 output device (the "default" device.. which is typically your speakers but can be changed by the above mentioned Sound dialog)... so you'll probably have to use DirectSound directly. You might not be able to use something like Bass/FMod (though you might... I haven't looked into the details... these libs might let you select a device). You definitely won't be able to use beginner friendly libs like SDL/SFML for this.
I don't consider any aspect of DirectX to be "Beginner" friendly, though. I'm going to go out on a limb and say this might not be worth pursuing.
If you DO have separate devices (which is extremely unlikely)
I have. Other device is plugged via 3,5mm jack and the other with USB. Maybe should have mentioned that... And yes, I'm on Windows.
Is there some kind of guide how to do this? I can't imagine how it could be too hard to do, because all I want is one audio file to be played through different playback device than the default... If it is possible to select a device that the program uses when playing sounds, I'll have all I need.
Edit (because new reply would be unnecessary): I tried for quite some time to get this work without any results. Maybe I'll have to get some experience in programming first, or maybe I just missed some really simple thing at some point. However, thanks for the effort anyway :)