首页 > 其他 > 详细

How to: Use Submix Voices

时间:2017-07-11 20:12:06      阅读:266      评论:0      收藏:0      [点我收藏+]

How to: Use Submix Voices:https://msdn.microsoft.com/en-us/library/windows/desktop/ee415794(v=vs.85).aspx

This topic shows you how you can set groups of voices to send their output to the same submix voice. This enables a single change to a submix voice to affect a whole group of voices.

这篇文章向你展示怎样设置一组声音,使它们的输出发送到同一个Submix Voice。这样能够实现一个Submix Voice一个改变能够影响一整组声音。

1.Create a submix voice to which all of the game‘s sound effect voices will send.

创建一个全部游戏声效都会输出到此的Submix Voice:

IXAudio2SubmixVoice * pSFXSubmixVoice;
pXAudio2->CreateSubmixVoice(&pSFXSubmixVoice,1,44100,0,0,0,0);


2.Create an XAUDIO2_VOICE_SENDS structure that contains a reference to the submix voice.

创建一个包括对Submix Voice引用的XAUDIO2_VOICE_SENDS结构体:
XAUDIO2_SEND_DESCRIPTOR SFXSend = {0, pSFXSubmixVoice};
XAUDIO2_VOICE_SENDS SFXSendList = {1, &SFXSend};


3.Pass the XAUDIO2_VOICE_SENDS structure to new source voices as they are created.

当创建Source Voices的时候,将XAUDIO2_VOICE_SENDS结构体传递给它们:
IXAudio2SourceVoice* pSFXSourceVoice;
if( FAILED(hr = pXaudio2->CreateSourceVoice( &pSFXSourceVoice, (WAVEFORMATEX*)&wfx,
    0, XAUDIO2_DEFAULT_FREQ_RATIO, pCallback, pSFXSendList, NULL ) ) )
    return hr;


4.Apply changes to all sound effect voices by adjusting the submix voice.

通过调节Submix Voice,改变全部和它有关联的声效:

In this example, changing the volume of the submix voice with the SetVolume function effectively changes the volume of all voices that output to it.

比如:使用SetVolume函数来改动Submix Voice的音量,能够有效得改变全部输出到它的voices的volume。
pSFXSubmixVoice->SetVolume(0.1);

交流QQ:1245178753


How to: Use Submix Voices

原文:http://www.cnblogs.com/slgkaifa/p/7152224.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!