WavReader和FlacWriter需要使用什么语句?

时间:2015-02-03 20:40:48

标签: c# dll using statements

到目前为止,我有这些使用声明:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using Newtonsoft.Json;
using System.Threading;
using NAudio.Wave;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using Alvas.Audio;

我正在尝试将一个wav写入flac转换器。 这是功能:

public static void flac_converter()
{
    string inputFile = Path.Combine("wav ", input);
    string outputFile = Path.Combine("flac", Path.ChangeExtension(input, ".flac"));

    if (!File.Exists(inputFile))
        throw new ApplicationException("Input file " + inputFile + " cannot be found!");

    WavReader wav = new WavReader(inputFile);

    using (var flacStream = File.Create(outputFile))
    {
        FlacWriter flac = new FlacWriter(flacStream, wav.BitDepth, wav.Channels, wav.SampleRate);
        // Buffer for 1 second's worth of audio data
        byte[] buffer = new byte[wav.Bitrate / 8];
        int bytesRead;
        do
        {
            bytesRead = wav.InputStream.Read(buffer, 0, buffer.Length);
            flac.Convert(buffer, 0, bytesRead);
        } while (bytesRead > 0);
        flac.Dispose();
        flac = null;
    }
}

但我收到此错误:“无法找到命名空间'WavReader'的类型” 我也收到此错误:“无法找到类型或命名空间'FlacWriter'”

我知道我必须做两件事,下载相应的lib,然后将所有的DLL文件添加到项目的引用中,并添加“using blahBlah;”

但是,我不知道我需要什么DLL,或者我需要使用什么语句来摆脱这些错误。有人知道吗?

1 个答案:

答案 0 :(得分:0)

将wavreader的拼写更改为wavereader。它应该成功。