6

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");

Xenland
  • 510
  • 1
  • 6
  • 19
  • That means that NAudio doesn't work with Mono. – SLaks Dec 10 '12 at 00:47
  • SLaks, Can you direct to me why you came up with conclusion or perhaps give me a reason why you think this or perhaps a past experience that could be used to explain why you think? – Xenland Dec 10 '12 at 01:02
  • That sounds like a Windows native DLL that it's using through P/Invoke. Unless you can get that DLL to work on Wine, you're probably out of luck. Google it. – SLaks Dec 10 '12 at 01:04
  • http://stackoverflow.com/a/6191434/34397 – SLaks Dec 10 '12 at 01:04
  • 3
    Unless there is an official announcement from http://naudio.codeplex.com/ that Mono/Linux is supported, you should by default assume it (as well as many other .NET libraries) is not compatible with Mono/Linux. That's a rule of thumb you should follow in the future. – Lex Li Dec 10 '12 at 02:01
  • Thank you for the informative information everyone. I learn every day – Xenland Dec 10 '12 at 03:03

1 Answers1

10

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.

Mark Heath
  • 48,273
  • 29
  • 137
  • 194