2017-01-02 128 views
0

使用NAudio時出現DirectX源錯誤。在DirectX方面,我並不是那麼有知識,所以我會欣賞一些指針。NAudio和DirectX 12

有錯誤在Windows 10的PC與DirectX 12安裝初始化越來越n音訊,當我收到的是:

NAudio.Dmo.DmoResampler..ctor System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {F447B69E-1884-4A7E-8055-346F74D6EDB3} failed due to the following error: 80040154 Class not registered (Exception from >HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

NAudio.Dmo.DmoResampler..ctor

NAudio.Wave.ResamplerDmoStream..ctor IWaveProvider inputProvider, WaveFormat outputFormat

NAudio.Wave.WasapiOut.Init IWaveProvider waveProvider

Sound.Support.AudioPlaybackEngine..ctor MMDevice device, Int32 sampleRate, Int32 channelCount

Sound.Manager.PerformInitialization

Analyze.ViewModels.ApplicationViewModel.InitSoundManager

好了,這是很明顯的一些COM對象未註冊,那麼怎麼辦呢?

下面的代碼調用n音訊:

public AudioPlaybackEngine(MMDevice device, int sampleRate = 44100, int channelCount = 2) 
    { 
     Device = device; 

     mOutputDevice = new WasapiOut(device, 
             AudioClientShareMode.Shared, 
             true, 
             200); 

     mMixer = new MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, channelCount)) 
       { 
        ReadFully = true 
       }; 

     mMixer.MixerInputEnded += OnMixerInputEnded; 

     mOutputDevice.Init(mMixer); 
     mOutputDevice.Play(); 
    } 

故障在第一次通話發生。

在DirectX 11上,這在任何平臺上都可以正常工作

有什麼想法?

回答

3

Windows 10的DirectX 9.0c通過DirectX 12全部並排。這可能更好地被認爲是媒體基金會的問題。

GUID({F447B69E-1884-4A7E-8055-346F74D6EDB3})似乎是重採樣器DMO(DirectX媒體對象)。 DMOs是Media Foundation API主要使用的傳統DirectShow技術的一部分 - 我不會深入瞭解「DirectShow」最初稱爲「ActiveMovie」如何最終成爲DirectX品牌的折磨歷史,但不用說技術是從2005年的DirectX SDK開始的removed

因此,我的問題是:您使用Windows 10的N或KN版本嗎?如果是這樣,那麼默認情況下它不包含媒體基礎。您必須通過Restore Pack進行安裝。請參閱Who moved my Windows Media Cheese?

You can try using this sample program to ensure the GUID is present on your machine.

如果你正在開發一個通用Windows平臺(UWP)的應用程序,而不是傳統的Win32桌面應用程序,也可能有上可用變換一些限制是可以影響你。

+0

因爲遇到問題的客戶是在美國,而且在兩臺不同的機器上看到它,這很奇怪。至少這給了我一條低頭尋找問題的道路。 (如果有這樣的事情,這是一個普通的舊WPF應用程序)。感謝指針。 – WyomingDoug