XNA C#SoundEffectInstance-无声音

XNA C#SoundEffectInstance-无声音,c#,xna,audio,soundeffectinstance,C#,Xna,Audio,Soundeffectinstance,我试图在游戏中播放加载的.wav文件的SoundEffect实例,但我听不到任何声音 我有一门课叫“ETSound”;每个物体都有一个声音。因此,一个ETSound对象可能持有“菜单打开”声音,另一个对象可能持有“坦克开火”声音。。。等等 无论如何,ETSound构造函数如下所示: public ETSound(SoundEffect se, float volume, float pitch, bool looped, int soundPriority) { sou

我试图在游戏中播放加载的.wav文件的SoundEffect实例,但我听不到任何声音

我有一门课叫“ETSound”;每个物体都有一个声音。因此,一个ETSound对象可能持有“菜单打开”声音,另一个对象可能持有“坦克开火”声音。。。等等

无论如何,ETSound构造函数如下所示:

public ETSound(SoundEffect se, float volume, float pitch, bool looped, int soundPriority) { 
            soundTemplate = se; 
            this.volume = volume; 
            this.pitch = pitch; 
            this.looped = looped; 

            if (soundPriority > 0) { 
                if (soundPriority > 64) soundPriority = 64; 
                instanceArray = new SoundEffectInstance[soundPriority]; 
                nextInstanceIndex = 0; 
                for (int i = 0; i < soundPriority; ++i) { 
                    SoundEffectInstance sei = soundTemplate.CreateInstance(); 
                    sei.Volume = volume; 
                    sei.Pitch = pitch; 
                    instanceArray[i] = sei; 
                } 
            } 
        } 
然而,什么也没有发生。我什么也没听到


谁能告诉我出了什么问题吗?谢谢。

对不起,各位。。。原来我用来测试的.wav文件已损坏。。。很难找到虫子,但我找到了。无论如何,谢谢。

我知道这是一个愚蠢的问题,但您的扬声器已打开,音量已调大。是的,我正在听音乐(显然是为了测试而关闭的)。什么是soundTemplate?它如何创建实例?
public void Play() { 
            if (instanceArray[nextInstanceIndex].State != SoundState.Stopped) instanceArray[nextInstanceIndex].Stop(); 
            instanceArray[nextInstanceIndex].Play(); 
            if (++nextInstanceIndex >= instanceArray.Length) nextInstanceIndex = 0;          
        }