如何在不同的扬声器播放的声音? [英] How to play sound on different speakers?

查看:330
本文介绍了如何在不同的扬声器播放的声音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的设备有2个外部扬声器。我怎样才能separatly测试呢?

My device has 2 external speakers. How can I separatly test them?

1的功能,将只留下上一个又一个只有在正确的将声音播放。播放声音

1 function that will play sound only on left one and one that will play sound only on right one.

谷歌搜索没有成功。也许我使用错误的条款。

Googled without success. Maybe I'm using the wrong terms.

也许使用WIN32 API设置的平衡?

Maybe set the balance using WIN32 API?

推荐答案

如果你谈论的立体声扬声器系统设置约2个扬声器,那么你的解决方法很简单。

If you are talking about 2 speakers from stereo speaker system setup, then your solution is simple.

创建播放只在左声道声音,然后播放。然后,创建播放只在右声道声音,播放。

Create a sound that plays only on left channel, then play it. Then, create a sound that plays only on right channel, play it.

您可以使用Audacity的创建一个声音。

You can use Audacity for creating a sounds.

由于.NET API而言,你可以试试你的运气与 http://windowsmedianet.sourceforge.net/

As .NET API is concerned, you can try your luck with http://windowsmedianet.sourceforge.net/

你也许需要的是的http:// MSDN。 microsoft.com/en-us/library/ms712636(VS.85).aspx ,因为他们让他们整齐地包裹着。

What you might need is http://msdn.microsoft.com/en-us/library/ms712636(VS.85).aspx, as they have them neatly wrapped.

编辑:

顺便说一句,你可以使用waveOutOpen打开同一个设备两次,一次打左声音文件,分别在两个不同的waveOutOpen设备上播放的声音文件句柄都指向同一个物理设备。声音会出来,正如预期的,您所选择的扬声器根据声音的类型。

BTW, you can use waveOutOpen to open same device twice, and once play LEFT sound file, and independently play RIGHT sound file on two separate waveOutOpen device handles that both point to same physical device. Sound will come out just as expected, on the speaker of your choice depending on the type of sound.

另外,如果你想以编程方式创建的声音,只具有左声道是指在音频文件中的所有其他PCM采样应为0。

Further, if you want to create sounds programatically, having only LEFT channel means that your every other PCM sample in the audio file should be 0.

我不推荐使用的平衡,因为混音器API很难理解,你会设置的API既起到样本意外。

I wouldn't recommend using balance, because mixer API is difficult to understand, and you'll set API for BOTH played samples accidentally.

更信息:

您可以使用的http:// msdn.microsoft.com/en-us/library/system.media.soundplayer(VS.80).aspx 来播放WAV文件。如果您没有WAV文件,但你想玩的东西从的MemoryStream ,找到一种方法,在你的音频采样数据前插入某种形式的WAV头。你不会是第一个来试试吧:)

You can use http://msdn.microsoft.com/en-us/library/system.media.soundplayer(VS.80).aspx to play WAV files. If you don't have WAV files but you want to play something from MemoryStream, find a way to insert some form of a WAV header at the front of your audio sample data. You won't be the first one to try it :)

这篇关于如何在不同的扬声器播放的声音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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