Playing streamed audio data (C#)

妖精的绣舞 提交于 2019-12-08 04:39:00

问题


I an trying to develop a windows application using C# that can play streamed audio data. Basically, I will have a client application that is responsible for playing different audio files. Currently, from the client application, I am extracting the hardware config param from the file header and then will stream the file data (PCM stream) over network.

So is it possible to use the hardware config params sent from client to configure the actual hardware (on the server end) and then give it the file data stream to it so that it can play the audio data.

While searching, I got to know about NAudio. Is NAudio capable of doing this stuff or the better option for me would be to switch to nativ C/C++ code using Directsound APIS.

update: By configuring hardware, I mean setting the param related to audio playback. These param would include sample rate (eg: 44100 Hz), number of channels (eg: stereo), storage format (eg: 16 bit little endian) etc.

My client application is on Linux and I have planted an ALSA driver that intercepts PCM stream and hw_params configuration and then send them to server.

update ends

Thanks.


回答1:


If you look at the latest NAudio code, you will see there are two examples in the NAudioDemo sample app that play streaming audio. One is a rudimentary chat application that sends compressed voice via UDP, the other plays streaming MP3 internet radio. I'd suggest you have a look at that and try the sample app to see if it meets your needs.



来源:https://stackoverflow.com/questions/6732465/playing-streamed-audio-data-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!