Beispiel #1
0
        public override void Notify()
        {
            Debug.WriteLine(" Snd_Observer: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            pSndEngine.SoundVolume = 0.2f;
            IrrKlang.ISound pSnd = pSndEngine.Play2D("fastinvader1.wav");
        }
Beispiel #2
0
 public void setFirst(string mupath, bool isGoing)
 {
     if (isGoing)
         Stop();
     curMusic = player.Play2D(mupath);
     Stop();
 }
        public override void Notify()
        {
            //Debug.WriteLine(" Sound_Observer: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            pSndEngine.SoundVolume = 0.2f;
            IrrKlang.ISound pSnd = pSndEngine.Play2D(this.pSndName);
        }
Beispiel #4
0
 public override void execute(float deltaTime)
 {
     IrrKlang.ISound music = null;
     //MoveGrid
     grid.moveGrid();
     //Play Sound
     if (count == 0)
     {
         music = soundEngine.Play2D("fastinvader4.wav");
         count++;
     }
     else if (count == 1)
     {
         music = soundEngine.Play2D("fastinvader3.wav");
         count++;
     }
     else if (count == 2)
     {
         music = soundEngine.Play2D("fastinvader2.wav");
         count++;
     }
     else if (count == 3)
     {
         music = soundEngine.Play2D("fastinvader1.wav");
         count = 0;
     }
     music.Volume = 0.2f;
     TimerManager.sortedAdd(TimerEvent.TimerEventName.SpriteAnimation, this, Unit.AlienGridMoveEventTime);
 }
 public IrrklangSound(IrrKlang.ISound sound)
 {
     if (sound == null)
     {
         throw new ArgumentNullException("sound");
     }
     this.sound = sound;
 }
Beispiel #6
0
 //----------------------------------------------------------------------------------
 // Play It
 //----------------------------------------------------------------------------------
 public void Play(float volInput = 0.2f)
 {
     IrrKlang.ISound music = engine.Play2D(this.source, false, false, false);
     if (music != null)
     {
         music.Volume = volInput;
     }
 }
Beispiel #7
0
 public override void execute(float deltaTime)
 {
     IrrKlang.ISoundEngine soundEngine = FactoryManager.getSoundEngine();
     if (ufo.launch)
     {
         IrrKlang.ISound music = soundEngine.Play2D("ufo_lowpitch.wav");
         music.Volume = 0.2f;
         TimerManager.sortedAdd(TimerEvent.TimerEventName.UFOPlaySound, this, 2.2f);
     }
 }
        public override void Execute(float deltaTime)
        {
            String pCurrSound;

            // Select sound
            switch (currSoundIndex)
            {
            case 0:
                pCurrSound = pFastInvader1;
                break;

            case 1:
                pCurrSound = pFastInvader2;
                break;

            case 2:
                pCurrSound = pFastInvader3;
                break;

            case 3:
                pCurrSound = pFastInvader4;
                break;

            default:
                // something is wrong
                Debug.Assert(false);
                pCurrSound = "";
                break;
            }

            // Play current sound
            IrrKlang.ISound pSnd = SoundEngineManager.GetSoundEngine().Play2D(pCurrSound);

            // Increment sound index
            if (currSoundIndex == 3)
            {
                this.currSoundIndex = 0;
            }
            else
            {
                this.currSoundIndex += 1;
            }

            // If there is still at least one alien
            if (GameStateManager.GetGame().GetStateCompositeManager().Find(Composite.CompositeName.AlienGrid).GetFirstChild() != null)
            {
                Debug.Print("Adding GridMovementSound ({0}) back to timer - Delta: {1}", this.GetHashCode(), GameStateManager.GetGame().GetStateAlienGridSpeed());

                // Add itself back to timer
                TimerManager.Add(TimeEvent.Name.AlienGridMovementSound, this, GameStateManager.GetGame().GetStateAlienGridSpeed());
            }
        }
Beispiel #9
0
        void timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            string        prefix = @"./Content/SampleBMS/";
            List <string> temp   = 시간들[timeflag];

            for (int i = 0; i < temp.Count; i++)
            {
                Debug.WriteLine("B: T={0}, i={1}, C={2}", timeflag, i, temp.Count);
                재생중음원 = 사운드엔진.Play2D(prefix + temp[i], false);
                Debug.WriteLine("A: T={0}, i={1}, C={2}", timeflag, i, temp.Count);
            }
            timeflag++;
        }
