This project has moved and is read-only. For the latest updates, please go here.

Application has no sound output

Jul 22, 2016 at 4:31 PM
Hello,
I have an application that was working and playing a WAV file selected from a listbox. It stopped working while I was adding code for a fade-out. I removed that code and even went back to an earlier commit but there is no sound output. In the latest version of application I have a progress report and I see the progression through the file.

As I said I have reverted to an earlier commit that was producing sound, it does not anymore. I can use the demo applications and they perform as expected.

Here is a code snippet from the early commit that was working but no longer does:
        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.

Any ideas why this has quit working?
Sid
Jul 22, 2016 at 4:33 PM
check which soundcard you are playing on, and that it is not muted
By the way, audiofilereader has a volume property so you don't need a volumesamplerpovider.
Jul 22, 2016 at 4:42 PM

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

Jul 22, 2016 at 6:07 PM
Mark, one more piece of information; I connected a USB headset to the VM and the application plays through that, however there is still no sound through the main sound card.
Would really appreciate a little help, it seems like there is some setting for the application that is being persisted so it screws up even older, previously working, verskoins.
Tnanks,
Sid
Jul 22, 2016 at 7:26 PM
Hi Sidprice,
Try building the project to Release, then start the app by clicking the exe file in the bin/Release folder.

I have a similar problem with a VS2015 project (on win10). It will not play under debug for some reason. If I find out why, I will post back here. I just converted the machine from win7 to win10, so this may be a reward for that.
Jul 22, 2016 at 9:10 PM

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

Jul 22, 2016 at 9:39 PM
NAudio saves no settings. I'm afraid I don't know what could be causing this behaviour. I would say though that audio support in VM / RDP situations is notoriously buggy.
Jul 22, 2016 at 9:46 PM

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

Jul 22, 2016 at 10:47 PM
Sidprice,
I took your advice to reconfig my project Debug configuration. I changed it from "Any CPU" to x86. Then everything runs perfect in debug mode. My machine is x64 and I believe the VS2015 x64 Debugger is "buggy". I've had other issues with the VS2015 x64 Debugger and typically debug in x86 mode and build the release to "Any CPU" for publishing.

So hey thanks, we helped fix each others problems. Teamwork, yay! :-)

For the record, I have a straight Win10 upgrade install (no VM).
Jul 24, 2016 at 11:57 PM
Edited Jul 24, 2016 at 11:58 PM
Hi Mark,
This problem just doesn't seem to want to go away.

Today I attached some USB headphones to my development VM to do some testing of my NAudio application, being kind to the family! It worked just fine. Later in the day I did some edits and this time I ran my application using the default sound card of the VM ... once again no sound. Closed the application, plugged the headset in and it worked! Ran the Release build and it played. I further found that if I use the VS2015 "Run without debugging" the sound plays.

I find this very strange and I am struggling to understand what is different.

If I look at the number of devices reported by WaveOut I see just 1.

One last observation; if I use "run without debugging" and then attach the debugger, the sounds works.

So the trigger for no sound seems to be using "Start Debugging".

BTW: I signed up for PluralSight and loved the NAudio course, well done!

Any input would be much appreciated,
Sid