My class is not using any unmanaged resources so I am a little confused as to why I need to do this.
Any input would be much appreciated.
Sid
mReader = New AudioFileReader(mCue.FilenameFullPath)
mVolumeController = New SampleProviders.VolumeSampleProvider(mReader.ToSampleProvider())
mWaveOutputDevice = New WaveOut
mWaveOutputDevice.Init(mVolumeController)
AddHandler mWaveOutputDevice.PlaybackStopped, AddressOf HandlePlaybackHasStopped
mWaveOutputDevice.Play()
It is VB.NET code.Hi Mark,
There is only a single sound card in the VM. What I just noticed is that my application is producing a signal when I open the Windows Volume Mixer, that fader was down for some reason. I moved the fader up but still no sound output or signal shown for the Device output in the Volume Mixer. Looks like a routing issue, just don’t know how it got routed that way or how to fix it.
Sid
Hi Theseus, yes the sound does get played through the speakers if I build a release build. This makes me think there is some setting that is persisted. To test this hypothesis, I created a new build configuration, it was based upon the Debug configuration. When I build and run the new debug configuration it works.
So, what settings is NAudio persisting? Where are they persisted?
Sid
Mark, I have been developing in VMs for a very long time, in fact the previous version of the application I am working on was developed entirely in a VM.
To me this is maybe a VS2015 issue of some kind. Anyway, I have a work-around. I removed the original “Debug” configuration and renamed my new configuration “Debug” and I am back in business.
I will report back if anything reveals itself.
Thanks Theseus for suggesting trying a release build, that brought me to this work-around.
Sid
IWavePlayer waveOutDevice = null;
string fname = @"C:\TestAudio\MyAudioMono.wav";
WaveOut outputDeviceWaveOut = new WaveOut()
{
DesiredLatency = 100,
NumberOfBuffers = 2,
};
outputDeviceWaveOut.DeviceNumber = 0;
waveOutDevice = outputDeviceWaveOut;
AudioFileReader arFile = new AudioFileReader(fname); // sampler reader
AdsrSampleProvider adsrSamplr = new AdsrSampleProvider(arFile);
waveOutDevice.Init(adsrSamplr);
waveOutDevice.Play();
My ultimate goal is to generalize this sampler for stereo then create other samplers for effects like reverb, echo, etc. I'll be glad to share if I can get them working. AttackSeconds
SustainLevel
DecayRate
ReleaseSeconds
Is there a place where I can find valid value ranges (min and max value ) for each of these properties?