C#. Windows媒体播放器 [英] C#. Windows media player

查看:89
本文介绍了C#. Windows媒体播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用嵌入式AxWMPLib.AxWindowsMediaPlayer播放各种音频
应用程序中的文件(C#代码).我想以编程方式进行更改,
目标扬声器(输出音频设备).我找不到任何代码
完成这个.我搜寻了高低.什么都没告诉我如何选择
和/或更改扬声器以进行音频输出.但是标准的Windows Media
Windows XP中的播放器当然可以通过
轻松更改音频设备 工具/选项.
(我不想更改默认的声卡,而只为此WMP实例更改它)
有人可以用C#代码向我展示如何更换扬声器吗?
谢谢!!

We''re using an embedded AxWMPLib.AxWindowsMediaPlayer to play various audio
files in our application (C# code). I''d like to change, programmatically,
the destination speakers (output audio device). I can''t find any code to
accomplish this. I''ve searched high and low. Nothing tells me how to select
and/or change the speakers for audio output. Yet the standard Windows Media
Player in Windows XP certainly can change audio devices quite readily via
Tools / Options.
(i don''t want to change the default sound card , only to change it for the this instance of WMP)
Can someone show me the light on how to change speakers, in C# code?
Thank you!!!

推荐答案

这个问题是我遇到过几次了,您可以使用AxWindowsMediaPlayer或WindowsMediaPlayerClass或类似的东西进行尽可能多的搜索,这是不可能的.我已经尝试了很多次以找到这样的功能.但是,您应该看一下以下三件事:

1) http://www.asio4all.com/ [ ^ ]-ASIO4ALL是一款可在许多硬件设备上运行的软件,可轻松与硬件接口.这是我以前用来解决无法选择设备的问题的工具.总体来说,它还比声音工程的功能强大得多.

2)要使用ASIO4ALL,我使用了NAudio.这是一个非常完善的综合库,它允许使用ASIO播放MP3,Wave,Ogg和其他格式.您还可以对声音进行非常低级的控制-如果您真的喜欢的话,可以控制单个位和字节-但它也提供了高级功能. http://naudio.codeplex.com/ [ ^ ](您还应注意,它还附带了UI控件,用于Wave Form Rendering等功能-虽然NAudio首先需要一点努力才能使用,一旦开始工作,它就会非常强大:)哦,这是一个持续不断的发展,因此应该保持最新状态:))

3)我建议您看一下我为WindowsMediaPlayer类创建包装器的文章.我很轻松地对此进行了修改,以使用ASIO4ALL播放器. 媒体播放器类 [
This problem is one I have hit several times and you can search as much as you want, using the AxWindowsMediaPlayer or WindowsMediaPlayerClass or anything similar, it cannot be done. I have tried many times to find such a feature. However, you should take a look at the following three things:

1) http://www.asio4all.com/[^] - ASIO4ALL is software that will run on many hardware devices and allows easy interfacing to hardware. It is what I have used previously to solve the issue of not being able to select devices. It is also far more powerful a tool for sound engineering in general.

2) To use ASIO4ALL I used NAudio. It is a very good, comprehensive library that allows MP3, Wave, Ogg and other formats to be played using ASIO. You also get very low level control over the sound - individual bit and bytes if you really fancy it - but it provides high level facilities as well. http://naudio.codeplex.com/[^] (You should also note that it comes with UI controls as well for things like Wave Form Rendering - while NAudio takes a little bit of effort to use at first, it is very powerful once you get it working :) Oh and it''s an ongoing development so should remain up-to-date :) )

3) I would suggest having a look at my article in which I create a wrapper for the WindowsMediaPlayer class. I easily adapted this to use the ASIO4ALL player. Media Player Class[^]

Hope this helps,

Ed :)

P.S. If you get stuck with NAudio, contact me and I can provide good samples of what I have done, but they are too much for this answer ;P


这篇关于C#. Windows媒体播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