13
XNA Basic XACT tool

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)

Embed Size (px)

Citation preview

Page 1: 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)

XNA Basic

XACT tool

Page 2: 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)

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.

Page 3: 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)

Audacity

It’s a free ware. You can use it for catching song and exporting format which you want.

Download : http://audacity.sourceforge.net

Page 4: 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)

XACT tool

XACT tool is concurrence being installed with XNA.

Page 5: 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)

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.

Page 6: 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)

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.

Page 7: 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)

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.

Page 8: 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)

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.

Page 9: 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)

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.

Page 10: 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)

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”)

}

Page 11: 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)

protected override void update()

{

sounds.PlayCue(“scream”);

}

Cue name in your project

Page 12: 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)

Or maybe you may use cue instead of Sound Bank.

Cue SoundCue;SoundCue = sounds.GetCue(“scream”);

You can useSoundCue.IsPlaying;SoundCue.IsPaused;SoundCue.Play();SoundCue.Pause();SoundCue.Resume();

Page 13: 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)

Let’s practice more

Use your project from getting input, Make it have sound effect.