【发布时间】:2010-05-02 23:06:14
【问题描述】:
所以我在 XNA 中制作游戏,我需要使用 XACT 来播放我的歌曲(而不是媒体播放器)。我需要使用 XACT,因为每首歌曲在同时播放时会有多个层次(贝司、主音、鼓)等组合在一起。我不能使用媒体播放器,因为媒体播放器一次只能播放一首歌曲。
无论如何,假设我的项目中有一首使用 XACT 播放的歌曲,代码如下
public SongController()
{
audioEngine = new AudioEngine(@"Content\Song1\Song1.xgs");
waveBank = new WaveBank(audioEngine, @"Content\Song1\Layers.xwb");
soundBank = new SoundBank(audioEngine, @"Content\Song1\SongLayers.xsb");
songTime = new PlayTime();
Vox = soundBank.GetCue("Vox");
BG = soundBank.GetCue("BG");
Bass = soundBank.GetCue("Bass");
Lead = soundBank.GetCue("Lead");
Other = soundBank.GetCue("Other");
Vox.SetVariable("CueVolume", 100.0f);
BG.SetVariable("CueVolume", 100.0f);
Bass.SetVariable("CueVolume", 100.0f);
Lead.SetVariable("CueVolume", 100.0f);
Other.SetVariable("CueVolume", 100.0f);
_bassVol = 100.0f;
_voxVol = 100.0f;
_leadVol = 100.0f;
_otherVol = 100.0f;
Vox.Play();
BG.Play();
Bass.Play();
Lead.Play();
Other.Play(); }
所以当我查看 Vox 或 BG 中的变量(它们是 Cue 的 btw)时,我似乎无法在其中找到任何播放位置。
所以我想问题是:我可以查询一个变量来查找该数据,还是我需要创建自己的类,从我开始播放歌曲时开始计数?
谢谢
【问题讨论】: