XNA_Basic_XACT

Download Report

Transcript XNA_Basic_XACT

XNA Basic
XACT tool
What’s format song file which XNA
support?


Only .wav because it’s not compress file.
Beside, you need XACT project ( XACT
project) which XNA can include.
Audacity


It’s a free ware. You can use it for catching
song and exporting format which you want.
Download : http://audacity.sourceforge.net
XACT tool

XACT tool is concurrence being installed with
XNA.
Starting with XACT





How do we start?
First .wav file should be in content folder.
Second create new project from file menu.
Third create Wave Bank from Wave Bank
menu.
Forth drag drop .wav file into Wave Bank
windows or choose insert file from Wave
Bank menu.
Starting with XACT




Fifth drag drop .wav file from Wave Bank
window into Sound Bank up window.
Sixth drag drop .wav file from Sound Bank up
window into down window for creating Cue.
Seventh build and save project.
When build project, it will create .xgs
file(Audio Engine), .xwb file(Wave Bank),
.xsb(Sound Bank) which we will talk late.
Why must we have Wave Bank and
Sound Bank?



Wave Bank is a material for creating Sound
Bank.
Two Wave Bank can create many Sound
Bank.
But we won’t talk detail about it because it’s
job of sound engineer. You can find more
detail in wiki.
Audio Engine, Wave Bank, Sound Bank



Audio Engine tell XNA about setting in XACT
project.
Wave Bank tell XNA about its setting and
which file hold data.
Sound Bank is the same Wave Bank doing.
Include XACT project.




Right click at content in Solution Explorer and
choose exiting item and find .xap file (XACT
project)
Don’t forget .wav file must be in content
folder.
It’s good at everything being in new folder.
Here I’ll create folder Sound.
Sample Code for loading XACT
AudioEngine audio;
WaveBank waves;
SoundBank sounds;
protected override void LoadContent()
{
audio = new
AudioEngine(@”Content\Sound\SampleSound.xgs”)
waves = new WaveBank(audio,@”Content\Sound\Wave
Bank.xwb”)
sounds = new
Sound(audio,@”Content\Sound\SoundBank.xsb”)
}
protected override void update()
{
sounds.PlayCue(“scream”);
}
Cue name in your project
Or maybe you may use cue instead of
Sound Bank.
Cue SoundCue;
SoundCue = sounds.GetCue(“scream”);
You can use
SoundCue.IsPlaying;
SoundCue.IsPaused;
SoundCue.Play();
SoundCue.Pause();
SoundCue.Resume();
Let’s practice more

Use your project from getting input, Make it
have sound effect.