Beispiel #10
0
        public override void ShootMissile(CoreCannon pShip)
        {
            // Activate and position missile
            Missile pMissile = GameStateManager.GetGame().GetStateCoreCannonManager().ActivateMissile();

            pMissile.SetPos(pShip.GetX(), pShip.GetY() + 20);
            pMissile.SetActive(true);

            // Play shoot sound
            IrrKlang.ISound pSnd = SoundEngineManager.GetSoundEngine().Play2D("shoot.wav");

            // switch states
            this.Handle(pShip);
        }
Beispiel #11
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();
        }
Beispiel #12
0
        public static IrrKlang.ISound PlaySound(Sound.Name name, bool loop = false)
        {
            Sound pSound = Find(name);

            Debug.Assert(pSound != null);

            SoundManager pMan = SoundManager.PrivGetInstance();

            Debug.Assert(pMan != null);
            Debug.Assert(pMan.poSndEngine != null);

            IrrKlang.ISound hardwareSound = pMan.poSndEngine.Play2D(pSound.GetSound(), loop, false, false);

            return(hardwareSound);
        }
Beispiel #13
0
        public static void PlaySound(Sound.Name name, float volume = 1.0f)
        {
            Debug.Assert(name != Sound.Name.Uninitialized);
            SoundMan sMan  = SoundMan.privGetInstance();
            Sound    pHead = (Sound)sMan.pActive;

            while (pHead != null)
            {
                if (pHead.name == name)
                {
                    IrrKlang.ISound sound = sMan.engine.Play2D(pHead.source, false, false, false);
                }

                pHead = (Sound)pHead.pNext;
            }
        }
Beispiel #14
0
        public override void shoot(CannonShip ship)
        {
            // Debug.WriteLine("ShipReadyState shoot");
            StraightMissile missile = ShipManager.activateMissile();

            Debug.Assert(missile != null);

            missile.x = ship.x;
            missile.y = ship.y;
            missile.launchMissile();

            IrrKlang.ISoundEngine sndEngine = FactoryManager.getSoundEngine();
            IrrKlang.ISound       music     = sndEngine.Play2D("shoot.wav");
            music.Volume = 0.2f;

            this.handle(ship);
        }
        protected override void DoAction()
        {
            //Debug.WriteLine("Attempting to Spawen an Alien!!!");
            if (this.poUfo == null || this.poUfo.bMarkForDeath == true)
            {
                int UfoDirection = this.pRandom.Next(0, 2);
                //Debug.WriteLine("Random direction is: " + UfoDirection);
                this.poUfo = (UFO)this.poUfoIF.ActiveCreate(GameObject.Type.UFO, Constants.UFOPosXPos, Constants.UFOYPos);
                if (UfoDirection == 0)
                {
                    this.poUfo.speedX *= -1.0f;
                    this.poUfo.x       = Constants.UFONegXPos;
                }
                IrrKlang.ISound pHardwareSound = SoundManager.PlaySound(Sound.Name.UFOLowPitch, true);

                ColPair pMissile_UFOColPair = ColPairManager.Add(ColPair.Name.Missile_UFO, this.pMissile, this.poUfo);
                Debug.Assert(pMissile_UFOColPair != null);

                ColPair pUFO_WallLeftColPair = ColPairManager.Add(ColPair.Name.UFO_WallLeft, this.poUfo, this.pWallMan.GetWallLeft());
                Debug.Assert(pUFO_WallLeftColPair != null);

                ColPair pUFO_WallRightColPair = ColPairManager.Add(ColPair.Name.UFO_WallRight, this.poUfo, this.pWallMan.GetWallRight());
                Debug.Assert(pUFO_WallRightColPair != null);

                // Set up missile UFO collsions
                pMissile_UFOColPair.Attach(new RemoveCollisionPairObserver(pMissile_UFOColPair));
                pMissile_UFOColPair.Attach(new RemoveCollisionPairObserver(pUFO_WallLeftColPair));
                pMissile_UFOColPair.Attach(new RemoveCollisionPairObserver(pUFO_WallRightColPair));
                pMissile_UFOColPair.Attach(new ShipMissileReadyObserver());
                pMissile_UFOColPair.Attach(new ShipRemoveMissileObserver());
                pMissile_UFOColPair.Attach(new RemoveUFOObserver(pHardwareSound));
                pMissile_UFOColPair.Attach(new AwardPointsObserver());

                // Set up UFO left wall collision
                pUFO_WallLeftColPair.Attach(new RemoveCollisionPairObserver(pUFO_WallLeftColPair));
                pUFO_WallLeftColPair.Attach(new RemoveCollisionPairObserver(pUFO_WallRightColPair));
                pUFO_WallLeftColPair.Attach(new RemoveCollisionPairObserver(pMissile_UFOColPair));
                pUFO_WallLeftColPair.Attach(new RemoveUFOObserver(pHardwareSound));

                // Set up UFO Right wall collision
                pUFO_WallRightColPair.Attach(new RemoveCollisionPairObserver(pUFO_WallRightColPair));
                pUFO_WallRightColPair.Attach(new RemoveCollisionPairObserver(pUFO_WallLeftColPair));
                pUFO_WallRightColPair.Attach(new RemoveCollisionPairObserver(pMissile_UFOColPair));
                pUFO_WallRightColPair.Attach(new RemoveUFOObserver(pHardwareSound));
            }
        }
