filoe / cscore

An advanced audio library, written in C#. Provides tons of features. From playing/recording audio to decoding/encoding audio streams/files to processing audio data in realtime (e.g. applying custom effects during playback, create visualizations,...). The possibilities are nearly unlimited.
Other
2.21k stars 458 forks source link

Exception thrown attempting to play a WMA Lossless 24bit/44.1 kHz file #159

Closed arebee closed 7 years ago

arebee commented 8 years ago

Using both Dopamine and Hurricane, an exception is thrown when attempting to play a WMA Lossless file encoded using 24bit/44.1kHz. Groove Music and VLC play the file correctly. Note the exception and HResult listed in the log excerpt below.

2016-10-28 11:19:46.8275
Error
Dopamine.Common.Services.Playback.PlaybackService+<TryPlayAsync>d__162.MoveNext
Could not play the file \\Server\Music\Artist\Album\01 Track Name.wma. EventMode=False, ExclusiveMode=False, LoopMode=None, Shuffle=False. 
Exception: IAudioClient::Initialize caused an error: 0x88890008, "Unknown HRESULT".. 
StackTrace:
    at CSCore.SoundOut.WasapiOut.InitializeInternal()
   at CSCore.SoundOut.WasapiOut.Initialize(IWaveSource source)
   at Dopamine.Core.Audio.CSCorePlayer.InitializeSoundOut(IWaveSource soundSource)
   at Dopamine.Core.Audio.CSCorePlayer.Play(String filename)
   at Dopamine.Common.Services.Playback.PlaybackService.<>c__DisplayClass162_0.<TryPlayAsync>b__0()
   at System.Threading.Tasks.Task.Execute()
arebee commented 8 years ago

Further investigation indicates that this is caused by certain combinations of settings in the classic Sound Control Panel "Default Format" setting in the Advanced tab of the audio rendering device causes the problem. Attached is a Problem Screen Recording of some combinations of the settings and the error being manifested in Dopamine. sound-error-in-Dopamine.zip

filoe commented 8 years ago

Thanks for the detailed description (thumbs up for the recording :) ). Seems like it fails to find a proper format. Going to have a look at it. One more question: Do you have a surround system configured? And could you may provide the wma file? Maybe this is related to #143. If so, the issue should be fixed with the next CSCore release.

arebee commented 8 years ago

No surround setup. It's a CD rip so I can't send it.

From DXDIAG

Operating System: Windows 10 Pro 64-bit (10.0, Build 14393) (14393.rs1_release_inmarket.161014-1755)
-------------
Sound Devices
-------------
            Description: Speakers / Headphones (Realtek High Definition Audio)
 Default Sound Playback: Yes
 Default Voice Playback: Yes
            Hardware ID: HDAUDIO\FUNC_01&VEN_10EC&DEV_0280&SUBSYS_102805A6&REV_1000
        Manufacturer ID: 1
             Product ID: 100
                   Type: WDM
            Driver Name: RTDVHD64.sys
         Driver Version: 6.00.0001.6075 (English)
      Driver Attributes: Final Retail
            WHQL Logo'd: Yes
          Date and Size: 6/30/2015 12:00:00 AM, 2558208 bytes
            Other Files: 
        Driver Provider: Realtek Semiconductor Corp.
         HW Accel Level: Basic
              Cap Flags: 0xF1F
    Min/Max Sample Rate: 100, 200000
Static/Strm HW Mix Bufs: 1, 0
 Static/Strm HW 3D Bufs: 0, 0
              HW Memory: 0
       Voice Management: No
 EAX(tm) 2.0 Listen/Src: No, No
   I3DL2(tm) Listen/Src: No, No
Sensaura(tm) ZoomFX(tm): No
arebee commented 8 years ago

https://1drv.ms/u/s!Aqbm0P9Iun01sdpNQsTNl-RSMsSqZw

filoe commented 7 years ago

Well, I'm sorry for the late response. I've finally fixed the problem. For me it seems to be some kind of bug within the Wasapi API.