Joel Martinez

Do the XNA XACT apis not support streaming sound banks When the wave bank's "Type" property is set to "InMemory", everything works fine. However, if I change it to "Streaming" I get the exception below on this line of code:

waveBank = new WaveBank(audioEngine, "Assets/Wave Bank.xwb");

System.InvalidOperationException was unhandled
Message="The method or function called cannot be used in the manner requested."
Source="Microsoft.Xna.Framework"
StackTrace:
at Microsoft.Xna.Framework.Audio.WaveBank..ctor(AudioEngine audioEngine, String nonStreamingWaveBankFilename)
at ProjectPulse.Game1.Initialize()
at Microsoft.Xna.Framework.Game.Run()
at ProjectPulse.Program.Main(String[] args)

Also, what's up with the "Audio / XACT" forum there don't seem to be many MS peeps watching that forum



Re: XNA Framework XACT Streaming Sound Banks?

Joel Martinez

haha, how dumb do I feel :-P after looking over my post I realized that there's another constructor for streaming banks.

However, since my XNA game isn't running from a DVD, what guidance then should we follow for setting the offset and packetsize parameters





Re: XNA Framework XACT Streaming Sound Banks?

Shawn Hargreaves - MSFT

Offset should be zero, to start reading at the beginning of the file, unless you've embedded the wavebank data inside some other file format of your own.

I've generally used 2 for the packet size, but 4, 8 or 16 might also be good. This doesn't really make a lot of difference when running from hard disk, as the available bandwidth is so much higher than on DVD.





Re: XNA Framework XACT Streaming Sound Banks?

Joel Martinez

Yeah, that's what I gathered it should have been from reading the docs (which, btw seem to be 404 since the last few days)
msdn.microsoft.com/library/en-us/directx9_c/audio_xact_tutorials_api2.asp frame=true

But the audio seemed to be really grainy when I used 2 ... had to up it to about 4, which just means a bigger buffer if I understand it correctly, to get a good quality sound. Not sure if that's because it was running on a laptop (Dell XPS purchased about a year ago) or what.

Obviously, the smallest amount of buffer memory that we could use would be ideal, but assuming smallest and having terrible sounding background music would be worse.

Is there any way that the API can tell you that the streaming buffer is being starved and let you make it bigger





Re: XNA Framework XACT Streaming Sound Banks?

Shawn Hargreaves - MSFT

Joel Martinez wrote:
Is there any way that the API can tell you that the streaming buffer is being starved and let you make it bigger


Not that I'm aware of - I think you just have to guess a value that works well.

It makes sense that this would need to be larger on PC than on Xbox, actually, since the disk IO load is less predictable in Windows, and there aren't guaranteed to be multiple processors just sitting around waiting to do the streaming in a background thread, so it seems reasonable it would need larger buffers to play smoothly.