gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 16:58:52 26 4
gpt4 key购买 nike

我正在尝试使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com