c# - 使用 Vorbis 和 NAudio 播放 OGG 文件

标签 c# naudio ogg vorbis

我正在尝试使用 NVorbis 和 NAudio 播放 OGG 文件流,如文档中所述,我正在尝试访问 VorbisWaveReader 类,但没有成功,这是我的代码:

using System;
using System.Collections.Generic;
using System.Text;
using NVorbis;
using NAudio;

namespace Paradise
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var vorbis = new NVorbis.NAudioSupport.VorbisWaveReader(@"C:\PATH\TO\OGG\FILE.ogg"))
            using (var waveOut = new NAudio.Wave.WaveOut())
            {
            waveOut.Init(vorbis);
            waveOut.Play();
            }
        }
    }
}

我收到以下错误:

type or namespace name 'VorbisWaveReader' does not exist in the namespace 'NVorbis.NAudioSupport'

它看起来非常基础并且应该可以工作,我可以在源代码中看到代码中存在 VorbisWaveReader,你能帮我完成吗?

谢谢!

最佳答案

NVorbis.NAudioSupport 变为 NAudio.Vorbis

在 Package-Manager Console 中输入:

安装包 NAudio.Vorbis

关于c# - 使用 Vorbis 和 NAudio 播放 OGG 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24624939/

相关文章:

c# - 在WP8中将ogg文件解码为WAV

android - 不能在安卓上玩ogg

c# - 接口(interface)属性和设计原则的接口(interface)注入(inject)

c# - 如何从 ASP.NET 事件调用 C# 函数?

c# - 返回任务而不是等待内部方法调用

c# - 将ASP.NET Core(使用NAudio)部署到Kubernetes时获取System.DllNotFoundException

c# - 高内存使用率,在按键时播放带有NAudio的MP3

c# - 获取 Entity Framework 中最近插入的行的ID

c# - Naudio录音麦克风X秒钟

node.js - ffmpeg 输出文件不同