Beispiel #16
0
        public override void Execute(float deltaTime)
        {
            Composite pFlyingSaucerRoot = GameStateManager.GetGame().GetStateCompositeManager().Find(Composite.CompositeName.FlyingSaucerRoot);

            IrrKlang.ISoundEngine pSoundEngine = SoundEngineManager.GetSoundEngine();

            // If flying saucer is active
            if (pFlyingSaucerRoot.GetFirstChild() != null)
            {
                // Check to see if sound is currently playing
                if (!pSoundEngine.IsCurrentlyPlaying("ufo_lowpitch.wav"))
                {
                    IrrKlang.ISound pSnd = pSoundEngine.Play2D("ufo_lowpitch.wav");
                }

                base.Execute(deltaTime);
            }
        }
Beispiel #17
0
        // plays filename selected in edit box
        void playSelectedFile()
        {
            // stop currently playing sound

            if (currentlyPlayingSound != null)
            {
                currentlyPlayingSound.Stop();
            }

            // start new sound

            currentlyPlayingSound = irrKlangEngine.Play2D(filenameTextBox.Text, true);

            // update controls to display the playing file

            UpdatePauseButtonText();

            volumeTrackBar.Value = 100;
        }
Beispiel #18
0
 public void PlayPause(string Mode, bool isGoing, string curMusicPath)
 {
     if (!isGoing)
     {
         curMusic = player.Play2D(curMusicPath);
         curMusic.Volume = curVol;
     }
     else
     {
         if (Mode.Equals("||"))
         {
             curMusic.Paused = true;
         }
         else
         {
             curMusic.Paused = false;
         }
     }
 }
Beispiel #19
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));
        }
Beispiel #20
0
 public void PlaySound()
 {
     this.pISnd = this.pSnd.PlaySound();
 }
 public RemoveUFOObserver(IrrKlang.ISound pHardwareSound)
 {
     this.pInvader       = null;
     this.pHardwareSound = pHardwareSound;
 }
Beispiel #22
0
 public IrrKlang.ISound StartUFO()
 {
     UFOSound = sndEngine.Play2D(sndUFO, true, false, true);
     return(UFOSound);
 }
Beispiel #23
0
		// plays filename selected in edit box
		void playSelectedFile()
		{
			// stop currently playing sound

			if (currentlyPlayingSound != null)
				currentlyPlayingSound.Stop();

			// start new sound

			currentlyPlayingSound = irrKlangEngine.Play2D(filenameTextBox.Text, true);

			// update controls to display the playing file

			UpdatePauseButtonText();
			
            volumeTrackBar.Value = 100;
		}
Beispiel #24
0
        // plays filename selected in edit box
        void playSelectedFile()
        {
            // stop currently playing sound

            if (currentlyPlayingSound != null)
                currentlyPlayingSound.Stop();

            // start new sound

            currentlySelectedIndex = listBox1.SelectedIndex;
            currentlyPlayingSound = irrKlangEngine.Play2D(filepath + "\\" + listBox1.SelectedItem as String, false);

            // update controls to display the playing file

            System.Threading.Timer timer = new System.Threading.Timer(callback, "hello", TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2));
            UpdatePauseButtonText();

            volumeTrackBar.Value = 100;
        }
Beispiel #25
0
 private void callback(object state)
 {
     if (currentlyPlayingSound != null)
     {
         if (currentlyPlayingSound.Finished)
         {
             currentlySelectedIndex += 1;
             string nextSong = listBox1.Items[currentlySelectedIndex].ToString();
             currentlyPlayingSound = irrKlangEngine.Play2D(filepath + "\\" + nextSong as String, false);
         }
     }
 }
Beispiel #26
0
 public void getnext(string mupath)
 {
     curMusic = player.Play2D(mupath);
 }
