How to play audio file to specific audio device/devices.

Eliott Duparc 0 Reputation points
2023-02-15T15:28:44.1766667+00:00

How could I play a sound file (preferrably .wav) through a specific audio device that is not the default audio device?

I would also like being able to stop this sound file at any given moment.

Windows for business | Windows Client for IT Pros | User experience | Other
Developer technologies | C++
{count} votes

2 answers

Sort by: Most helpful
  1. Fabricio Godoy 2,626 Reputation points
    2023-02-15T15:57:47.7333333+00:00

    Hello Eliott.

    Yes is possible.

    follow these steps:

    1. Connect the desired audio device to your computer and ensure that it is properly recognized by your operating system.
    2. Open the audio file that you want to play.
    3. Right-click on the volume icon in the taskbar and select "Open Sound settings" or go to Settings > System > Sound.
    4. In the Sound settings, scroll down to the "Advanced sound options" section and click on the "App volume and device preferences" link.
    5. In the "App volume and device preferences" screen, locate the audio file you want to play and click the drop-down arrow next to it.
    6. In the drop-down list, select the audio device you want to play the audio file through.
    7. Click the "Save" button to apply the changes.
    8. Play the audio file and it should now be output to the selected audio device.

    I hope this is help u.

    Regards

    0 comments No comments

  2. Castorix31 90,686 Reputation points
    2023-02-15T16:08:00.9733333+00:00

    A way is with

    waveOutOpen

    waveOutWrite

    with the wanted output device

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.