Exemplo n.º 1
0
 public void init()
 {
     srcShoot     = AudioEngine.AddSoundSourceFromFile("shoot.wav");
     srcLine      = AudioEngine.AddSoundSourceFromFile("line.wav");
     srcSelection = AudioEngine.AddSoundSourceFromFile("selection.wav");
     srcClear     = AudioEngine.AddSoundSourceFromFile("clear.wav");
     srcFall      = AudioEngine.AddSoundSourceFromFile("fall.wav");
 }
 private void ClearNode()
 {
     this.name = Name.Default;
     if (this.pSource != null)
     {
         this.pSource.Dispose();
     }
     this.pSource = null;
 }
 //methods
 public void Set(Name name, string pSoundName, ref IrrKlang.ISoundEngine pSoundEngine)
 {
     this.name = name;
     Debug.Assert(pSoundName != null);
     if (System.IO.File.Exists(pSoundName))
     {
         this.pSource = pSoundEngine.AddSoundSourceFromFile(pSoundName);
     }
 }
Exemplo n.º 4
0
        public static Sound Add(Sound.Name name, string filename)
        {
            SoundMan sMan  = SoundMan.privGetInstance();
            Sound    sound = (Sound)sMan.AddToFront();

            IrrKlang.ISoundSource source = sMan.engine.AddSoundSourceFromFile(filename);
            source.DefaultVolume = 0.1f;
            sound.Initialize(name, source);
            return(sound);
        }
Exemplo n.º 5
0
        public void Set(Sound.Name name, float volume)
        {
            String assetName = null;

            switch (name)
            {
            case Name.InvaderMarch1:
                assetName = Constants.soundInvaderMarch1;
                break;

            case Name.InvaderMarch2:
                assetName = Constants.soundInvaderMarch2;
                break;

            case Name.InvaderMarch3:
                assetName = Constants.soundInvaderMarch3;
                break;

            case Name.InvaderMarch4:
                assetName = Constants.soundInvaderMarch4;
                break;

            case Name.Invaderkilled:
                assetName = Constants.soundInvaderkilled;
                break;

            case Name.UFOHighPitch:
                assetName = Constants.soundUFOHighPitch;
                break;

            case Name.UFOLowPitch:
                assetName = Constants.soundUFOLowPitch;
                break;

            case Name.Shoot:
                assetName = Constants.soundShoot;
                break;

            case Name.Uninitialized:
                assetName = Constants.soundUninitialized;
                break;

            default:
                Debug.Assert(false, "Invalid texture name");
                break;
            }

            this.poSoundSource = SoundManager.GetEngine().AddSoundSourceFromFile(assetName);
            Debug.Assert(this.poSoundSource != null);

            this.poSoundSource.DefaultVolume = volume;

            this.name = name;
        }
Exemplo n.º 6
0
 public SoundUtility()
 {
     sndEngine      = new IrrKlang.ISoundEngine();
     sndExplosion   = sndEngine.AddSoundSourceFromFile("explosion.wav");
     sndAdvance1    = sndEngine.AddSoundSourceFromFile("fastinvader1.wav");
     sndAdvance2    = sndEngine.AddSoundSourceFromFile("fastinvader2.wav");
     sndAdvance3    = sndEngine.AddSoundSourceFromFile("fastinvader3.wav");
     sndAdvance4    = sndEngine.AddSoundSourceFromFile("fastinvader4.wav");
     sndShoot       = sndEngine.AddSoundSourceFromFile("shoot.wav");
     sndAlienKilled = sndEngine.AddSoundSourceFromFile("invaderkilled.wav");
     sndUFO         = sndEngine.AddSoundSourceFromFile("ufo_highpitch.wav");
 }
Exemplo n.º 7
0
        private IrrKlang.ISoundSource LookupSource(SoundName soundName)
        {
            IrrKlang.ISoundSource pSource      = null;
            IrrKlang.ISoundEngine pSoundEngine = SoundManager.GetEngine();
            switch (soundName)
            {
            case SoundName.explosion:
                pSource = pSoundEngine.AddSoundSourceFromFile("explosion.wav");
                break;

            case SoundName.fastInvader1:
                pSource = pSoundEngine.AddSoundSourceFromFile("fastinvader1.wav");
                break;

            case SoundName.fastInvader2:
                pSource = pSoundEngine.AddSoundSourceFromFile("fastinvader2.wav");
                break;

            case SoundName.fastInvader3:
                pSource = pSoundEngine.AddSoundSourceFromFile("fastinvader3.wav");
                break;

            case SoundName.fastInvader4:
                pSource = pSoundEngine.AddSoundSourceFromFile("fastinvader4.wav");
                break;

            case SoundName.invaderKilled:
                pSource = pSoundEngine.AddSoundSourceFromFile("invaderkilled.wav");
                break;

            case SoundName.shoot:
                pSource = pSoundEngine.AddSoundSourceFromFile("shoot.wav");
                break;

            case SoundName.ufoHighPitch:
                pSource = pSoundEngine.AddSoundSourceFromFile("ufo_highpitch.wav");
                break;

            case SoundName.ufoLowPitch:
                pSource = pSoundEngine.AddSoundSourceFromFile("ufo_lowpitch.wav");
                break;

            case SoundName.Null:
                pSource = null;
                break;

            default:
                Debug.Assert(false);
                break;
            }
            return(pSource);
        }
