所以我在 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)时,我似乎无法在其中找到任何播放位置。
所以我想问题是:我是否可以查询一个变量来查找该数据,或者我是否需要创建自己的类,从我开始播放歌曲时开始计数?
谢谢