Beispiel #27
0
 public void rotateSound()
 {
     sndRotate = AudioEngine.Play2D("line.wav");
     sndShoot  = AudioEngine.Play2D(srcLine, false, false, false);
 }
Beispiel #28
0
 //Prebacivanje u mod "Snimanje"
 private void button13_Click(object sender, EventArgs e)
 {
     ZaustaviReprodukciju(); //Zaustavljanje reprodukcije
     clear_Click(sender, e); //Èišæenje liste
     postaviDugme(false);
     panel4_MouseEnter(sender, e); //povlaèenje pokretnog menija
     currentlyPlayingSound = null;
 }
Beispiel #29
0
 public override void notify()
 {
     IrrKlang.ISound music = soundEngine.Play2D(soundName);
     music.Volume = 0.2f;
 }
Beispiel #30
0
 public override void Notify()
 {
     IrrKlang.ISound pSnd = SoundEngineManager.GetSoundEngine().Play2D("invaderkilled.wav");
 }
Beispiel #31
0
 public void themeSong()
 {
     music        = AudioEngine.Play2D("theme.wav", true);
     music.Volume = 0.2f;
 }
Beispiel #32
0
 /// <summary>
 /// Stop button click action
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void StopButton_Click(object sender, System.EventArgs e)
 {
     if (currentlyPlayingSound != null)
     {
         currentlyPlayingSound.Stop();
         currentlyPlayingSound = null;
     }
 }
Beispiel #33
0
 public IrrKlang.ISound PlaySound()
 {
     pSndEngine.SoundVolume = this.volumn;
     IrrKlang.ISound pSnd = pSndEngine.Play2D(this.soundFile, this.isLoop);
     return(pSnd);
 }
Beispiel #34
0
        private void PlaySelectedFile()
        {
            // stop currently playing sound

            if (currentlyPlayingSound != null)
                currentlyPlayingSound.Stop();

            // start new sound

            currentlyPlayingSound = irrKlangEngine.Play2D(currentPathname, true);
        }
Beispiel #35
0
 public void fastPlace()
 {
     soundEffect = AudioEngine.Play2D("shoot.wav");
     sndShoot    = AudioEngine.Play2D(srcShoot, false, false, false);
 }
Beispiel #36
0
 public void normalPlace()
 {
     soundEffect = AudioEngine.Play2D("selection.wav");
     sndShoot    = AudioEngine.Play2D(srcSelection, false, false, false);
 }
Beispiel #37
0
        /// <summary>
        /// Play the selected file using the path
        /// </summary>
        /// <param name="filename"></param>
        void playSelectedFile(string filename)
        {
            if (currentlyPlayingSound != null)
            {
                currentlyPlayingSound.Stop();
            }

            currentlyPlayingSound = irrKlangEngine.Play2D(filename, true);

            UpdatePauseButtonText();
        }
Beispiel #38
0
 public void gameOver()
 {
     soundEffect = AudioEngine.Play2D("fall.wav");
     sndShoot    = AudioEngine.Play2D(srcFall, false, false, false);
 }
Beispiel #39
0
 public override void Notify()
 {
     //Debug.WriteLine(" Snd_Observer: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);
     pSndEngine.SoundVolume = this.volumn;
     IrrKlang.ISound pSnd = pSndEngine.Play2D(this.soundFile, this.isLoop);
 }
Beispiel #40
0
 public void setFirst(string mupath)
 {
     curMusic = player.Play2D(mupath);
     Stop();
 }
Beispiel #41
0
 public void completeLine()
 {
     soundEffect = AudioEngine.Play2D("clear.wav");
     sndShoot    = AudioEngine.Play2D(srcClear, false, false, false);
 }
Beispiel #42
0
        private void PokreniReprodukciju()
        {
            try
            {
                if (!reprodukcija)
                {
                    currentlyPlayingSound = irrKlangEngine.Play2D(aktuelnaPjesma, false, true);
                    currentlyPlayingSound.PlaybackSpeed = 1;

                    brzina.Text = "Brzina: 1";
                    interval = 500;
                    jacinaZvuka();
                    reprodukcija = true;
                }

                format.Text = "Format: " + vratiFormat(aktuelnaPjesma);
                formatPjesme = vratiFormat(aktuelnaPjesma);
                play.Visible = false;
                pauza.Visible = true;
                currentlyPlayingSound.Paused = false;
                timer.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ne postoji datoteka \n\nError: " + ex.Message.ToString(),
                                "Greška", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }