问题
So I'm attempting to use MonoDevelop with NAudio and Ubuntu Linux, For some reason It errors saying that winmm.dll isn't found so I attempted to download it and and the "Add Reference" dialogue claims its not a valid .NET library. Here is my code....
using System;
using System.IO;
using Gst;
using GLib;
using Gst.BasePlugins;
using NAudio;
using NAudio.Wave;
namespace record_audio_simple_test
{
class MainClass
{
//Define class variables
private NAudio.Wave.WaveFileReader waveFile = null;
private NAudio.Wave.DirectSoundOut output = null;
public static void Main (string[] args)
{
WaveFileReader waveFile = new WaveFileReader("../../convo47.wav");
}
}
}
It says the errors on this line WaveFileReader waveFile = new WaveFileReader("../../convo47.wav");
回答1:
A large part of NAudio consists of interop wrappers to access Windows API calls such as waveIn/waveOut, DirectSound, WASAPI, ACM, MediaFoundation and DMO. None of these are going to work on Linux since those API methods don't exist. I suppose it might be theoretically possible for them to work on top of a Windows API emulation layer, but really it would be better to create an implementation of IWavePlayer
that calls into Linux sound APIs.
There are some parts of NAudio that ought to work cross-platform, such as most of the IWaveProvider
and ISampleProvider
implementations. WaveFileReader
perhaps ought to work, but is failing since it makes use of the mmioStringToFOURCC
Windows API call. I'll be removing this dependency shortly as it is currently stopping WaveFileReader
from being used in Windows Store apps as well.
来源:https://stackoverflow.com/questions/13793514/monodevelop-naudio-ubuntu-linux-tells-me-winmm-dll-not-found