码迷,mamicode.com
首页 > 其他好文 > 详细

How to: Use Submix Voices

时间:2017-07-11 21:25:32      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:targe   div   data-   end   reference   tor   它的   mat   fail   

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

标签:targe   div   data-   end   reference   tor   它的   mat   fail   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!