Connect
Ok, got it working. Very cool project! I guess the next feature to add would be for the connectaudio app to be able to receive the name of the config to load as a server command, and then pull that file from the relevant .var and load it. Having to manually load a profile for each scene seems too cumbersome.
 
Well, the assumption is that you use it with VR. In the Oculus software you can set which audio device to use for regular VaM sound, so you can set it to something different that whatever your Windows default is.

If you want to be able to change the audio device within ConnectAudio, you can add something like this to the StartAudio() method in MainWindow.xaml.cs. Obviously you could also build UI and what not...but this is the quick and simple version:
C#:
private void StartAudio()
{
    StopAudio();

    int deviceNumber = -1;
    for (int i = -1; i < WaveOut.DeviceCount; i++)
    {
        var caps = WaveOut.GetCapabilities(i);
        if (caps.ProductName == "Speakers (Realtek(R) Audio)")   // <--- run once to get devices names, then put your favorite device here and recompile
        {
            deviceNumber = i;
            break;
        }
    }

    Log.Message("Available audio devices:");
    for (int i = -1; i < WaveOut.DeviceCount; i++)
    {
        var caps = WaveOut.GetCapabilities(i);
        if (i == deviceNumber)
            Log.Message($"{i}: {caps.ProductName} <= CHOOSEN");
        else
            Log.Message($"{i}: {caps.ProductName}");
    }

    WaveProvider waveProvider = new WaveProvider(myWaveManager);
    myAudio = new WaveOutEvent();
    myAudio.NumberOfBuffers = 2;
    myAudio.DesiredLatency = 60;
    myAudio.DeviceNumber = deviceNumber;
    myAudio.Init(waveProvider);
    myAudio.Play();
}
Thanks for working on this. I sometimes go hard into trying to use and create with VAM, but fizzle out shortly after. My last post was one of those times, and I only now have returned to see your reply.
 
I'll second senorgif2's request that choosing the audio output is an important feature. I wanted to try this, and had to spend a while trying random things before coming here. I'll try the code change and see if that works.

Edit: Update for anyone else trying this out: The code MacGruber posted works and I was able to set it up with my preferred output device.
So i saw the solution, and managed to get a new build (despite my extreme lack of knowledge) that shows all the audio devices and the one that is chosen, however, it still outputs sound to the wrong device. What did I do wrong?

EDIT: I figured it out
 
Back
Top Bottom