I am having trouble on windows specifically in just adding a spectral monitor to the speakers audio.
I am not generating audio, I just want to get the output from whatever is playing on the machine. In linux this has been fine, as speakers are seen as input devices as well.
But so far on windows, I can not figure out how to pipe the output node into a spectal monitor, or any monitor for that matter.
It sounds like you are trying to capture sound not generated from your app (ie other sounds playing on the machine).
As far as I know Windows does not have native functionality for this and even on Mac OS you need to use a tool called SoundFlower (or Loopback which is paid) to do this. This allows you to set your default system audio output device to âSoundflowerâ and you can then listen to this device as an input in your Cinder app.
There might be windows tools to achieve this (some hardware audio interfaces even have this feature) but unfortunately this is not something that can be solved in Cinder alone.
Thanks @xumo
I took a look at your code (I was not able to compile. I think I was using a different imgui block), but wanted to try and implement what you were showing with the ctx->disable();
However, I still get the same failure.
auto device = audio::Device::findDeviceByName("MY DEVICE");
ctx->disable();
mOutputDeviceNode = ctx->createOutputDeviceNode(device);
ctx->setOutput(mOutputDeviceNode);
ctx->enable();
////
mInputDeviceNode = ctx->createInputDeviceNode(device);
if (mInputDeviceNode)
{
mInputDeviceNode->getChannelMode();
.....///SET UP SPECTRAL NODES PER FOUND CHANNEL (0 by the way)
//THIS IS WHERE I CRASH
mInputDeviceNode->enable();
}
This code produces this error:
Exception thrown at 0x00007FFA8B3FA388 in Test.exe: Microsoft C++ exception: cinder::audio::msw::WasapiExc at memory location 0x0000000000149AA0.
|fatal | cinder::app::AppBase::executeLaunch[197] Uncaught exception, type: class cinder::audio::msw::WasapiExc, what: Failed to check if format is supported (HRESULT: 80070057, âE_INVALIDARGâ)
@felixfaire
Iâm a little optimistic, that surely this must not be so complicatedâŚ
Thanks again for helping out.
I tried this code and had the same error âError Format unsupported by IAudioClientâ at input->enable(); and thatâs because you are trying to initialize a input device node with a reference to an output device.
I think you can only create input node with input devices. Itâs like the input node expects a âreaderâ and not a âwriterâ.
I just dug a little deeper in your example to illustrate something I just realized I misunderstood. At first I thought that you were hooking up outputs to spectral nodesâŚ
But then found that you had mDevices separate from mAudioOutputDevices.
So it appears then that I can not connect the output to spectral then at this point. Perhaps @felixfaire is correct.