如何使用 DirectSound 从 Stream 播放 MP3
How to play MP3 from Stream using DirectSound
我正在编写一个程序,该程序有时会下载 MP3 并将其存储到字节数组中。然后我从字节创建流。
不确定如何播放流。除了 DirectSound,我不想使用任何 dll。
有没有更好的播放方式? (不是另一个 dll)
如果是,怎么样?如果没有,如何通过 DirectSound 播放流?
看来这不可能。请参阅类似 MSDN forum post:
的引用
Raw DirectSound isn't capable of playing mp3-compressed audio. I recommend using DirectShow for this purpose, as it supports a wide variety of formats. You could also use a streaming dsound buffer and do the decompression yourself, but this is probably overkill in your situation.
Note that I don't recommend using mp3 in your project in any case, since it is not a royalty-free format. Ogg Vorbis is a good alternative.
Mp3 不是免版税的,因此如果没有第 3 方库,您将很难做到这一点,即使如此也不推荐。
我正在编写一个程序,该程序有时会下载 MP3 并将其存储到字节数组中。然后我从字节创建流。
不确定如何播放流。除了 DirectSound,我不想使用任何 dll。
有没有更好的播放方式? (不是另一个 dll)
如果是,怎么样?如果没有,如何通过 DirectSound 播放流?
看来这不可能。请参阅类似 MSDN forum post:
的引用Raw DirectSound isn't capable of playing mp3-compressed audio. I recommend using DirectShow for this purpose, as it supports a wide variety of formats. You could also use a streaming dsound buffer and do the decompression yourself, but this is probably overkill in your situation.
Note that I don't recommend using mp3 in your project in any case, since it is not a royalty-free format. Ogg Vorbis is a good alternative.
Mp3 不是免版税的,因此如果没有第 3 方库,您将很难做到这一点,即使如此也不推荐。