Exemplo n.º 8
0
        //-----------------------------------------------------------------------------
        // Game::LoadContent()
        //		Allows you to load all content needed for your engine,
        //	    such as objects, graphics, etc.
        //-----------------------------------------------------------------------------
        public override void LoadContent()
        {
            //---------------------------------------------------------------------------------------------------------
            // Audio
            //---------------------------------------------------------------------------------------------------------

            // Create the Audio Engine
            AudioEngine = new IrrKlang.ISoundEngine();

            // Play a sound file
            music        = AudioEngine.Play2D("theme.wav", true);
            music.Volume = 0.2f;

            // Resident loads
            srcShoot = AudioEngine.AddSoundSourceFromFile("shoot.wav");
            sndShoot = AudioEngine.Play2D(srcShoot, false, false, false);
            sndShoot.Stop();

            //---------------------------------------------------------------------------------------------------------
            // Setup Font
            //---------------------------------------------------------------------------------------------------------

            // Font - texture
            pFont = new Azul.Texture("consolas20pt.tga");
            Debug.Assert(pFont != null);

            GlyphMan.AddXml("Consolas20pt.xml", pFont);

            //---------------------------------------------------------------------------------------------------------
            // Load the Textures
            //---------------------------------------------------------------------------------------------------------

            // Red bird texture
            pText = new Azul.Texture("unsorted.tga");
            Debug.Assert(pText != null);

            //---------------------------------------------------------------------------------------------------------
            // Create Sprites
            //---------------------------------------------------------------------------------------------------------

            pRedBird = new Azul.Sprite(pText, new Azul.Rect(903.0f, 797.0f, 46.0f, 46.0f), new Azul.Rect(300.0f, 100.0f, 30.0f, 30.0f));
            Debug.Assert(pRedBird != null);

            //---------------------------------------------------------------------------------------------------------
            // Demo variables
            //---------------------------------------------------------------------------------------------------------

            stats = new GameStats();
        }
Exemplo n.º 9
0
        // Author: Brandon Wegner
        public override void LoadContent()
        {
            AudioEngine = new IrrKlang.ISoundEngine();

            music        = AudioEngine.Play2D("theme.wav", true);
            music.Volume = 0.2f;

            srcShoot = AudioEngine.AddSoundSourceFromFile("shoot.wav");
            sndShoot = AudioEngine.Play2D(srcShoot, false, false, false);
            sndShoot.Stop();

            pFont = new Azul.Texture("consolas20pt.tga");

            GlyphMan.AddXml("Consolas20pt.xml", pFont);

            pText = new Azul.Texture("unsorted.tga");

            pRedBird = new Azul.Sprite(pText, new Azul.Rect(903.0f, 797.0f, 46.0f, 46.0f),
                                       new Azul.Rect(300.0f, 100.0f, 30.0f, 30.0f));
        }
Exemplo n.º 10
0
 public Sound(Sound.Name name, IrrKlang.ISoundSource source) : base()
 {
     this.name   = name;
     this.source = source;
 }
Exemplo n.º 11
0
 public Sound()
 {
     this.name          = Name.Uninitialized;
     this.poSoundSource = null;
     this.volume        = 1;
 }
Exemplo n.º 12
0
 public override void Wash()
 {
     this.poSoundSource = null;
     this.name          = Name.Uninitialized;
     this.volume        = 1;
 }
Exemplo n.º 13
0
 public Sound() : base()
 {
     this.name    = Sound.Name.Uninitialized;
     this.source  = null;
     this.pRepeat = 0.0f;
 }
Exemplo n.º 14
0
 public void Set(SoundName soundName)
 {
     this.name   = soundName;
     this.source = LookupSource(soundName);
 }
Exemplo n.º 15
0
 public Sound()
 {
     this.name   = SoundName.Uninitialized;
     this.source = null;
 }
Exemplo n.º 16
0
 public Sound(SoundName soundName)
 {
     this.name   = soundName;
     this.source = LookupSource(soundName);
 }
Exemplo n.º 17
0
 public void Wash()
 {
     this.source = null;
 }
Exemplo n.º 18
0
 public void Set(Sound.Name name, IrrKlang.ISoundSource snd)
 {
     this.name = name;
     this.src  = snd;
 }
Exemplo n.º 19
0
 public void Initialize(Sound.Name name, IrrKlang.ISoundSource source)
 {
     this.name   = name;
     this.source = source;
 }
Exemplo n.º 20
0
 public void Wash()
 {
     this.name    = Sound.Name.Uninitialized;
     this.source  = null;
     this.pRepeat = 0.0f;
 }
Exemplo n.º 21
0
 public void Set(Sound.Name soundName, string fileName, float repeatTimeInterval)
 {
     this.name    = soundName;
     this.source  = engine.AddSoundSourceFromFile(fileName);
     this.pRepeat = repeatTimeInterval;
 }