InvalidCueException
Wow, I'm full of problems today.
public static Cue Play(Sounds sound)
{
Cue value = soundbank.GetCue(cueNames[(int)sound]);
value.Play();
return value;
}
This simple method takes in a Sounds enumeration, which I made based on the XNA framework starter kit. The enum basically is the string[] index for the proper sound in the soundbank. I could just as easily (and have) replaced the cueNames reference with an actual sound name ("laser") in this case. The problem is, whenever my program hits the bolded line up there, it crashes, throwing an InvalidCueException at me. This exception isvery sparse: "External component has thrown an exception." There is no inner exception. That's pretty much all it gives me.
I have no idea how to figure out what "external component" has thrown it, let alone any idea as towhy an external component would be crapping itself like that. Any ideas?
[1064 byte] By [
dusda] at [2008-2-15]
Okay, I toyed around with the Spacewars starter kit. I've found that their XACT files work just fine under my XNA application. I've also found that I get the same InvalidCueException when I give it the wrong sound name to get from the soundbank.
But from what I can see, I am referencing the file in my XACT archive just fine. It is a wav file, simply titled "laser", and I refer to it exactly like that in the code.
Is there a "cue" named laser in your sounbank in the XAP file? From what I can tell from your project that I looked at earlier, it seems that you have a sound called laser but have not made a cue that references this sound yet. The cues are shown in the listbox in the bottom-left corner in the soundbank editor (to open this editor double-click on the soundbank node in your project). To create a cue from the sound you can just drag it from the sound list (top-left corner of the editor) to the cue list. You should then see a cue with the same name as the dragged sound (you can rename it though) and when you select this cue the sound variation referenced should appear in the variation listbox (bottom-right).
Ashu Tatake - Game Audio Team - Microsoft Corp.
This posting is provided "as is" with no warranties, and confers no rights
Haha! Yes, that did the trick. This tool is a little unintuitive at first glance, but the process actually makes a lot of sense now that I understand it. Thank you Ashu, I should be out of your hair for a while now :).