0
votes

In my app i use Midi-dot-net to get NoteON messages and NAudio to play audio samples / notes. In NAudio i'm using ASIO implementation for lower latency and it works perfectly. But i have a problem with controlling volume. Before i used ASIO engine i was able to controll volume this way (some part of the code):

    private void...()
    {
    int NewVolume = ((ushort.MaxValue / 50) * trackWave.Value);
    uint NewVolumeAllChannels = (((uint)NewVolume & 0x0000ffff) | ((uint)NewVolume << 16));
    waveOutSetVolume(IntPtr.Zero, NewVolumeAllChannels);
    volumeN.Text = trackWave.Value.ToString();
    }

When i'm using ASIO implementation in NAudio it's not working, i can only mute sounds, but can't change its volume.

Do you know how can i controll volume by the use of volume slider placed in external Midi controller? Somehow it works when i was testing Steinberg or Synthogy or other audio software producers with ASIO drivers.

Thank you for any help.

1
it does not fix the problem with controlling volume with ASIO drivers :) - Martin

1 Answers

1
votes

with ASIO you change volume by modifying the level of the samples you send to the device. There isn't a concept of device volume. So include a VolumeSampleProvider or similar in your signal chain, and set the volume on that