[SOLVED] Using HDMI audio for ciWMFvideoplayer

I’m trying to play the audio track that accompanies my video through the built-in speakers in my display. I’m using ciWMFVideoPlayer on msw10

I’ve tried changing the following lines:

//mTestVideo.loadMovie(videoPath, "Headphones (High Definition Audio Device)");
mTestVideo.loadMovie(videoPath, "HDMI (High-Definition Multimedia Interface)");

but to no avail… There’s no documentation RE the source URL so I took a shot in the dark. Anyone managed to get this to work?

Hi @Craigson, it should list out the available audio devices. See here. You can use that string as audio source. This needs to be cleaned up and made its own method or something.

You can get the audio device names with ci::audio::Device::getOutputDevices(). This has worked for me.

deviceName = "HDMI";
for (auto audioDevice : ci::audio::Device::getOutputDevices() ) {
	ci::app::console() << "Output device " << audioDevice->getName() << std::endl;
	std::size_t found = audioDevice->getName().find(deviceName);
	if (found != std::string::npos) {
		mAudioOutDevice = audioDevice->getName();
		ci::app::console() << "MAtched device " << audioDevice->getName() << std::endl;
//and then
mMoviePlayer.loadMovie("thVideo.mp4", mAudioOutDevice);

But be aware that the devices name list might show the same device twice, one time as input and the other as output.

1 Like

Thanks that worked a treat. Never worked with the audio API before, should’ve known better and looked there first!j